Disallow usage of goto and label in Lua 5.1#124
Disallow usage of goto and label in Lua 5.1#124Perryvw merged 5 commits intoTypeScriptToLua:masterfrom
Conversation
|
Will merge if you fix the tests. |
|
Actually, as @lolleko pointed out to me, this would mess up our inheritance tree. You should move the current goto/continue implementation to the 5.2 implementation and then put this 'default' version in the general transpiler.ts. We will add some documentation to the wiki about this. |
|
OK. I will fix the tests. But I don't understand why this would mess up the inheritance tree. The current goto/continue implementation is valid for Lua 5.2/5.3/JIT and should be the 'default' version. Lua 5.1 is the special case for this problem. |
|
@zengjie We aim to implement versions as described here: https://github.com/Perryvw/TypescriptToLua/wiki/Different-Lua-Versions The different versions of transpilers are currently chained so we have as little code duplication as possible. If the current loop version is implemented in 5.2 it will also be used for later versions. |
|
Brilliant Idea! I got it. |
|
@Perryvw I have finished the adjustment. |
Perryvw
left a comment
There was a problem hiding this comment.
Looks good, thanks for contributing! I have added a comment regarding the yarn.lock you comitted. Once that is resolved I will merge.
| import * as ts from "typescript"; | ||
|
|
||
| export class LuaTranspiler51 extends LuaTranspiler { | ||
|
|
yarn.lock
Outdated
| @@ -0,0 +1,2070 @@ | |||
| # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. | |||
There was a problem hiding this comment.
don't commit this please (I would be okay with a commit adding this to .gitignore)
|
Is this available in the |
|
It was included in the 0.6.0 release 11 days ago. |
|
It appears that the |
Lua 5.1 does not support
gotoand label. Usinggotoand label to simulatecontinueis not possible for Lua 5.1 target.