add sourcemaps 2

This commit is contained in:
SimonFJ20 2024-12-13 10:33:51 +01:00
parent c5ec4a9970
commit f2163901d8

View File

@ -50,7 +50,6 @@ export class Lowerer {
} }
private lowerStaticStmt(stmt: Stmt) { private lowerStaticStmt(stmt: Stmt) {
this.addSourceMap(stmt.pos);
switch (stmt.kind.type) { switch (stmt.kind.type) {
case "fn": case "fn":
return this.lowerFnStmt(stmt); return this.lowerFnStmt(stmt);
@ -387,8 +386,8 @@ export class Lowerer {
this.program.setLabel(falseLabel); this.program.setLabel(falseLabel);
if (expr.kind.falsy) { if (expr.kind.falsy) {
this.addSourceMap(expr.kind.truthy.pos); this.addSourceMap(expr.kind.falsy.pos);
this.lowerExpr(expr.kind.falsy!); this.lowerExpr(expr.kind.falsy);
} else { } else {
this.program.add(Ops.PushNull); this.program.add(Ops.PushNull);
} }
@ -430,6 +429,7 @@ export class Lowerer {
this.lowerStmt(stmt); this.lowerStmt(stmt);
} }
if (expr.kind.expr) { if (expr.kind.expr) {
this.addSourceMap(expr.kind.expr.pos);
this.lowerExpr(expr.kind.expr); this.lowerExpr(expr.kind.expr);
} else { } else {
this.program.add(Ops.PushNull); this.program.add(Ops.PushNull);