use indexmap::IndexSet; use std::rc::Rc; 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: Rc, tail: bool, }, Tuple { tipo: Rc, count: usize, }, Void, Var { constructor: ValueConstructor, name: String, variant_name: String, }, // Functions Call { count: usize, tipo: Rc, }, DefineFunc { func_name: String, module_name: String, params: Vec, recursive: bool, recursive_nonstatic_params: Vec, variant_name: String, }, DefineCyclicFuncs { func_name: String, module_name: String, variant_name: String, // just the params contained_functions: Vec>, }, Fn { params: Vec, }, Builtin { count: usize, func: DefaultFunction, tipo: Rc, }, // Operators BinOp { name: BinOp, tipo: Rc, argument_tipo: Rc, }, UnOp { op: UnOp, }, // Assignment Let { name: String, }, CastFromData { tipo: Rc, }, CastToData { tipo: Rc, }, AssertConstr { constr_index: usize, }, AssertBool { is_true: bool, }, // When When { tipo: Rc, subject_name: String, subject_tipo: Rc, }, Clause { subject_tipo: Rc, subject_name: String, complex_clause: bool, }, ListClause { subject_tipo: Rc, tail_name: String, next_tail_name: Option<(String, String)>, complex_clause: bool, }, WrapClause, TupleClause { subject_tipo: Rc, indices: IndexSet<(usize, String)>, predefined_indices: IndexSet<(usize, String)>, subject_name: String, complex_clause: bool, }, ClauseGuard { subject_name: String, subject_tipo: Rc, }, ListClauseGuard { subject_tipo: Rc, tail_name: String, next_tail_name: Option, inverse: bool, }, TupleGuard { subject_tipo: Rc, indices: IndexSet<(usize, String)>, subject_name: String, }, Finally, // If If { tipo: Rc, }, // Record Creation Constr { tag: usize, tipo: Rc, count: usize, }, RecordUpdate { highest_index: usize, indices: Vec<(usize, Rc)>, tipo: Rc, }, // Field Access FieldsExpose { indices: Vec<(usize, String, Rc)>, check_last_item: bool, }, // ListAccess ListAccessor { tipo: Rc, names: Vec, tail: bool, check_last_item: bool, }, ListExpose { tipo: Rc, tail_head_names: Vec<(String, String)>, tail: Option<(String, String)>, }, // Tuple Access TupleAccessor { names: Vec, tipo: Rc, check_last_item: bool, }, // Misc. ErrorTerm { tipo: Rc, validator: bool, }, Trace { tipo: Rc, }, NoOp, FieldsEmpty, ListEmpty, }