Skip to content

Commit

Permalink
fix: addDebugInfo before convertExpression
Browse files Browse the repository at this point in the history
  • Loading branch information
Xinquan XU authored and Xinquan XU committed Apr 3, 2024
1 parent b640ff2 commit 4c172d6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3449,6 +3449,9 @@ export class Compiler extends DiagnosticEmitter {
expr = this.module.unreachable();
}
}
// debug location is added here so the caller doesn't have to. means: compilation of an expression
// must go through this function, with the respective per-kind functions not being used directly.
if (this.options.sourceMap) this.addDebugLocation(expr, expression.range);
// ensure conversion and wrapping in case the respective function doesn't on its own
let currentType = this.currentType;
let wrap = (constraints & Constraints.MustWrap) != 0;
Expand All @@ -3462,9 +3465,6 @@ export class Compiler extends DiagnosticEmitter {
}
}
if (wrap) expr = this.ensureSmallIntegerWrap(expr, currentType);
// debug location is added here so the caller doesn't have to. means: compilation of an expression
// must go through this function, with the respective per-kind functions not being used directly.
if (this.options.sourceMap) this.addDebugLocation(expr, expression.range);
return expr;
}

Expand Down

0 comments on commit 4c172d6

Please sign in to comment.