Skip to content

Commit f09ee16

Browse files
committed
Preserve stacktraces in Lua assurance calls
1 parent dcf8da5 commit f09ee16

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/LuaNativeLowering.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,8 +382,8 @@ public void visit(ImFunctionCall call) {
382382
normalized = JassIm.ImOperatorCall(WurstOperator.EQ,
383383
JassIm.ImExprs(argument.copy(), JassIm.ImBoolVal(true)));
384384
} else {
385-
normalized = JassIm.ImFunctionCall(call.attrTrace(), ensure,
386-
JassIm.ImTypeArguments(), JassIm.ImExprs(argument.copy()), false, CallType.NORMAL);
385+
normalized = callWithStacktrace(call.attrTrace(), ensure,
386+
JassIm.ImExprs(argument.copy()));
387387
}
388388
argument.replaceBy(normalized);
389389
}

de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/LuaBackendAuditTests.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2559,13 +2559,18 @@ public void stacktracedLuaLoweringPassesHelperStacktraceArguments() {
25592559
"package Test",
25602560
"native print(string message)",
25612561
"native I2S(int value) returns string",
2562+
"native consumeInt(int value)",
2563+
"native consumeString(string value)",
25622564
"int array values",
2565+
"string array names",
25632566
"function readValue(int index) returns int",
25642567
" return values[index]",
25652568
"function join(string left, string right) returns string",
25662569
" return left + right",
25672570
"init",
25682571
" values[1] = 7",
2572+
" consumeInt(values[1])",
2573+
" consumeString(names[1])",
25692574
" print(join(\"value=\", I2S(readValue(1))))"
25702575
);
25712576
}

0 commit comments

Comments
 (0)