diff --git a/compiler/emit_js.phi b/compiler/emit_js.phi index 48a3db7..90c76be 100644 --- a/compiler/emit_js.phi +++ b/compiler/emit_js.phi @@ -44,6 +44,7 @@ (define_builtin ident builtin_id) )) + (emit (format "// === emitting file % ===\n" filename)) (enter_scope) (discover_syms ast) (emit_exprs ast) @@ -156,6 +157,7 @@ (let (parse) parser) (let ast (parse)) + (emit (format "// === emitting file % ===\n" filename)) (emit (format "runtime.setFile(\"%\");\n" filename)) (let outer_syms syms) @@ -173,7 +175,8 @@ (= syms outer_syms) (= filename outer_filename) - (emit (format "runtime.setFile(\"%\");\n" outer_filename)) + (emit (format "\n// === resuming file % ===\n" outer_filename)) + (emit (format "runtime.setFile(\"%\")" outer_filename)) )) (list_pop import_stack) diff --git a/stage2.js b/stage2.js index 5aa0b29..d8d282f 100644 --- a/stage2.js +++ b/stage2.js @@ -1,6 +1,8 @@ #!/usr/bin/env node import { Runtime } from "./runtime.js"; const runtime = new Runtime("compile.phi"); +// === emitting file compile.phi === +// === emitting file stdlib.phi === runtime.setFile("stdlib.phi"); function _slice29(_list40, _idx41) { runtime.pushCall("slice", "stdlib.phi"); @@ -207,8 +209,10 @@ return { type: "null" }; runtime.popCall(); return { type: "null" }; }; + +// === resuming file compile.phi === runtime.setFile("compile.phi"); -; +// === emitting file compiler/parse.phi === runtime.setFile("compiler/parse.phi"); ; function _Parser94(_tokens96) { @@ -437,11 +441,14 @@ return _tokens116; runtime.popCall(); return { type: "null" }; }; + +// === resuming file compile.phi === runtime.setFile("compile.phi"); -; +// === emitting file compiler/emit_js.phi === runtime.setFile("compiler/emit_js.phi"); ; ; +// === emitting file compiler/syms.phi === runtime.setFile("compiler/syms.phi"); ; function _Syms155() { @@ -552,8 +559,9 @@ return ({ type: "list", values: [_enter_scope156, _leave_scope157, _define_sym15 runtime.popCall(); return { type: "null" }; }; + +// === resuming file compiler/emit_js.phi === runtime.setFile("compiler/emit_js.phi"); -; function _JsEmitter138(_ast181, _initial_filename182) { runtime.pushCall("JsEmitter", "compiler/emit_js.phi"); const r_64 = ({ type: "list", values: [] }); @@ -590,11 +598,12 @@ const r_78 = r_76.values[1] ?? { type: "null"}; let _builtin_id215 = r_78; (runtime.info("compiler/emit_js.phi", 44), _define_builtin194(_ident214, _builtin_id215)); }; -(runtime.info("compiler/emit_js.phi", 47), _enter_scope198()); -(runtime.info("compiler/emit_js.phi", 48), _discover_syms185(_ast181)); -(runtime.info("compiler/emit_js.phi", 49), _emit_exprs184(_ast181)); +(runtime.info("compiler/emit_js.phi", 47), _emit193((runtime.info("compiler/emit_js.phi", 47), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "// === emitting file % ===\n" }), _filename205)))); +(runtime.info("compiler/emit_js.phi", 48), _enter_scope198()); +(runtime.info("compiler/emit_js.phi", 49), _discover_syms185(_ast181)); +(runtime.info("compiler/emit_js.phi", 50), _emit_exprs184(_ast181)); runtime.popCall(); -return (runtime.info("compiler/emit_js.phi", 50), ((...args) => runtime.builtinStringsJoin(...args))(_output204)); +return (runtime.info("compiler/emit_js.phi", 51), ((...args) => runtime.builtinStringsJoin(...args))(_output204)); ; runtime.popCall(); return { type: "null" }; @@ -603,8 +612,8 @@ function _emit_exprs184(_exprs216) { runtime.pushCall("emit_exprs", "compiler/emit_js.phi"); for (const r_79 of _exprs216.values) {; let _expr217 = r_79; -(runtime.info("compiler/emit_js.phi", 55), _emit_expr186(_expr217)); -(runtime.info("compiler/emit_js.phi", 56), _emit193(({ type: "string", value: ";\n" }))); +(runtime.info("compiler/emit_js.phi", 56), _emit_expr186(_expr217)); +(runtime.info("compiler/emit_js.phi", 57), _emit193(({ type: "string", value: ";\n" }))); }; ; runtime.popCall(); @@ -619,7 +628,7 @@ const r_82 = r_81.values[0] ?? { type: "null"}; let _ty220 = r_82; const r_83 = r_81.values[1] ?? { type: "null"}; let _line221 = r_83; -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 63), runtime.opNe(_ty220, ({ type: "string", value: "list" }))))) { +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 64), runtime.opNe(_ty220, ({ type: "string", value: "list" }))))) { runtime.popCall(); return { type: "null" }}; const r_84 = _expr219; @@ -627,7 +636,7 @@ const r_85 = r_84.values[0] ?? { type: "null"}; const r_86 = r_84.values[1] ?? { type: "null"}; const r_87 = r_84.values[2] ?? { type: "null"}; let _s222 = r_87; -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 65), runtime.opEq((runtime.info("compiler/emit_js.phi", 65), ((...args) => runtime.builtinLen(...args))(_s222)), ({ type: "int", value: 0 }))))) { +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 66), runtime.opEq((runtime.info("compiler/emit_js.phi", 66), ((...args) => runtime.builtinLen(...args))(_s222)), ({ type: "int", value: 0 }))))) { runtime.popCall(); return { type: "null" }}; const r_88 = _s222; @@ -636,7 +645,7 @@ const r_90 = r_89.values[0] ?? { type: "null"}; const r_91 = r_89.values[1] ?? { type: "null"}; const r_92 = r_89.values[2] ?? { type: "null"}; let _id223 = r_92; -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 67), runtime.opEq(_id223, ({ type: "string", value: "fn" }))))) { +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 68), runtime.opEq(_id223, ({ type: "string", value: "fn" }))))) { const r_93 = _s222; const r_94 = r_93.values[0] ?? { type: "null"}; const r_95 = r_93.values[1] ?? { type: "null"}; @@ -651,7 +660,7 @@ const r_102 = r_99.values[2] ?? { type: "null"}; let _params225 = r_102; const r_103 = r_93.values[3] ?? { type: "null"}; let _body226 = r_103; -(runtime.info("compiler/emit_js.phi", 69), _define_fn195(_ident224, _line221)); +(runtime.info("compiler/emit_js.phi", 70), _define_fn195(_ident224, _line221)); }; }; ; @@ -665,80 +674,80 @@ const r_105 = r_104.values[0] ?? { type: "null"}; let _ty228 = r_105; const r_106 = r_104.values[1] ?? { type: "null"}; let _line229 = r_106; -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 76), runtime.opEq(_ty228, ({ type: "string", value: "list" }))))) { -(runtime.info("compiler/emit_js.phi", 77), _emit_list187(_expr227)); +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 77), runtime.opEq(_ty228, ({ type: "string", value: "list" }))))) { +(runtime.info("compiler/emit_js.phi", 78), _emit_list187(_expr227)); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 78), runtime.opEq(_ty228, ({ type: "string", value: "int" }))))) { +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 79), runtime.opEq(_ty228, ({ type: "string", value: "int" }))))) { const r_107 = _expr227; const r_108 = r_107.values[0] ?? { type: "null"}; const r_109 = r_107.values[1] ?? { type: "null"}; const r_110 = r_107.values[2] ?? { type: "null"}; let _value230 = r_110; -(runtime.info("compiler/emit_js.phi", 80), _emit193((runtime.info("compiler/emit_js.phi", 80), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "({ type: \"int\", value: % })" }), _value230)))); +(runtime.info("compiler/emit_js.phi", 81), _emit193((runtime.info("compiler/emit_js.phi", 81), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "({ type: \"int\", value: % })" }), _value230)))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 81), runtime.opEq(_ty228, ({ type: "string", value: "string" }))))) { +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 82), runtime.opEq(_ty228, ({ type: "string", value: "string" }))))) { const r_111 = _expr227; const r_112 = r_111.values[0] ?? { type: "null"}; const r_113 = r_111.values[1] ?? { type: "null"}; const r_114 = r_111.values[2] ?? { type: "null"}; let _value231 = r_114; -(runtime.info("compiler/emit_js.phi", 83), _emit193((runtime.info("compiler/emit_js.phi", 83), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "({ type: \"string\", value: \"%\" })" }), (runtime.info("compiler/emit_js.phi", 83), _string_escape140(_value231)))))); +(runtime.info("compiler/emit_js.phi", 84), _emit193((runtime.info("compiler/emit_js.phi", 84), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "({ type: \"string\", value: \"%\" })" }), (runtime.info("compiler/emit_js.phi", 84), _string_escape140(_value231)))))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 84), runtime.opEq(_ty228, ({ type: "string", value: "ident" }))))) { +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 85), runtime.opEq(_ty228, ({ type: "string", value: "ident" }))))) { const r_115 = _expr227; const r_116 = r_115.values[0] ?? { type: "null"}; const r_117 = r_115.values[1] ?? { type: "null"}; const r_118 = r_115.values[2] ?? { type: "null"}; let _value232 = r_118; -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 87), runtime.opEq(_value232, ({ type: "string", value: "null" }))))) { -(runtime.info("compiler/emit_js.phi", 88), _emit193(({ type: "string", value: "({ type: \"null\" })" }))); +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 88), runtime.opEq(_value232, ({ type: "string", value: "null" }))))) { +(runtime.info("compiler/emit_js.phi", 89), _emit193(({ type: "string", value: "({ type: \"null\" })" }))); runtime.popCall(); return { type: "null" }; } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 90), runtime.opEq(_value232, ({ type: "string", value: "false" }))))) { -(runtime.info("compiler/emit_js.phi", 91), _emit193(({ type: "string", value: "({ type: \"bool\", value: false })" }))); +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 91), runtime.opEq(_value232, ({ type: "string", value: "false" }))))) { +(runtime.info("compiler/emit_js.phi", 92), _emit193(({ type: "string", value: "({ type: \"bool\", value: false })" }))); runtime.popCall(); return { type: "null" }; } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 93), runtime.opEq(_value232, ({ type: "string", value: "true" }))))) { -(runtime.info("compiler/emit_js.phi", 94), _emit193(({ type: "string", value: "({ type: \"bool\", value: true })" }))); +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 94), runtime.opEq(_value232, ({ type: "string", value: "true" }))))) { +(runtime.info("compiler/emit_js.phi", 95), _emit193(({ type: "string", value: "({ type: \"bool\", value: true })" }))); runtime.popCall(); return { type: "null" }; }}}; -const r_119 = (runtime.info("compiler/emit_js.phi", 98), _get_sym201(_value232)); +const r_119 = (runtime.info("compiler/emit_js.phi", 99), _get_sym201(_value232)); let _sym233 = r_119; -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 99), runtime.opEq(_sym233, ({ type: "null" }))))) { -(runtime.info("compiler/emit_js.phi", 100), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "undefined symbol '%' on line %" }), _value232, _line229)); +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 100), runtime.opEq(_sym233, ({ type: "null" }))))) { +(runtime.info("compiler/emit_js.phi", 101), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "undefined symbol '%' on line %" }), _value232, _line229)); }; const r_120 = _sym233; const r_121 = r_120.values[0] ?? { type: "null"}; let _sym_id234 = r_121; const r_122 = r_120.values[1] ?? { type: "null"}; let _sym_ty235 = r_122; -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 104), runtime.opEq(_sym_ty235, ({ type: "string", value: "builtin" }))))) { +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 105), runtime.opEq(_sym_ty235, ({ type: "string", value: "builtin" }))))) { const r_123 = _sym233; const r_124 = r_123.values[0] ?? { type: "null"}; const r_125 = r_123.values[1] ?? { type: "null"}; const r_126 = r_123.values[2] ?? { type: "null"}; let _id236 = r_126; -(runtime.info("compiler/emit_js.phi", 106), _emit193((runtime.info("compiler/emit_js.phi", 106), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "((...args) => runtime.%(...args))" }), _id236)))); +(runtime.info("compiler/emit_js.phi", 107), _emit193((runtime.info("compiler/emit_js.phi", 107), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "((...args) => runtime.%(...args))" }), _id236)))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 107), runtime.opEq(_sym_ty235, ({ type: "string", value: "fn" }))))) { -(runtime.info("compiler/emit_js.phi", 108), _emit193((runtime.info("compiler/emit_js.phi", 108), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "_%%" }), _value232, _sym_id234)))); +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 108), runtime.opEq(_sym_ty235, ({ type: "string", value: "fn" }))))) { +(runtime.info("compiler/emit_js.phi", 109), _emit193((runtime.info("compiler/emit_js.phi", 109), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "_%%" }), _value232, _sym_id234)))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 109), runtime.opEq(_sym_ty235, ({ type: "string", value: "param" }))))) { -(runtime.info("compiler/emit_js.phi", 110), _emit193((runtime.info("compiler/emit_js.phi", 110), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "_%%" }), _value232, _sym_id234)))); +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 110), runtime.opEq(_sym_ty235, ({ type: "string", value: "param" }))))) { +(runtime.info("compiler/emit_js.phi", 111), _emit193((runtime.info("compiler/emit_js.phi", 111), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "_%%" }), _value232, _sym_id234)))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 111), runtime.opEq(_sym_ty235, ({ type: "string", value: "let" }))))) { -(runtime.info("compiler/emit_js.phi", 112), _emit193((runtime.info("compiler/emit_js.phi", 112), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "_%%" }), _value232, _sym_id234)))); +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 112), runtime.opEq(_sym_ty235, ({ type: "string", value: "let" }))))) { +(runtime.info("compiler/emit_js.phi", 113), _emit193((runtime.info("compiler/emit_js.phi", 113), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "_%%" }), _value232, _sym_id234)))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 113), runtime.opEq(_sym_ty235, ({ type: "string", value: "imported" }))))) { -(runtime.info("compiler/emit_js.phi", 118), _emit193((runtime.info("compiler/emit_js.phi", 118), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "_%%" }), _value232, _sym_id234)))); +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 114), runtime.opEq(_sym_ty235, ({ type: "string", value: "imported" }))))) { +(runtime.info("compiler/emit_js.phi", 119), _emit193((runtime.info("compiler/emit_js.phi", 119), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "_%%" }), _value232, _sym_id234)))); } else { -(runtime.info("compiler/emit_js.phi", 120), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "not implemented '%'" }), _sym_ty235)); +(runtime.info("compiler/emit_js.phi", 121), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "not implemented '%'" }), _sym_ty235)); }}}}}; } else { -(runtime.info("compiler/emit_js.phi", 123), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "unknown expr type '%' on line %" }), _ty228, _line229)); +(runtime.info("compiler/emit_js.phi", 124), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "unknown expr type '%' on line %" }), _ty228, _line229)); }}}}; ; runtime.popCall(); @@ -753,8 +762,8 @@ const r_129 = r_127.values[1] ?? { type: "null"}; let _line239 = r_129; const r_130 = r_127.values[2] ?? { type: "null"}; let _s240 = r_130; -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 129), runtime.opEq((runtime.info("compiler/emit_js.phi", 129), ((...args) => runtime.builtinLen(...args))(_s240)), ({ type: "int", value: 0 }))))) { -(runtime.info("compiler/emit_js.phi", 130), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "illegal function on line %" }), _line239)); +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 130), runtime.opEq((runtime.info("compiler/emit_js.phi", 130), ((...args) => runtime.builtinLen(...args))(_s240)), ({ type: "int", value: 0 }))))) { +(runtime.info("compiler/emit_js.phi", 131), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "illegal function on line %" }), _line239)); }; const r_131 = _s240; const r_132 = r_131.values[0] ?? { type: "null"}; @@ -763,10 +772,10 @@ let _id_ty241 = r_133; const r_134 = r_132.values[1] ?? { type: "null"}; const r_135 = r_132.values[2] ?? { type: "null"}; let _id242 = r_135; -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 133), runtime.opNe(_id_ty241, ({ type: "string", value: "ident" }))))) { -(runtime.info("compiler/emit_js.phi", 134), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "illegal function on line %" }), _line239)); +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 134), runtime.opNe(_id_ty241, ({ type: "string", value: "ident" }))))) { +(runtime.info("compiler/emit_js.phi", 135), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "illegal function on line %" }), _line239)); }; -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 136), runtime.opEq(_id242, ({ type: "string", value: "import" }))))) { +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 137), runtime.opEq(_id242, ({ type: "string", value: "import" }))))) { const r_136 = _s240; const r_137 = r_136.values[0] ?? { type: "null"}; const r_138 = r_136.values[1] ?? { type: "null"}; @@ -779,51 +788,53 @@ const r_143 = r_142.values[0] ?? { type: "null"}; const r_144 = r_142.values[1] ?? { type: "null"}; const r_145 = r_142.values[2] ?? { type: "null"}; let _idents244 = r_145; -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 139), _list_contains35(_import_stack211, _inner_filename243)))) { -(runtime.info("compiler/emit_js.phi", 140), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "circular dependendy: '%' imports '%'" }), _filename205, _inner_filename243)); +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 140), _list_contains35(_import_stack211, _inner_filename243)))) { +(runtime.info("compiler/emit_js.phi", 141), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "circular dependendy: '%' imports '%'" }), _filename205, _inner_filename243)); }; -(runtime.info("compiler/emit_js.phi", 142), _list_push33(_import_stack211, _inner_filename243)); +(runtime.info("compiler/emit_js.phi", 143), _list_push33(_import_stack211, _inner_filename243)); const r_146 = ({ type: "null" }); let _sym_map245 = r_146; -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 146), _map_has37(_imported_files212, _inner_filename243)))) { -(_sym_map245 = (runtime.info("compiler/emit_js.phi", 147), _map_get38(_imported_files212, _inner_filename243))); +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 147), _map_has37(_imported_files212, _inner_filename243)))) { +(_sym_map245 = (runtime.info("compiler/emit_js.phi", 148), _map_get38(_imported_files212, _inner_filename243))); } else { -(runtime.info("compiler/emit_js.phi", 149), ((...args) => runtime.builtinPrintln(...args))(({ type: "string", value: "compiling '%'" }), _inner_filename243)); +(runtime.info("compiler/emit_js.phi", 150), ((...args) => runtime.builtinPrintln(...args))(({ type: "string", value: "compiling '%'" }), _inner_filename243)); const r_147 = _filename205; let _outer_filename246 = r_147; (_filename205 = _inner_filename243); -const r_148 = (runtime.info("compiler/emit_js.phi", 153), ((...args) => runtime.builtinReadTextFile(...args))(_filename205)); +const r_148 = (runtime.info("compiler/emit_js.phi", 154), ((...args) => runtime.builtinReadTextFile(...args))(_filename205)); let _text247 = r_148; -const r_149 = (runtime.info("compiler/emit_js.phi", 154), _tokenize95(_text247)); +const r_149 = (runtime.info("compiler/emit_js.phi", 155), _tokenize95(_text247)); let _tokens248 = r_149; -const r_150 = (runtime.info("compiler/emit_js.phi", 155), _Parser94(_tokens248)); +const r_150 = (runtime.info("compiler/emit_js.phi", 156), _Parser94(_tokens248)); let _parser249 = r_150; const r_151 = _parser249; const r_152 = r_151.values[0] ?? { type: "null"}; let _parse250 = r_152; -const r_153 = (runtime.info("compiler/emit_js.phi", 157), _parse250()); +const r_153 = (runtime.info("compiler/emit_js.phi", 158), _parse250()); let _ast251 = r_153; -(runtime.info("compiler/emit_js.phi", 159), _emit193((runtime.info("compiler/emit_js.phi", 159), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "runtime.setFile(\"%\");\n" }), _filename205)))); +(runtime.info("compiler/emit_js.phi", 160), _emit193((runtime.info("compiler/emit_js.phi", 160), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "// === emitting file % ===\n" }), _filename205)))); +(runtime.info("compiler/emit_js.phi", 161), _emit193((runtime.info("compiler/emit_js.phi", 161), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "runtime.setFile(\"%\");\n" }), _filename205)))); const r_154 = _syms206; let _outer_syms252 = r_154; -(_syms206 = (runtime.info("compiler/emit_js.phi", 162), _Syms155())); +(_syms206 = (runtime.info("compiler/emit_js.phi", 164), _Syms155())); for (const r_155 of _builtin_syms213.values) {; const r_156 = r_155.values[0] ?? { type: "null"}; let _ident253 = r_156; const r_157 = r_155.values[1] ?? { type: "null"}; let _builtin_id254 = r_157; -(runtime.info("compiler/emit_js.phi", 164), _define_builtin194(_ident253, _builtin_id254)); +(runtime.info("compiler/emit_js.phi", 166), _define_builtin194(_ident253, _builtin_id254)); }; -(runtime.info("compiler/emit_js.phi", 167), _enter_scope198()); -(runtime.info("compiler/emit_js.phi", 168), _discover_syms185(_ast251)); -(runtime.info("compiler/emit_js.phi", 169), _emit_exprs184(_ast251)); -(_sym_map245 = (runtime.info("compiler/emit_js.phi", 170), _get_current_map202())); -(runtime.info("compiler/emit_js.phi", 171), _map_set39(_imported_files212, _filename205, _sym_map245)); +(runtime.info("compiler/emit_js.phi", 169), _enter_scope198()); +(runtime.info("compiler/emit_js.phi", 170), _discover_syms185(_ast251)); +(runtime.info("compiler/emit_js.phi", 171), _emit_exprs184(_ast251)); +(_sym_map245 = (runtime.info("compiler/emit_js.phi", 172), _get_current_map202())); +(runtime.info("compiler/emit_js.phi", 173), _map_set39(_imported_files212, _filename205, _sym_map245)); (_syms206 = _outer_syms252); (_filename205 = _outer_filename246); -(runtime.info("compiler/emit_js.phi", 176), _emit193((runtime.info("compiler/emit_js.phi", 176), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "runtime.setFile(\"%\");\n" }), _outer_filename246)))); +(runtime.info("compiler/emit_js.phi", 178), _emit193((runtime.info("compiler/emit_js.phi", 178), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "\n// === resuming file % ===\n" }), _outer_filename246)))); +(runtime.info("compiler/emit_js.phi", 179), _emit193((runtime.info("compiler/emit_js.phi", 179), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "runtime.setFile(\"%\")" }), _outer_filename246)))); }; -(runtime.info("compiler/emit_js.phi", 178), _list_pop34(_import_stack211)); +(runtime.info("compiler/emit_js.phi", 181), _list_pop34(_import_stack211)); for (const r_158 of _idents244.values) {; const r_159 = r_158.values[0] ?? { type: "null"}; const r_160 = r_158.values[1] ?? { type: "null"}; @@ -836,29 +847,29 @@ const r_164 = r_163.values[0] ?? { type: "null"}; let _sym_ident257 = r_164; const r_165 = r_163.values[1] ?? { type: "null"}; let _found_sym258 = r_165; -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 183), runtime.opEq(_sym_ident257, _ident255)))) { +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 186), runtime.opEq(_sym_ident257, _ident255)))) { (_sym256 = _found_sym258); break; }; }; -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 188), runtime.opEq(_sym256, ({ type: "null" }))))) { -(runtime.info("compiler/emit_js.phi", 189), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "no symbol '%' from imported '%'" }), _ident255, _inner_filename243)); +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 191), runtime.opEq(_sym256, ({ type: "null" }))))) { +(runtime.info("compiler/emit_js.phi", 192), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "no symbol '%' from imported '%'" }), _ident255, _inner_filename243)); }; const r_166 = _sym256; const r_167 = r_166.values[0] ?? { type: "null"}; const r_168 = r_166.values[1] ?? { type: "null"}; let _sym_type259 = r_168; -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 192), runtime.opEq(_sym_type259, ({ type: "string", value: "imported" }))))) { -(runtime.info("compiler/emit_js.phi", 193), _define_sym200(_ident255, _sym256)); +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 195), runtime.opEq(_sym_type259, ({ type: "string", value: "imported" }))))) { +(runtime.info("compiler/emit_js.phi", 196), _define_sym200(_ident255, _sym256)); } else { const r_169 = _sym256; const r_170 = r_169.values[0] ?? { type: "null"}; let _sym_id260 = r_170; -(runtime.info("compiler/emit_js.phi", 196), _define_sym200(_ident255, ({ type: "list", values: [_sym_id260, ({ type: "string", value: "imported" }), _sym256] }))); +(runtime.info("compiler/emit_js.phi", 199), _define_sym200(_ident255, ({ type: "list", values: [_sym_id260, ({ type: "string", value: "imported" }), _sym256] }))); }; }; } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 199), runtime.opEq(_id242, ({ type: "string", value: "fn" }))))) { +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 202), runtime.opEq(_id242, ({ type: "string", value: "fn" }))))) { const r_171 = _s240; const r_172 = r_171.values[0] ?? { type: "null"}; const r_173 = r_171.values[1] ?? { type: "null"}; @@ -873,13 +884,13 @@ const r_180 = r_177.values[2] ?? { type: "null"}; let _params262 = r_180; const r_181 = r_171.values[3] ?? { type: "null"}; let _body263 = r_181; -const r_182 = (runtime.info("compiler/emit_js.phi", 202), _get_sym201(_ident261)); +const r_182 = (runtime.info("compiler/emit_js.phi", 205), _get_sym201(_ident261)); let _sym264 = r_182; const r_183 = _sym264; const r_184 = r_183.values[0] ?? { type: "null"}; let _sym_id265 = r_184; -(runtime.info("compiler/emit_js.phi", 205), _emit193((runtime.info("compiler/emit_js.phi", 205), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "function _%%(" }), _ident261, _sym_id265)))); -(runtime.info("compiler/emit_js.phi", 207), _enter_scope198()); +(runtime.info("compiler/emit_js.phi", 208), _emit193((runtime.info("compiler/emit_js.phi", 208), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "function _%%(" }), _ident261, _sym_id265)))); +(runtime.info("compiler/emit_js.phi", 210), _enter_scope198()); const r_185 = ({ type: "bool", value: true }); let _first266 = r_185; for (const r_186 of _params262.values) {; @@ -888,40 +899,40 @@ const r_188 = r_186.values[1] ?? { type: "null"}; const r_189 = r_186.values[2] ?? { type: "null"}; let _ident267 = r_189; if (runtime.truthy(runtime.opNot(_first266))) { -(runtime.info("compiler/emit_js.phi", 212), _emit193(({ type: "string", value: ", " }))); +(runtime.info("compiler/emit_js.phi", 215), _emit193(({ type: "string", value: ", " }))); }; (_first266 = ({ type: "bool", value: false })); -const r_190 = (runtime.info("compiler/emit_js.phi", 216), _define_param196(_ident267, _line239)); +const r_190 = (runtime.info("compiler/emit_js.phi", 219), _define_param196(_ident267, _line239)); let _sym_id268 = r_190; -(runtime.info("compiler/emit_js.phi", 217), _emit193((runtime.info("compiler/emit_js.phi", 217), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "_%%" }), _ident267, _sym_id268)))); +(runtime.info("compiler/emit_js.phi", 220), _emit193((runtime.info("compiler/emit_js.phi", 220), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "_%%" }), _ident267, _sym_id268)))); }; -(runtime.info("compiler/emit_js.phi", 221), _emit193(({ type: "string", value: ") {\n" }))); -(runtime.info("compiler/emit_js.phi", 222), _emit193((runtime.info("compiler/emit_js.phi", 222), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "runtime.pushCall(\"%\", \"%\");\n" }), _ident261, _filename205)))); -(runtime.info("compiler/emit_js.phi", 224), _emit_expr186(_body263)); -(runtime.info("compiler/emit_js.phi", 225), _emit193(({ type: "string", value: ";\nruntime.popCall();\nreturn { type: \"null\" };\n}" }))); -(runtime.info("compiler/emit_js.phi", 227), _leave_scope199()); +(runtime.info("compiler/emit_js.phi", 224), _emit193(({ type: "string", value: ") {\n" }))); +(runtime.info("compiler/emit_js.phi", 225), _emit193((runtime.info("compiler/emit_js.phi", 225), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "runtime.pushCall(\"%\", \"%\");\n" }), _ident261, _filename205)))); +(runtime.info("compiler/emit_js.phi", 227), _emit_expr186(_body263)); +(runtime.info("compiler/emit_js.phi", 228), _emit193(({ type: "string", value: ";\nruntime.popCall();\nreturn { type: \"null\" };\n}" }))); +(runtime.info("compiler/emit_js.phi", 230), _leave_scope199()); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 228), runtime.opEq(_id242, ({ type: "string", value: "let" }))))) { +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 231), runtime.opEq(_id242, ({ type: "string", value: "let" }))))) { const r_191 = _s240; const r_192 = r_191.values[0] ?? { type: "null"}; const r_193 = r_191.values[1] ?? { type: "null"}; let _pat269 = r_193; const r_194 = r_191.values[2] ?? { type: "null"}; let _expr270 = r_194; -const r_195 = (runtime.info("compiler/emit_js.phi", 230), _let_node_reg_count209()); +const r_195 = (runtime.info("compiler/emit_js.phi", 233), _let_node_reg_count209()); let _reg271 = r_195; -(runtime.info("compiler/emit_js.phi", 231), _let_node_reg_increment210()); -(runtime.info("compiler/emit_js.phi", 232), _emit193((runtime.info("compiler/emit_js.phi", 232), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "const r_% = " }), _reg271)))); -(runtime.info("compiler/emit_js.phi", 233), _emit_expr186(_expr270)); -(runtime.info("compiler/emit_js.phi", 234), _emit_let_node189(_pat269, _reg271)); +(runtime.info("compiler/emit_js.phi", 234), _let_node_reg_increment210()); +(runtime.info("compiler/emit_js.phi", 235), _emit193((runtime.info("compiler/emit_js.phi", 235), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "const r_% = " }), _reg271)))); +(runtime.info("compiler/emit_js.phi", 236), _emit_expr186(_expr270)); +(runtime.info("compiler/emit_js.phi", 237), _emit_let_node189(_pat269, _reg271)); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 235), runtime.opEq(_id242, ({ type: "string", value: "do" }))))) { -(runtime.info("compiler/emit_js.phi", 236), _enter_scope198()); -(runtime.info("compiler/emit_js.phi", 237), _discover_syms185((runtime.info("compiler/emit_js.phi", 237), _slice29(_s240, ({ type: "int", value: 1 }))))); -(runtime.info("compiler/emit_js.phi", 238), _emit_exprs184((runtime.info("compiler/emit_js.phi", 238), _slice29(_s240, ({ type: "int", value: 1 }))))); -(runtime.info("compiler/emit_js.phi", 239), _leave_scope199()); +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 238), runtime.opEq(_id242, ({ type: "string", value: "do" }))))) { +(runtime.info("compiler/emit_js.phi", 239), _enter_scope198()); +(runtime.info("compiler/emit_js.phi", 240), _discover_syms185((runtime.info("compiler/emit_js.phi", 240), _slice29(_s240, ({ type: "int", value: 1 }))))); +(runtime.info("compiler/emit_js.phi", 241), _emit_exprs184((runtime.info("compiler/emit_js.phi", 241), _slice29(_s240, ({ type: "int", value: 1 }))))); +(runtime.info("compiler/emit_js.phi", 242), _leave_scope199()); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 240), runtime.opEq(_id242, ({ type: "string", value: "for" }))))) { +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 243), runtime.opEq(_id242, ({ type: "string", value: "for" }))))) { const r_196 = _s240; const r_197 = r_196.values[0] ?? { type: "null"}; const r_198 = r_196.values[1] ?? { type: "null"}; @@ -930,31 +941,31 @@ const r_199 = r_196.values[2] ?? { type: "null"}; let _expr273 = r_199; const r_200 = r_196.values[3] ?? { type: "null"}; let _body274 = r_200; -const r_201 = (runtime.info("compiler/emit_js.phi", 243), _let_node_reg_count209()); +const r_201 = (runtime.info("compiler/emit_js.phi", 246), _let_node_reg_count209()); let _reg275 = r_201; -(runtime.info("compiler/emit_js.phi", 244), _let_node_reg_increment210()); -(runtime.info("compiler/emit_js.phi", 245), _emit193((runtime.info("compiler/emit_js.phi", 245), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "for (const r_% of " }), _reg275)))); -(runtime.info("compiler/emit_js.phi", 246), _emit_expr186(_expr273)); -(runtime.info("compiler/emit_js.phi", 247), _emit193(({ type: "string", value: ".values) {" }))); -(runtime.info("compiler/emit_js.phi", 249), _enter_scope198()); -(runtime.info("compiler/emit_js.phi", 250), _emit_let_node189(_pat272, _reg275)); -(runtime.info("compiler/emit_js.phi", 251), _enter_scope198()); -(runtime.info("compiler/emit_js.phi", 253), _emit193(({ type: "string", value: ";\n" }))); -(runtime.info("compiler/emit_js.phi", 254), _emit_expr186(_body274)); -(runtime.info("compiler/emit_js.phi", 255), _emit193(({ type: "string", value: "}" }))); -(runtime.info("compiler/emit_js.phi", 257), _leave_scope199()); -(runtime.info("compiler/emit_js.phi", 258), _leave_scope199()); +(runtime.info("compiler/emit_js.phi", 247), _let_node_reg_increment210()); +(runtime.info("compiler/emit_js.phi", 248), _emit193((runtime.info("compiler/emit_js.phi", 248), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "for (const r_% of " }), _reg275)))); +(runtime.info("compiler/emit_js.phi", 249), _emit_expr186(_expr273)); +(runtime.info("compiler/emit_js.phi", 250), _emit193(({ type: "string", value: ".values) {" }))); +(runtime.info("compiler/emit_js.phi", 252), _enter_scope198()); +(runtime.info("compiler/emit_js.phi", 253), _emit_let_node189(_pat272, _reg275)); +(runtime.info("compiler/emit_js.phi", 254), _enter_scope198()); +(runtime.info("compiler/emit_js.phi", 256), _emit193(({ type: "string", value: ";\n" }))); +(runtime.info("compiler/emit_js.phi", 257), _emit_expr186(_body274)); +(runtime.info("compiler/emit_js.phi", 258), _emit193(({ type: "string", value: "}" }))); +(runtime.info("compiler/emit_js.phi", 260), _leave_scope199()); +(runtime.info("compiler/emit_js.phi", 261), _leave_scope199()); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 259), runtime.opEq(_id242, ({ type: "string", value: "loop" }))))) { +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 262), runtime.opEq(_id242, ({ type: "string", value: "loop" }))))) { const r_202 = _s240; const r_203 = r_202.values[0] ?? { type: "null"}; const r_204 = r_202.values[1] ?? { type: "null"}; let _body276 = r_204; -(runtime.info("compiler/emit_js.phi", 261), _emit193(({ type: "string", value: "while (true) {\n" }))); -(runtime.info("compiler/emit_js.phi", 262), _emit_expr186(_body276)); -(runtime.info("compiler/emit_js.phi", 263), _emit193(({ type: "string", value: "}" }))); +(runtime.info("compiler/emit_js.phi", 264), _emit193(({ type: "string", value: "while (true) {\n" }))); +(runtime.info("compiler/emit_js.phi", 265), _emit_expr186(_body276)); +(runtime.info("compiler/emit_js.phi", 266), _emit193(({ type: "string", value: "}" }))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 264), runtime.opEq(_id242, ({ type: "string", value: "if" }))))) { +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 267), runtime.opEq(_id242, ({ type: "string", value: "if" }))))) { const r_205 = _s240; const r_206 = r_205.values[0] ?? { type: "null"}; const r_207 = r_205.values[1] ?? { type: "null"}; @@ -963,154 +974,154 @@ const r_208 = r_205.values[2] ?? { type: "null"}; let _truthy278 = r_208; const r_209 = r_205.values[3] ?? { type: "null"}; let _falsy279 = r_209; -(runtime.info("compiler/emit_js.phi", 266), _emit193(({ type: "string", value: "if (runtime.truthy(" }))); -(runtime.info("compiler/emit_js.phi", 267), _emit_expr186(_cond277)); -(runtime.info("compiler/emit_js.phi", 268), _emit193(({ type: "string", value: ")) {\n" }))); -(runtime.info("compiler/emit_js.phi", 269), _emit_expr186(_truthy278)); -(runtime.info("compiler/emit_js.phi", 270), _emit193(({ type: "string", value: "}" }))); -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 271), runtime.opNe(_falsy279, ({ type: "null" }))))) { -(runtime.info("compiler/emit_js.phi", 272), _emit193(({ type: "string", value: " else {\n" }))); -(runtime.info("compiler/emit_js.phi", 273), _emit_expr186(_falsy279)); -(runtime.info("compiler/emit_js.phi", 274), _emit193(({ type: "string", value: "}" }))); +(runtime.info("compiler/emit_js.phi", 269), _emit193(({ type: "string", value: "if (runtime.truthy(" }))); +(runtime.info("compiler/emit_js.phi", 270), _emit_expr186(_cond277)); +(runtime.info("compiler/emit_js.phi", 271), _emit193(({ type: "string", value: ")) {\n" }))); +(runtime.info("compiler/emit_js.phi", 272), _emit_expr186(_truthy278)); +(runtime.info("compiler/emit_js.phi", 273), _emit193(({ type: "string", value: "}" }))); +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 274), runtime.opNe(_falsy279, ({ type: "null" }))))) { +(runtime.info("compiler/emit_js.phi", 275), _emit193(({ type: "string", value: " else {\n" }))); +(runtime.info("compiler/emit_js.phi", 276), _emit_expr186(_falsy279)); +(runtime.info("compiler/emit_js.phi", 277), _emit193(({ type: "string", value: "}" }))); }; } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 276), runtime.opEq(_id242, ({ type: "string", value: "return" }))))) { +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 279), runtime.opEq(_id242, ({ type: "string", value: "return" }))))) { const r_210 = _s240; const r_211 = r_210.values[0] ?? { type: "null"}; const r_212 = r_210.values[1] ?? { type: "null"}; let _value280 = r_212; -(runtime.info("compiler/emit_js.phi", 278), _emit193(({ type: "string", value: "runtime.popCall();\n" }))); -(runtime.info("compiler/emit_js.phi", 279), _emit193(({ type: "string", value: "return " }))); -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 280), runtime.opNe(_value280, ({ type: "null" }))))) { -(runtime.info("compiler/emit_js.phi", 281), _emit_expr186(_value280)); +(runtime.info("compiler/emit_js.phi", 281), _emit193(({ type: "string", value: "runtime.popCall();\n" }))); +(runtime.info("compiler/emit_js.phi", 282), _emit193(({ type: "string", value: "return " }))); +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 283), runtime.opNe(_value280, ({ type: "null" }))))) { +(runtime.info("compiler/emit_js.phi", 284), _emit_expr186(_value280)); } else { -(runtime.info("compiler/emit_js.phi", 283), _emit193(({ type: "string", value: "{ type: \"null\" }" }))); +(runtime.info("compiler/emit_js.phi", 286), _emit193(({ type: "string", value: "{ type: \"null\" }" }))); }; } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 285), runtime.opEq(_id242, ({ type: "string", value: "break" }))))) { +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 288), runtime.opEq(_id242, ({ type: "string", value: "break" }))))) { const r_213 = _s240; const r_214 = r_213.values[0] ?? { type: "null"}; const r_215 = r_213.values[1] ?? { type: "null"}; let _value281 = r_215; -(runtime.info("compiler/emit_js.phi", 287), _emit193(({ type: "string", value: "break" }))); -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 288), runtime.opNe(_value281, ({ type: "null" }))))) { -(runtime.info("compiler/emit_js.phi", 289), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "not implemented" }))); +(runtime.info("compiler/emit_js.phi", 290), _emit193(({ type: "string", value: "break" }))); +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 291), runtime.opNe(_value281, ({ type: "null" }))))) { +(runtime.info("compiler/emit_js.phi", 292), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "not implemented" }))); }; } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 291), runtime.opEq(_id242, ({ type: "string", value: "call" }))))) { +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 294), runtime.opEq(_id242, ({ type: "string", value: "call" }))))) { const r_216 = _s240; const r_217 = r_216.values[0] ?? { type: "null"}; const r_218 = r_216.values[1] ?? { type: "null"}; let _callee282 = r_218; -const r_219 = (runtime.info("compiler/emit_js.phi", 293), _slice29(_s240, ({ type: "int", value: 2 }))); +const r_219 = (runtime.info("compiler/emit_js.phi", 296), _slice29(_s240, ({ type: "int", value: 2 }))); let _args283 = r_219; -(runtime.info("compiler/emit_js.phi", 294), _emit193((runtime.info("compiler/emit_js.phi", 294), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "(%, " }), (runtime.info("compiler/emit_js.phi", 294), _rt_info191(_line239)))))); -(runtime.info("compiler/emit_js.phi", 295), _emit_expr186(_callee282)); -(runtime.info("compiler/emit_js.phi", 296), _emit193(({ type: "string", value: "(" }))); +(runtime.info("compiler/emit_js.phi", 297), _emit193((runtime.info("compiler/emit_js.phi", 297), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "(%, " }), (runtime.info("compiler/emit_js.phi", 297), _rt_info191(_line239)))))); +(runtime.info("compiler/emit_js.phi", 298), _emit_expr186(_callee282)); +(runtime.info("compiler/emit_js.phi", 299), _emit193(({ type: "string", value: "(" }))); const r_220 = ({ type: "bool", value: true }); let _first284 = r_220; for (const r_221 of _args283.values) {; let _arg285 = r_221; if (runtime.truthy(runtime.opNot(_first284))) { -(runtime.info("compiler/emit_js.phi", 301), _emit193(({ type: "string", value: ", " }))); +(runtime.info("compiler/emit_js.phi", 304), _emit193(({ type: "string", value: ", " }))); }; (_first284 = ({ type: "bool", value: false })); -(runtime.info("compiler/emit_js.phi", 305), _emit_expr186(_arg285)); +(runtime.info("compiler/emit_js.phi", 308), _emit_expr186(_arg285)); }; -(runtime.info("compiler/emit_js.phi", 308), _emit193(({ type: "string", value: "))" }))); +(runtime.info("compiler/emit_js.phi", 311), _emit193(({ type: "string", value: "))" }))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 309), runtime.opEq(_id242, ({ type: "string", value: "list" }))))) { -(runtime.info("compiler/emit_js.phi", 310), _emit_list_literal188((runtime.info("compiler/emit_js.phi", 310), _slice29(_s240, ({ type: "int", value: 1 }))))); +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 312), runtime.opEq(_id242, ({ type: "string", value: "list" }))))) { +(runtime.info("compiler/emit_js.phi", 313), _emit_list_literal188((runtime.info("compiler/emit_js.phi", 313), _slice29(_s240, ({ type: "int", value: 1 }))))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 311), runtime.opEq(_id242, ({ type: "string", value: "=" }))))) { -(runtime.info("compiler/emit_js.phi", 312), _emit_assign_expr192(_s240, _line239, ({ type: "string", value: "=" }))); +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 314), runtime.opEq(_id242, ({ type: "string", value: "=" }))))) { +(runtime.info("compiler/emit_js.phi", 315), _emit_assign_expr192(_s240, _line239, ({ type: "string", value: "=" }))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 313), runtime.opEq(_id242, ({ type: "string", value: "+=" }))))) { -(runtime.info("compiler/emit_js.phi", 314), _emit_assign_expr192(_s240, _line239, ({ type: "string", value: "+" }))); +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 316), runtime.opEq(_id242, ({ type: "string", value: "+=" }))))) { +(runtime.info("compiler/emit_js.phi", 317), _emit_assign_expr192(_s240, _line239, ({ type: "string", value: "+" }))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 315), runtime.opEq(_id242, ({ type: "string", value: "-=" }))))) { -(runtime.info("compiler/emit_js.phi", 316), _emit_assign_expr192(_s240, _line239, ({ type: "string", value: "-" }))); +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 318), runtime.opEq(_id242, ({ type: "string", value: "-=" }))))) { +(runtime.info("compiler/emit_js.phi", 319), _emit_assign_expr192(_s240, _line239, ({ type: "string", value: "-" }))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 317), runtime.opEq(_id242, ({ type: "string", value: "or" }))))) { +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 320), runtime.opEq(_id242, ({ type: "string", value: "or" }))))) { const r_222 = _s240; const r_223 = r_222.values[0] ?? { type: "null"}; const r_224 = r_222.values[1] ?? { type: "null"}; let _left286 = r_224; const r_225 = r_222.values[2] ?? { type: "null"}; let _right287 = r_225; -(runtime.info("compiler/emit_js.phi", 319), _emit193((runtime.info("compiler/emit_js.phi", 319), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "(%" }), (runtime.info("compiler/emit_js.phi", 319), _rt_info191(_line239)), _line239)))); -(runtime.info("compiler/emit_js.phi", 320), _emit193(({ type: "string", value: ", { type: \"bool\", value: runtime.truthy(" }))); -(runtime.info("compiler/emit_js.phi", 321), _emit_expr186(_left286)); -(runtime.info("compiler/emit_js.phi", 322), _emit193(({ type: "string", value: ") || runtime.truthy(" }))); -(runtime.info("compiler/emit_js.phi", 323), _emit_expr186(_right287)); -(runtime.info("compiler/emit_js.phi", 324), _emit193(({ type: "string", value: ") })" }))); +(runtime.info("compiler/emit_js.phi", 322), _emit193((runtime.info("compiler/emit_js.phi", 322), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "(%" }), (runtime.info("compiler/emit_js.phi", 322), _rt_info191(_line239)), _line239)))); +(runtime.info("compiler/emit_js.phi", 323), _emit193(({ type: "string", value: ", { type: \"bool\", value: runtime.truthy(" }))); +(runtime.info("compiler/emit_js.phi", 324), _emit_expr186(_left286)); +(runtime.info("compiler/emit_js.phi", 325), _emit193(({ type: "string", value: ") || runtime.truthy(" }))); +(runtime.info("compiler/emit_js.phi", 326), _emit_expr186(_right287)); +(runtime.info("compiler/emit_js.phi", 327), _emit193(({ type: "string", value: ") })" }))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 325), runtime.opEq(_id242, ({ type: "string", value: "and" }))))) { +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 328), runtime.opEq(_id242, ({ type: "string", value: "and" }))))) { const r_226 = _s240; const r_227 = r_226.values[0] ?? { type: "null"}; const r_228 = r_226.values[1] ?? { type: "null"}; let _left288 = r_228; const r_229 = r_226.values[2] ?? { type: "null"}; let _right289 = r_229; -(runtime.info("compiler/emit_js.phi", 327), _emit193((runtime.info("compiler/emit_js.phi", 327), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "(%" }), (runtime.info("compiler/emit_js.phi", 327), _rt_info191(_line239)), _line239)))); -(runtime.info("compiler/emit_js.phi", 328), _emit193(({ type: "string", value: ", { type: \"bool\", value: runtime.truthy(" }))); -(runtime.info("compiler/emit_js.phi", 329), _emit_expr186(_left288)); -(runtime.info("compiler/emit_js.phi", 330), _emit193(({ type: "string", value: ") && runtime.truthy(" }))); -(runtime.info("compiler/emit_js.phi", 331), _emit_expr186(_right289)); -(runtime.info("compiler/emit_js.phi", 332), _emit193(({ type: "string", value: ") })" }))); +(runtime.info("compiler/emit_js.phi", 330), _emit193((runtime.info("compiler/emit_js.phi", 330), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "(%" }), (runtime.info("compiler/emit_js.phi", 330), _rt_info191(_line239)), _line239)))); +(runtime.info("compiler/emit_js.phi", 331), _emit193(({ type: "string", value: ", { type: \"bool\", value: runtime.truthy(" }))); +(runtime.info("compiler/emit_js.phi", 332), _emit_expr186(_left288)); +(runtime.info("compiler/emit_js.phi", 333), _emit193(({ type: "string", value: ") && runtime.truthy(" }))); +(runtime.info("compiler/emit_js.phi", 334), _emit_expr186(_right289)); +(runtime.info("compiler/emit_js.phi", 335), _emit193(({ type: "string", value: ") })" }))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 333), runtime.opEq(_id242, ({ type: "string", value: "==" }))))) { -(runtime.info("compiler/emit_js.phi", 334), _emit_binary_op190(_s240, ({ type: "string", value: "opEq" }))); +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 336), runtime.opEq(_id242, ({ type: "string", value: "==" }))))) { +(runtime.info("compiler/emit_js.phi", 337), _emit_binary_op190(_s240, ({ type: "string", value: "opEq" }))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 335), runtime.opEq(_id242, ({ type: "string", value: "!=" }))))) { -(runtime.info("compiler/emit_js.phi", 336), _emit_binary_op190(_s240, ({ type: "string", value: "opNe" }))); +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 338), runtime.opEq(_id242, ({ type: "string", value: "!=" }))))) { +(runtime.info("compiler/emit_js.phi", 339), _emit_binary_op190(_s240, ({ type: "string", value: "opNe" }))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 337), runtime.opEq(_id242, ({ type: "string", value: "<" }))))) { -(runtime.info("compiler/emit_js.phi", 338), _emit_binary_op190(_s240, ({ type: "string", value: "opLt" }))); +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 340), runtime.opEq(_id242, ({ type: "string", value: "<" }))))) { +(runtime.info("compiler/emit_js.phi", 341), _emit_binary_op190(_s240, ({ type: "string", value: "opLt" }))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 339), runtime.opEq(_id242, ({ type: "string", value: ">" }))))) { -(runtime.info("compiler/emit_js.phi", 340), _emit_binary_op190(_s240, ({ type: "string", value: "opGt" }))); +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 342), runtime.opEq(_id242, ({ type: "string", value: ">" }))))) { +(runtime.info("compiler/emit_js.phi", 343), _emit_binary_op190(_s240, ({ type: "string", value: "opGt" }))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 341), runtime.opEq(_id242, ({ type: "string", value: "<=" }))))) { -(runtime.info("compiler/emit_js.phi", 342), _emit_binary_op190(_s240, ({ type: "string", value: "opLte" }))); +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 344), runtime.opEq(_id242, ({ type: "string", value: "<=" }))))) { +(runtime.info("compiler/emit_js.phi", 345), _emit_binary_op190(_s240, ({ type: "string", value: "opLte" }))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 343), runtime.opEq(_id242, ({ type: "string", value: ">=" }))))) { -(runtime.info("compiler/emit_js.phi", 344), _emit_binary_op190(_s240, ({ type: "string", value: "opGte" }))); +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 346), runtime.opEq(_id242, ({ type: "string", value: ">=" }))))) { +(runtime.info("compiler/emit_js.phi", 347), _emit_binary_op190(_s240, ({ type: "string", value: "opGte" }))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 345), runtime.opEq(_id242, ({ type: "string", value: "+" }))))) { -(runtime.info("compiler/emit_js.phi", 346), _emit_binary_op190(_s240, ({ type: "string", value: "opAdd" }))); +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 348), runtime.opEq(_id242, ({ type: "string", value: "+" }))))) { +(runtime.info("compiler/emit_js.phi", 349), _emit_binary_op190(_s240, ({ type: "string", value: "opAdd" }))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 347), runtime.opEq(_id242, ({ type: "string", value: "-" }))))) { -(runtime.info("compiler/emit_js.phi", 348), _emit_binary_op190(_s240, ({ type: "string", value: "opSub" }))); +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 350), runtime.opEq(_id242, ({ type: "string", value: "-" }))))) { +(runtime.info("compiler/emit_js.phi", 351), _emit_binary_op190(_s240, ({ type: "string", value: "opSub" }))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 349), runtime.opEq(_id242, ({ type: "string", value: "not" }))))) { +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 352), runtime.opEq(_id242, ({ type: "string", value: "not" }))))) { const r_230 = _s240; const r_231 = r_230.values[0] ?? { type: "null"}; const r_232 = r_230.values[1] ?? { type: "null"}; let _expr290 = r_232; -(runtime.info("compiler/emit_js.phi", 351), _emit193(({ type: "string", value: "runtime.opNot(" }))); -(runtime.info("compiler/emit_js.phi", 352), _emit_expr186(_expr290)); -(runtime.info("compiler/emit_js.phi", 353), _emit193(({ type: "string", value: ")" }))); +(runtime.info("compiler/emit_js.phi", 354), _emit193(({ type: "string", value: "runtime.opNot(" }))); +(runtime.info("compiler/emit_js.phi", 355), _emit_expr186(_expr290)); +(runtime.info("compiler/emit_js.phi", 356), _emit193(({ type: "string", value: ")" }))); } else { const r_233 = _s240; const r_234 = r_233.values[0] ?? { type: "null"}; let _callee291 = r_234; -const r_235 = (runtime.info("compiler/emit_js.phi", 356), _slice29(_s240, ({ type: "int", value: 1 }))); +const r_235 = (runtime.info("compiler/emit_js.phi", 359), _slice29(_s240, ({ type: "int", value: 1 }))); let _args292 = r_235; -(runtime.info("compiler/emit_js.phi", 357), _emit193((runtime.info("compiler/emit_js.phi", 357), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "(%, " }), (runtime.info("compiler/emit_js.phi", 357), _rt_info191(_line239)), _line239)))); -(runtime.info("compiler/emit_js.phi", 358), _emit_expr186(_callee291)); -(runtime.info("compiler/emit_js.phi", 359), _emit193(({ type: "string", value: "(" }))); +(runtime.info("compiler/emit_js.phi", 360), _emit193((runtime.info("compiler/emit_js.phi", 360), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "(%, " }), (runtime.info("compiler/emit_js.phi", 360), _rt_info191(_line239)), _line239)))); +(runtime.info("compiler/emit_js.phi", 361), _emit_expr186(_callee291)); +(runtime.info("compiler/emit_js.phi", 362), _emit193(({ type: "string", value: "(" }))); const r_236 = ({ type: "bool", value: true }); let _first293 = r_236; for (const r_237 of _args292.values) {; let _arg294 = r_237; if (runtime.truthy(runtime.opNot(_first293))) { -(runtime.info("compiler/emit_js.phi", 364), _emit193(({ type: "string", value: ", " }))); +(runtime.info("compiler/emit_js.phi", 367), _emit193(({ type: "string", value: ", " }))); }; (_first293 = ({ type: "bool", value: false })); -(runtime.info("compiler/emit_js.phi", 368), _emit_expr186(_arg294)); +(runtime.info("compiler/emit_js.phi", 371), _emit_expr186(_arg294)); }; -(runtime.info("compiler/emit_js.phi", 371), _emit193(({ type: "string", value: "))" }))); +(runtime.info("compiler/emit_js.phi", 374), _emit193(({ type: "string", value: "))" }))); }}}}}}}}}}}}}}}}}}}}}}}}}; ; runtime.popCall(); @@ -1118,18 +1129,18 @@ return { type: "null" }; }; function _emit_list_literal188(_s295) { runtime.pushCall("emit_list_literal", "compiler/emit_js.phi"); -(runtime.info("compiler/emit_js.phi", 376), _emit193(({ type: "string", value: "({ type: \"list\", values: [" }))); +(runtime.info("compiler/emit_js.phi", 379), _emit193(({ type: "string", value: "({ type: \"list\", values: [" }))); const r_238 = ({ type: "bool", value: true }); let _first296 = r_238; for (const r_239 of _s295.values) {; let _e297 = r_239; if (runtime.truthy(runtime.opNot(_first296))) { -(runtime.info("compiler/emit_js.phi", 380), _emit193(({ type: "string", value: ", " }))); +(runtime.info("compiler/emit_js.phi", 383), _emit193(({ type: "string", value: ", " }))); }; (_first296 = ({ type: "bool", value: false })); -(runtime.info("compiler/emit_js.phi", 384), _emit_expr186(_e297)); +(runtime.info("compiler/emit_js.phi", 387), _emit_expr186(_e297)); }; -(runtime.info("compiler/emit_js.phi", 386), _emit193(({ type: "string", value: "] })" }))); +(runtime.info("compiler/emit_js.phi", 389), _emit193(({ type: "string", value: "] })" }))); ; runtime.popCall(); return { type: "null" }; @@ -1141,20 +1152,20 @@ const r_241 = r_240.values[0] ?? { type: "null"}; let _pat_ty300 = r_241; const r_242 = r_240.values[1] ?? { type: "null"}; let _line301 = r_242; -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 391), runtime.opEq(_pat_ty300, ({ type: "string", value: "ident" }))))) { +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 394), runtime.opEq(_pat_ty300, ({ type: "string", value: "ident" }))))) { const r_243 = _pat298; const r_244 = r_243.values[0] ?? { type: "null"}; const r_245 = r_243.values[1] ?? { type: "null"}; const r_246 = r_243.values[2] ?? { type: "null"}; let _ident302 = r_246; -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 394), runtime.opEq(_ident302, ({ type: "string", value: "_" }))))) { +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 397), runtime.opEq(_ident302, ({ type: "string", value: "_" }))))) { runtime.popCall(); return { type: "null" }}; -const r_247 = (runtime.info("compiler/emit_js.phi", 396), _define_let197(_ident302, _line301)); +const r_247 = (runtime.info("compiler/emit_js.phi", 399), _define_let197(_ident302, _line301)); let _sym_id303 = r_247; -(runtime.info("compiler/emit_js.phi", 397), _emit193((runtime.info("compiler/emit_js.phi", 397), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: ";\nlet _%% = r_%" }), _ident302, _sym_id303, _base_reg299)))); +(runtime.info("compiler/emit_js.phi", 400), _emit193((runtime.info("compiler/emit_js.phi", 400), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: ";\nlet _%% = r_%" }), _ident302, _sym_id303, _base_reg299)))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 398), runtime.opEq(_pat_ty300, ({ type: "string", value: "list" }))))) { +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 401), runtime.opEq(_pat_ty300, ({ type: "string", value: "list" }))))) { const r_248 = _pat298; const r_249 = r_248.values[0] ?? { type: "null"}; const r_250 = r_248.values[1] ?? { type: "null"}; @@ -1164,15 +1175,15 @@ const r_252 = ({ type: "int", value: 0 }); let _i305 = r_252; for (const r_253 of _pats304.values) {; let _pat306 = r_253; -const r_254 = (runtime.info("compiler/emit_js.phi", 403), _let_node_reg_count209()); +const r_254 = (runtime.info("compiler/emit_js.phi", 406), _let_node_reg_count209()); let _reg307 = r_254; -(runtime.info("compiler/emit_js.phi", 404), _let_node_reg_increment210()); -(runtime.info("compiler/emit_js.phi", 405), _emit193((runtime.info("compiler/emit_js.phi", 405), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: ";\nconst r_% = r_%.values[%] ?? { type: \"null\"}" }), _reg307, _base_reg299, _i305)))); -(runtime.info("compiler/emit_js.phi", 409), _emit_let_node189(_pat306, _reg307)); +(runtime.info("compiler/emit_js.phi", 407), _let_node_reg_increment210()); +(runtime.info("compiler/emit_js.phi", 408), _emit193((runtime.info("compiler/emit_js.phi", 408), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: ";\nconst r_% = r_%.values[%] ?? { type: \"null\"}" }), _reg307, _base_reg299, _i305)))); +(runtime.info("compiler/emit_js.phi", 412), _emit_let_node189(_pat306, _reg307)); (_i305 = runtime.opAdd(_i305, ({ type: "int", value: 1 }))); }; } else { -(runtime.info("compiler/emit_js.phi", 413), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "malformed pattern on line %" }), _line301)); +(runtime.info("compiler/emit_js.phi", 416), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "malformed pattern on line %" }), _line301)); }}; ; runtime.popCall(); @@ -1190,11 +1201,11 @@ const r_260 = r_255.values[1] ?? { type: "null"}; let _left311 = r_260; const r_261 = r_255.values[2] ?? { type: "null"}; let _right312 = r_261; -(runtime.info("compiler/emit_js.phi", 419), _emit193((runtime.info("compiler/emit_js.phi", 419), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "(%, runtime.%(" }), (runtime.info("compiler/emit_js.phi", 419), _rt_info191(_line310)), _id309)))); -(runtime.info("compiler/emit_js.phi", 420), _emit_expr186(_left311)); -(runtime.info("compiler/emit_js.phi", 421), _emit193(({ type: "string", value: ", " }))); -(runtime.info("compiler/emit_js.phi", 422), _emit_expr186(_right312)); -(runtime.info("compiler/emit_js.phi", 423), _emit193(({ type: "string", value: "))" }))); +(runtime.info("compiler/emit_js.phi", 422), _emit193((runtime.info("compiler/emit_js.phi", 422), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "(%, runtime.%(" }), (runtime.info("compiler/emit_js.phi", 422), _rt_info191(_line310)), _id309)))); +(runtime.info("compiler/emit_js.phi", 423), _emit_expr186(_left311)); +(runtime.info("compiler/emit_js.phi", 424), _emit193(({ type: "string", value: ", " }))); +(runtime.info("compiler/emit_js.phi", 425), _emit_expr186(_right312)); +(runtime.info("compiler/emit_js.phi", 426), _emit193(({ type: "string", value: "))" }))); ; runtime.popCall(); return { type: "null" }; @@ -1202,7 +1213,7 @@ return { type: "null" }; function _rt_info191(_line313) { runtime.pushCall("rt_info", "compiler/emit_js.phi"); runtime.popCall(); -return (runtime.info("compiler/emit_js.phi", 427), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "runtime.info(\"%\", %)" }), _filename205, _line313)); +return (runtime.info("compiler/emit_js.phi", 430), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "runtime.info(\"%\", %)" }), _filename205, _line313)); ; runtime.popCall(); return { type: "null" }; @@ -1216,8 +1227,8 @@ const r_265 = r_264.values[0] ?? { type: "null"}; let _target_type317 = r_265; const r_266 = r_262.values[2] ?? { type: "null"}; let _expr318 = r_266; -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 432), runtime.opNe(_target_type317, ({ type: "string", value: "ident" }))))) { -(runtime.info("compiler/emit_js.phi", 433), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "cannot assign to expression on line %" }), _line315)); +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 435), runtime.opNe(_target_type317, ({ type: "string", value: "ident" }))))) { +(runtime.info("compiler/emit_js.phi", 436), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "cannot assign to expression on line %" }), _line315)); }; const r_267 = _s314; const r_268 = r_267.values[0] ?? { type: "null"}; @@ -1226,10 +1237,10 @@ const r_270 = r_269.values[0] ?? { type: "null"}; const r_271 = r_269.values[1] ?? { type: "null"}; const r_272 = r_269.values[2] ?? { type: "null"}; let _ident319 = r_272; -const r_273 = (runtime.info("compiler/emit_js.phi", 436), _get_sym201(_ident319)); +const r_273 = (runtime.info("compiler/emit_js.phi", 439), _get_sym201(_ident319)); let _sym320 = r_273; -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 437), runtime.opEq(_sym320, ({ type: "null" }))))) { -(runtime.info("compiler/emit_js.phi", 438), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "could not find symbol '%' on line %" }), _ident319, _line315)); +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 440), runtime.opEq(_sym320, ({ type: "null" }))))) { +(runtime.info("compiler/emit_js.phi", 441), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "could not find symbol '%' on line %" }), _ident319, _line315)); }; const r_274 = _sym320; const r_275 = r_274.values[0] ?? { type: "null"}; @@ -1239,26 +1250,26 @@ let _sym_type322 = r_276; const r_277 = r_274.values[2] ?? { type: "null"}; let _sym_ident323 = r_277; const r_278 = r_274.values[3] ?? { type: "null"}; -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 441), runtime.opEq(_sym_type322, ({ type: "string", value: "let" }))))) { -(runtime.info("compiler/emit_js.phi", 442), _emit193((runtime.info("compiler/emit_js.phi", 442), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "(_%% = " }), _sym_ident323, _sym_id321)))); -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 443), runtime.opEq(_id316, ({ type: "string", value: "=" }))))) { -(runtime.info("compiler/emit_js.phi", 444), _emit_expr186(_expr318)); -} else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 445), runtime.opEq(_id316, ({ type: "string", value: "+" }))))) { -(runtime.info("compiler/emit_js.phi", 446), _emit193((runtime.info("compiler/emit_js.phi", 446), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "runtime.opAdd(_%%, " }), _sym_ident323, _sym_id321)))); +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 444), runtime.opEq(_sym_type322, ({ type: "string", value: "let" }))))) { +(runtime.info("compiler/emit_js.phi", 445), _emit193((runtime.info("compiler/emit_js.phi", 445), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "(_%% = " }), _sym_ident323, _sym_id321)))); +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 446), runtime.opEq(_id316, ({ type: "string", value: "=" }))))) { (runtime.info("compiler/emit_js.phi", 447), _emit_expr186(_expr318)); -(runtime.info("compiler/emit_js.phi", 448), _emit193(({ type: "string", value: ")" }))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 449), runtime.opEq(_id316, ({ type: "string", value: "-" }))))) { -(runtime.info("compiler/emit_js.phi", 450), _emit193((runtime.info("compiler/emit_js.phi", 450), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "runtime.opSub(_%%, " }), _sym_ident323, _sym_id321)))); -(runtime.info("compiler/emit_js.phi", 451), _emit_expr186(_expr318)); -(runtime.info("compiler/emit_js.phi", 452), _emit193(({ type: "string", value: ")" }))); +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 448), runtime.opEq(_id316, ({ type: "string", value: "+" }))))) { +(runtime.info("compiler/emit_js.phi", 449), _emit193((runtime.info("compiler/emit_js.phi", 449), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "runtime.opAdd(_%%, " }), _sym_ident323, _sym_id321)))); +(runtime.info("compiler/emit_js.phi", 450), _emit_expr186(_expr318)); +(runtime.info("compiler/emit_js.phi", 451), _emit193(({ type: "string", value: ")" }))); } else { -(runtime.info("compiler/emit_js.phi", 454), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "not implemented" }))); +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 452), runtime.opEq(_id316, ({ type: "string", value: "-" }))))) { +(runtime.info("compiler/emit_js.phi", 453), _emit193((runtime.info("compiler/emit_js.phi", 453), ((...args) => runtime.builtinFormat(...args))(({ type: "string", value: "runtime.opSub(_%%, " }), _sym_ident323, _sym_id321)))); +(runtime.info("compiler/emit_js.phi", 454), _emit_expr186(_expr318)); +(runtime.info("compiler/emit_js.phi", 455), _emit193(({ type: "string", value: ")" }))); +} else { +(runtime.info("compiler/emit_js.phi", 457), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "not implemented" }))); }}}; -(runtime.info("compiler/emit_js.phi", 456), _emit193(({ type: "string", value: ")" }))); +(runtime.info("compiler/emit_js.phi", 459), _emit193(({ type: "string", value: ")" }))); } else { -(runtime.info("compiler/emit_js.phi", 458), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "cannot assign to symbol '%' on line %" }), _sym_ident323, _line315)); +(runtime.info("compiler/emit_js.phi", 461), ((...args) => runtime.builtinPanic(...args))(({ type: "string", value: "cannot assign to symbol '%' on line %" }), _sym_ident323, _line315)); }; ; runtime.popCall(); @@ -1266,17 +1277,17 @@ return { type: "null" }; }; function _emit193(_str324) { runtime.pushCall("emit", "compiler/emit_js.phi"); -(runtime.info("compiler/emit_js.phi", 463), ((...args) => runtime.builtinPush(...args))(_output204, _str324)); +(runtime.info("compiler/emit_js.phi", 466), ((...args) => runtime.builtinPush(...args))(_output204, _str324)); ; runtime.popCall(); return { type: "null" }; }; function _define_builtin194(_ident325, _builtin_id326) { runtime.pushCall("define_builtin", "compiler/emit_js.phi"); -const r_279 = (runtime.info("compiler/emit_js.phi", 467), _sym_id_count207()); +const r_279 = (runtime.info("compiler/emit_js.phi", 470), _sym_id_count207()); let _sym_id327 = r_279; -(runtime.info("compiler/emit_js.phi", 468), _sym_id_increment208()); -(runtime.info("compiler/emit_js.phi", 470), _define_sym200(_ident325, ({ type: "list", values: [_sym_id327, ({ type: "string", value: "builtin" }), _builtin_id326] }))); +(runtime.info("compiler/emit_js.phi", 471), _sym_id_increment208()); +(runtime.info("compiler/emit_js.phi", 473), _define_sym200(_ident325, ({ type: "list", values: [_sym_id327, ({ type: "string", value: "builtin" }), _builtin_id326] }))); runtime.popCall(); return _sym_id327; ; @@ -1285,10 +1296,10 @@ return { type: "null" }; }; function _define_fn195(_ident328, _line329) { runtime.pushCall("define_fn", "compiler/emit_js.phi"); -const r_280 = (runtime.info("compiler/emit_js.phi", 475), _sym_id_count207()); +const r_280 = (runtime.info("compiler/emit_js.phi", 478), _sym_id_count207()); let _sym_id330 = r_280; -(runtime.info("compiler/emit_js.phi", 476), _sym_id_increment208()); -(runtime.info("compiler/emit_js.phi", 478), _define_sym200(_ident328, ({ type: "list", values: [_sym_id330, ({ type: "string", value: "fn" }), _ident328, _line329] }))); +(runtime.info("compiler/emit_js.phi", 479), _sym_id_increment208()); +(runtime.info("compiler/emit_js.phi", 481), _define_sym200(_ident328, ({ type: "list", values: [_sym_id330, ({ type: "string", value: "fn" }), _ident328, _line329] }))); runtime.popCall(); return _sym_id330; ; @@ -1297,10 +1308,10 @@ return { type: "null" }; }; function _define_param196(_ident331, _line332) { runtime.pushCall("define_param", "compiler/emit_js.phi"); -const r_281 = (runtime.info("compiler/emit_js.phi", 483), _sym_id_count207()); +const r_281 = (runtime.info("compiler/emit_js.phi", 486), _sym_id_count207()); let _sym_id333 = r_281; -(runtime.info("compiler/emit_js.phi", 484), _sym_id_increment208()); -(runtime.info("compiler/emit_js.phi", 486), _define_sym200(_ident331, ({ type: "list", values: [_sym_id333, ({ type: "string", value: "param" }), _ident331, _line332] }))); +(runtime.info("compiler/emit_js.phi", 487), _sym_id_increment208()); +(runtime.info("compiler/emit_js.phi", 489), _define_sym200(_ident331, ({ type: "list", values: [_sym_id333, ({ type: "string", value: "param" }), _ident331, _line332] }))); runtime.popCall(); return _sym_id333; ; @@ -1309,10 +1320,10 @@ return { type: "null" }; }; function _define_let197(_ident334, _line335) { runtime.pushCall("define_let", "compiler/emit_js.phi"); -const r_282 = (runtime.info("compiler/emit_js.phi", 491), _sym_id_count207()); +const r_282 = (runtime.info("compiler/emit_js.phi", 494), _sym_id_count207()); let _sym_id336 = r_282; -(runtime.info("compiler/emit_js.phi", 492), _sym_id_increment208()); -(runtime.info("compiler/emit_js.phi", 494), _define_sym200(_ident334, ({ type: "list", values: [_sym_id336, ({ type: "string", value: "let" }), _ident334, _line335] }))); +(runtime.info("compiler/emit_js.phi", 495), _sym_id_increment208()); +(runtime.info("compiler/emit_js.phi", 497), _define_sym200(_ident334, ({ type: "list", values: [_sym_id336, ({ type: "string", value: "let" }), _ident334, _line335] }))); runtime.popCall(); return _sym_id336; ; @@ -1324,7 +1335,7 @@ runtime.pushCall("enter_scope", "compiler/emit_js.phi"); const r_283 = _syms206; const r_284 = r_283.values[0] ?? { type: "null"}; let _enter_scope337 = r_284; -(runtime.info("compiler/emit_js.phi", 501), _enter_scope337()); +(runtime.info("compiler/emit_js.phi", 504), _enter_scope337()); ; runtime.popCall(); return { type: "null" }; @@ -1335,7 +1346,7 @@ const r_285 = _syms206; const r_286 = r_285.values[0] ?? { type: "null"}; const r_287 = r_285.values[1] ?? { type: "null"}; let _leave_scope338 = r_287; -(runtime.info("compiler/emit_js.phi", 505), _leave_scope338()); +(runtime.info("compiler/emit_js.phi", 508), _leave_scope338()); ; runtime.popCall(); return { type: "null" }; @@ -1348,7 +1359,7 @@ const r_290 = r_288.values[1] ?? { type: "null"}; const r_291 = r_288.values[2] ?? { type: "null"}; let _define_sym341 = r_291; runtime.popCall(); -return (runtime.info("compiler/emit_js.phi", 509), _define_sym341(_ident339, _sym340)); +return (runtime.info("compiler/emit_js.phi", 512), _define_sym341(_ident339, _sym340)); ; runtime.popCall(); return { type: "null" }; @@ -1362,7 +1373,7 @@ const r_295 = r_292.values[2] ?? { type: "null"}; const r_296 = r_292.values[3] ?? { type: "null"}; let _get_sym343 = r_296; runtime.popCall(); -return (runtime.info("compiler/emit_js.phi", 513), _get_sym343(_ident342)); +return (runtime.info("compiler/emit_js.phi", 516), _get_sym343(_ident342)); ; runtime.popCall(); return { type: "null" }; @@ -1377,7 +1388,7 @@ const r_301 = r_297.values[3] ?? { type: "null"}; const r_302 = r_297.values[4] ?? { type: "null"}; let _get_current_map344 = r_302; runtime.popCall(); -return (runtime.info("compiler/emit_js.phi", 517), _get_current_map344()); +return (runtime.info("compiler/emit_js.phi", 520), _get_current_map344()); ; runtime.popCall(); return { type: "null" }; @@ -1392,7 +1403,7 @@ const r_307 = r_303.values[3] ?? { type: "null"}; const r_308 = r_303.values[4] ?? { type: "null"}; const r_309 = r_303.values[5] ?? { type: "null"}; let _print_syms345 = r_309; -(runtime.info("compiler/emit_js.phi", 521), _print_syms345()); +(runtime.info("compiler/emit_js.phi", 524), _print_syms345()); ; runtime.popCall(); return { type: "null" }; @@ -1430,33 +1441,33 @@ return { type: "null" }; }; function _string_escape140(_str349) { runtime.pushCall("string_escape", "compiler/emit_js.phi"); -const r_311 = (runtime.info("compiler/emit_js.phi", 542), ((...args) => runtime.builtinLen(...args))(_str349)); +const r_311 = (runtime.info("compiler/emit_js.phi", 545), ((...args) => runtime.builtinLen(...args))(_str349)); let _str_len350 = r_311; const r_312 = ({ type: "int", value: 0 }); let _i351 = r_312; const r_313 = ({ type: "string", value: "" }); let _result352 = r_313; while (true) { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 546), runtime.opGte(_i351, _str_len350)))) { +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 549), runtime.opGte(_i351, _str_len350)))) { break}; -const r_314 = (runtime.info("compiler/emit_js.phi", 547), ((...args) => runtime.builtinAt(...args))(_str349, _i351)); +const r_314 = (runtime.info("compiler/emit_js.phi", 550), ((...args) => runtime.builtinAt(...args))(_str349, _i351)); let _ch353 = r_314; -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 548), runtime.opEq(_ch353, ({ type: "string", value: "\\" }))))) { +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 551), runtime.opEq(_ch353, ({ type: "string", value: "\\" }))))) { (_result352 = runtime.opAdd(_result352, ({ type: "string", value: "\\\\" }))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 550), runtime.opEq(_ch353, ({ type: "string", value: "\"" }))))) { +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 553), runtime.opEq(_ch353, ({ type: "string", value: "\"" }))))) { (_result352 = runtime.opAdd(_result352, ({ type: "string", value: "\\\"" }))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 552), runtime.opEq(_ch353, ({ type: "string", value: "\t" }))))) { +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 555), runtime.opEq(_ch353, ({ type: "string", value: "\t" }))))) { (_result352 = runtime.opAdd(_result352, ({ type: "string", value: "\\t" }))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 554), runtime.opEq(_ch353, ({ type: "string", value: "\r" }))))) { +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 557), runtime.opEq(_ch353, ({ type: "string", value: "\r" }))))) { (_result352 = runtime.opAdd(_result352, ({ type: "string", value: "\\r" }))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 556), runtime.opEq(_ch353, ({ type: "string", value: "\n" }))))) { +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 559), runtime.opEq(_ch353, ({ type: "string", value: "\n" }))))) { (_result352 = runtime.opAdd(_result352, ({ type: "string", value: "\\n" }))); } else { -if (runtime.truthy((runtime.info("compiler/emit_js.phi", 558), runtime.opEq(_ch353, ({ type: "string", value: "\n" }))))) { +if (runtime.truthy((runtime.info("compiler/emit_js.phi", 561), runtime.opEq(_ch353, ({ type: "string", value: "\n" }))))) { (_result352 = runtime.opAdd(_result352, ({ type: "string", value: "\\0" }))); } else { (_result352 = runtime.opAdd(_result352, _ch353)); @@ -1469,8 +1480,9 @@ return _result352; runtime.popCall(); return { type: "null" }; }; + +// === resuming file compile.phi === runtime.setFile("compile.phi"); -; function _print_expr14(_expr354, _depth355) { runtime.pushCall("print_expr", "compile.phi"); const r_315 = _expr354;