fix: better function hoisting for code gen functions
mainly code gen function dependencies won't be hoisted to the top.
This commit is contained in:
parent
0d0c96deda
commit
7201163b77
|
@ -2506,7 +2506,7 @@ impl<'a> CodeGenerator<'a> {
|
|||
};
|
||||
|
||||
for (_index, name, tipo) in arg_indices.clone() {
|
||||
let mut call_stack = expect_stack.empty_with_scope();
|
||||
let mut call_stack = arg_stack.empty_with_scope();
|
||||
|
||||
self.expect_type(&tipo, &mut call_stack, &name, defined_data_types);
|
||||
|
||||
|
@ -3240,10 +3240,20 @@ impl<'a> CodeGenerator<'a> {
|
|||
variant_name: "".to_string(),
|
||||
};
|
||||
|
||||
let function_stack = AirStack {
|
||||
id_gen: self.id_gen.clone(),
|
||||
scope: scope.clone(),
|
||||
air: func_ir,
|
||||
};
|
||||
|
||||
let mut new_stack = AirStack::with_scope(self.id_gen.clone(), scope.clone());
|
||||
|
||||
new_stack.merge_child(function_stack);
|
||||
|
||||
func_components.insert(
|
||||
function_key.clone(),
|
||||
FuncComponents {
|
||||
ir: func_ir,
|
||||
ir: new_stack.complete(),
|
||||
dependencies: dependencies
|
||||
.into_iter()
|
||||
.map(|item| FunctionAccessKey {
|
||||
|
|
|
@ -71,7 +71,6 @@ fn assert_uplc(source_code: &str, expected: Term<Name>, should_fail: bool) {
|
|||
};
|
||||
|
||||
let expected = optimize::aiken_optimize_and_intern(expected);
|
||||
println!("EXP {}", expected.to_pretty());
|
||||
|
||||
let expected: Program<DeBruijn> = expected.try_into().unwrap();
|
||||
|
||||
|
@ -102,8 +101,6 @@ fn assert_uplc(source_code: &str, expected: Term<Name>, should_fail: bool) {
|
|||
|
||||
let expected = optimize::aiken_optimize_and_intern(expected);
|
||||
|
||||
println!("EXP {}", expected.to_pretty());
|
||||
|
||||
let expected: Program<DeBruijn> = expected.try_into().unwrap();
|
||||
|
||||
assert_eq!(debruijn_program.to_pretty(), expected.to_pretty());
|
||||
|
|
Loading…
Reference in New Issue