Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ast][lir] Fix late init declaration pretty printing #1109

Merged
merged 1 commit into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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