use indexmap::IndexSet; use std::sync::Arc; use uplc::builtins::DefaultFunction; use crate::{ ast::{BinOp, UnOp}, tipo::{Type, ValueConstructor}, }; #[derive(Debug, Clone, PartialEq)] pub enum Air { // Primitives Int { value: String, }, String { value: String, }, ByteArray { bytes: Vec, }, Bool { value: bool, }, List { count: usize, tipo: Arc, tail: bool, }, Tuple { tipo: Arc, count: usize, }, Void, Var { constructor: ValueConstructor, name: String, variant_name: String, }, // Functions Call { count: usize, tipo: Arc, }, DefineFunc { func_name: String, module_name: String, params: Vec, recursive: bool, recursive_static_params: Vec, variant_name: String, }, Fn { params: Vec, }, Builtin { count: usize, func: DefaultFunction, tipo: Arc, }, // Operators BinOp { name: BinOp, tipo: Arc, argument_tipo: Arc, }, UnOp { op: UnOp, }, // Assignment Let { name: String, }, CastFromData { tipo: Arc, }, CastToData { tipo: Arc, }, AssertConstr { constr_index: usize, }, AssertBool { is_true: bool, }, // When When { tipo: Arc, subject_name: String, subject_tipo: Arc, }, Clause { subject_tipo: Arc, subject_name: String, complex_clause: bool, }, ListClause { subject_tipo: Arc, tail_name: String, next_tail_name: Option, complex_clause: bool, }, WrapClause, TupleClause { subject_tipo: Arc, indices: IndexSet<(usize, String)>, predefined_indices: IndexSet<(usize, String)>, subject_name: String, complex_clause: bool, }, ClauseGuard { subject_name: String, subject_tipo: Arc, }, ListClauseGuard { subject_tipo: Arc, tail_name: String, next_tail_name: Option, inverse: bool, }, TupleGuard { subject_tipo: Arc, indices: IndexSet<(usize, String)>, subject_name: String, }, Finally, // If If { tipo: Arc, }, // Record Creation Constr { tag: usize, tipo: Arc, count: usize, }, RecordUpdate { highest_index: usize, indices: Vec<(usize, Arc)>, tipo: Arc, }, // Field Access RecordAccess { record_index: u64, tipo: Arc, }, FieldsExpose { indices: Vec<(usize, String, Arc)>, check_last_item: bool, }, // ListAccess ListAccessor { tipo: Arc, names: Vec, tail: bool, check_last_item: bool, }, ListExpose { tipo: Arc, tail_head_names: Vec<(String, String)>, tail: Option<(String, String)>, }, // Tuple Access TupleAccessor { names: Vec, tipo: Arc, check_last_item: bool, }, TupleIndex { tipo: Arc, tuple_index: usize, }, // Misc. ErrorTerm { tipo: Arc, }, Trace { tipo: Arc, }, NoOp, FieldsEmpty, ListEmpty, }