From f2163901d8e9525d3f2cfd675a7bd6c8c4b86621 Mon Sep 17 00:00:00 2001
From: SimonFJ20 <simonfromjakobsen@gmail.com>
Date: Fri, 13 Dec 2024 10:33:51 +0100
Subject: [PATCH] add sourcemaps 2

---
 compiler/lowerer.ts | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/compiler/lowerer.ts b/compiler/lowerer.ts
index 62fe2e7..ac7e7af 100644
--- a/compiler/lowerer.ts
+++ b/compiler/lowerer.ts
@@ -50,7 +50,6 @@ export class Lowerer {
     }
 
     private lowerStaticStmt(stmt: Stmt) {
-        this.addSourceMap(stmt.pos);
         switch (stmt.kind.type) {
             case "fn":
                 return this.lowerFnStmt(stmt);
@@ -387,8 +386,8 @@ export class Lowerer {
         this.program.setLabel(falseLabel);
 
         if (expr.kind.falsy) {
-            this.addSourceMap(expr.kind.truthy.pos);
-            this.lowerExpr(expr.kind.falsy!);
+            this.addSourceMap(expr.kind.falsy.pos);
+            this.lowerExpr(expr.kind.falsy);
         } else {
             this.program.add(Ops.PushNull);
         }
@@ -430,6 +429,7 @@ export class Lowerer {
             this.lowerStmt(stmt);
         }
         if (expr.kind.expr) {
+            this.addSourceMap(expr.kind.expr.pos);
             this.lowerExpr(expr.kind.expr);
         } else {
             this.program.add(Ops.PushNull);