fix: the following issues
fix conversion from inner opaque type for when and assignment This fixes Clause being used in cases where ListClause or TupleClause should be used Reset defined and zero arg functions between each code gen Fixes for optimizations when encountering shadowed variables
This commit is contained in:
parent
c32a9d7b6f
commit
f1b24a5f6d
|
@ -91,12 +91,8 @@ impl<'a> CodeGenerator<'a> {
|
|||
|
||||
self.define_ir(&mut ir_stack);
|
||||
|
||||
println!("{ir_stack:#?}");
|
||||
|
||||
self.convert_opaque_type_to_inner_ir(&mut ir_stack);
|
||||
|
||||
println!("{ir_stack:#?}");
|
||||
|
||||
let mut term = self.uplc_code_gen(&mut ir_stack);
|
||||
|
||||
if self.needs_field_access {
|
||||
|
@ -125,8 +121,6 @@ impl<'a> CodeGenerator<'a> {
|
|||
term,
|
||||
};
|
||||
|
||||
println!("{}", program.to_pretty());
|
||||
|
||||
program = aiken_optimize_and_intern(program);
|
||||
|
||||
program
|
||||
|
@ -2341,14 +2335,14 @@ impl<'a> CodeGenerator<'a> {
|
|||
.iter()
|
||||
.map(|(index, id)| format!("__tuple_index_{index}_{id}"))
|
||||
.collect_vec(),
|
||||
tipo: tipo.clone().into(),
|
||||
tipo: tipo.clone(),
|
||||
check_last_item: true,
|
||||
});
|
||||
|
||||
assert_vec.push(Air::Var {
|
||||
scope: scope.clone(),
|
||||
constructor: ValueConstructor::public(
|
||||
tipo.clone().into(),
|
||||
tipo.clone(),
|
||||
ValueConstructorVariant::LocalVariable {
|
||||
location: Span::empty(),
|
||||
},
|
||||
|
@ -2459,7 +2453,7 @@ impl<'a> CodeGenerator<'a> {
|
|||
|
||||
assert_vec.push(Air::ErrorTerm {
|
||||
scope,
|
||||
tipo: tipo.clone().into(),
|
||||
tipo: tipo.clone(),
|
||||
label: Some("Constr index did not match any type variant".to_string()),
|
||||
});
|
||||
}
|
||||
|
@ -3538,12 +3532,8 @@ impl<'a> CodeGenerator<'a> {
|
|||
let mut arg_stack: Vec<Term<Name>> = vec![];
|
||||
|
||||
while let Some(ir_element) = ir_stack.pop() {
|
||||
println!("IR ELEMENT IS {:#?}", ir_element);
|
||||
self.gen_uplc(ir_element, &mut arg_stack);
|
||||
|
||||
println!("Arg STACK LEN IS {:#?} ", arg_stack.len());
|
||||
}
|
||||
println!("ARGSTACK FINALLY IS {:#?}", arg_stack);
|
||||
arg_stack[0].clone()
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::{
|
||||
ast::{Name, Program},
|
||||
ast::{Name, NamedDeBruijn, Program},
|
||||
parser::interner::Interner,
|
||||
};
|
||||
|
||||
|
@ -12,5 +12,10 @@ pub fn aiken_optimize_and_intern(program: Program<Name>) -> Program<Name> {
|
|||
|
||||
interner.program(&mut program);
|
||||
|
||||
// Use conversion to Debruijn to prevent optimizations from affecting shadowing
|
||||
let program_named: Program<NamedDeBruijn> = program.try_into().unwrap();
|
||||
|
||||
let program: Program<Name> = program_named.try_into().unwrap();
|
||||
|
||||
program.lambda_reduce().inline_reduce()
|
||||
}
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
"title": "Data",
|
||||
"description": "Any Plutus data."
|
||||
},
|
||||
"compiledCode": "59011501000032323232323222253330043232323330010013758660046006660046006008900024008464664464666018002941289929998078008a5114a066446644a66601e66e1cc040dd500124004200226eacc04cc02c008cc88ccc01c01c0080040080052f5bded8c06eaccc018c01c0092002001002488105000000000000222533300e00213374a900125eb804c94ccc030cdc78011bae300d00113374a900019aba0374c6eacc0380052f5c026660080086022006004601e004444a666018004294054ccc024c004c034008528899980180198070010009119199800800a4000006444666601466e1c0100080388ccc010010cdc0001a400460200020024600e6ea8004526165734aae7555cf2ab9f5742ae881",
|
||||
"hash": "09a81db49a475be929c1119b5b89ebb97f1e6d8aae064467c0f04cf1"
|
||||
"compiledCode": "59015f010000323232323232323232322225333006323232323233001003232323322323232323330140014a0944004c94ccc05c0045288a5000133223233223253330173370e00290010801099190009bab301e00130110033018375400400297adef6c6033223300800200100200100100237566601260140049001001a441050000000000003001001222533301300213374a900125eb804c8c8c8c94ccc04ccdc7802800899ba548000cc060dd300125eb804ccc01c01c00c014dd7180a0019bab3014002301700330150023001001222533301000214a026464a66601c600600429444ccc01401400400cc05000cc048008dd6198009801198009801001a400090021119199800800a4000006444666601866e1c0100080488ccc010010cdc0001a40046028002002460146ea8004526163001001222533300800214984cc014c004c028008ccc00c00cc02c0080055cd2b9b5573aaae7955cfaba05742ae89",
|
||||
"hash": "3f46b921ead33594e1da4afa1f1ba31807c0d8deca029f96fe9fe394"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -29,8 +29,8 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"compiledCode": "4d01000022253335734944526161",
|
||||
"hash": "455f24922a520c59499fdafad95e1272fab81a99452f6b9545f95337"
|
||||
"compiledCode": "583b0100003232323232323222253330064a22930b180080091129998030010a4c26600a6002600e0046660060066010004002ae695cdaab9f5742ae89",
|
||||
"hash": "e37db487fbd58c45d059bcbf5cd6b1604d3bec16cf888f1395a4ebc4"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -15,8 +15,8 @@
|
|||
"title": "Data",
|
||||
"description": "Any Plutus data."
|
||||
},
|
||||
"compiledCode": "58230100002225333573466e1cc8dd69aab9d0014bded8c101040001010100480205261601",
|
||||
"hash": "49281ef1e9c5fa8211d9ec1ae6571c4a6618432fe70bebe93e00e4af"
|
||||
"compiledCode": "586001000032323232323232323222253330063370e6464640046eb4c02c008dd69804800a5ef6c6010104000101010048020526163001001222533300800214984cc014c004c024008ccc00c00cc0280080055cd2b9b5573aaae7955cfaba157441",
|
||||
"hash": "7ecbfc3ae91c4d5ba3799b4d283e385d457c860cd22034d825379ae2"
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue