-
-
Notifications
You must be signed in to change notification settings - Fork 180
Allow stacktraces in Lua 5.1 and LuaJIT and fix level in lualib #1610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
* Fix the constructor passed when getting the stacktrace * Fix testEachVersion builder
Perryvw
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution, looks good aside from the issues the linter seems to be having! You can check for linter errors locally with npm run lint.
|
|
||
| if (_VERSION.includes("Lua 5.0")) { | ||
| return debug.traceback(`[Level ${level}]`); | ||
| } else if (_VERSION === "Lua 5.1") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guess we should use .includes here too, to trick whatever type nonsense is going on with the version-specific types
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was going by the declaration which only seems to have 5.1, I guess includes is used to catch all of the 5.0 subversions. I think I just need to include another @ts-ignore here. This one is my bad since I changed this last minute without running another build.
declare const _VERSION:
| ('Lua 5.0' | 'Lua 5.0.1' | 'Lua 5.0.2' | 'Lua 5.0.3')
| 'Lua 5.1'
| 'Lua 5.2'
| 'Lua 5.3'
| 'Lua 5.4';
test/unit/error.spec.ts
Outdated
| ...util.expectEachVersionExceptJit(builder => { | ||
| builder.expectToHaveNoDiagnostics(); | ||
| const luaResult = builder.getLuaExecutionResult(); | ||
| expect(luaResult.split('\n').length).toBe(4); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ugh, linter seems confused about our helper function here. I don't like it but I guess you can add // eslint-disable-next-line jest/no-standalone-expect here
|
Thanks for the comments, I totally forgot to run lint, I was assuming it would run alongside build. Will address these. |
|
Should be good now :) |
Lua 5.1 and LuaJIT have a bug where it's not possible to specify the level without a message. Previously the stacktrace was just ignored in TSTL for these versions; but we can workaround this bug by just specifying an empty message and trimming the newline with string.sub.
Also:
constructor.newdoesn't seem to exist. I suspect that .new used to be a thing but was never updated when this was changed.__TS__Newwould result in the wrong level? Since__TS__Newis not specifically for Error.