Skip to content

Commit

Permalink
[ast][lir] Fix late init declaration pretty printing (#1109)
Browse files Browse the repository at this point in the history
  • Loading branch information
SamChou19815 authored Oct 20, 2023
1 parent 56ce9d9 commit e80ad30
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion crates/samlang-core/src/ast/lir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ impl Statement {
collector.push_str(name.as_str(heap));
collector.push_str(": ");
type_.pretty_print(collector, heap, table);
collector.push_str("undefined as any;\n");
collector.push_str(" = undefined as any;\n");
}
Statement::LateInitAssignment { name, assigned_expression } => {
Self::append_spaces(collector, level);
Expand Down
2 changes: 1 addition & 1 deletion crates/samlang-core/src/ast/lir_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ function __$f(v1: () => number): number {{
let f: number = big[0];
0[0] = 0;
let c = 0 as unknown as number;
let c: numberundefined as any;
let c: number = undefined as any;
c = 0;
break;
bar = b2;
Expand Down
2 changes: 1 addition & 1 deletion crates/samlang-core/src/compiler/lir_lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1123,7 +1123,7 @@ function __$compiled_program_main(): number {{
let cast = 0 as unknown as number;
finalV2 = 0;
}} else {{
let cast: numberundefined as any;
let cast: number = undefined as any;
cast = 0;
finalV2 = 0;
}}
Expand Down

0 comments on commit e80ad30

Please sign in to comment.