The TypeScript AST should be transformed before emitting the Lua files.
We intent to implement the following pipeline:
TS AST --transformer--> TS AST --printer--> Lua
The transformed AST should only contain nodes that have an Lua equivalent, this will basically make the transformed AST a Lua AST.
This AST should only contain the following nodes:
- ts.FunctionDeclaration
- ts.VariableStatement
- ts.ExpressionStatement
- ts.ReturnStatement
- ts.IfStatement
- ts.WhileStatement
- ts.DoStatement
- ts.ForStatement
- ts.ForOfStatement
- ts.ForInStatement
- tstl.GotoStatement Extension
- tstl.LabelStatement Extension
- ts.BinaryExpression
- ts.ConditionalExpression
- ts.CallExpression
- ts.PropertyAccessExpression
- ts.ElementAccessExpression
- ts.ParenthesizedExpression
- ts.TypeOfExpression
- ts.SpreadElement
- ts.ArrayLiteralExpression
- ts.ObjectLiteralExpression
- ts.Identifier
- ts.StringLiteral
- ts.NumericLiteral
- ts.BooleanLiteral
- ts.KeywordTypeNode
- ts.ComputedPropertyName ???????
- ts.Block
This list is a draft and should change in the future.
Benefits
- Better structure/abstraction
- More control over the transpilation process
- API: Allow users/plugin developers to define custom Transformers in the future
- Source Maps
The TypeScript AST should be transformed before emitting the Lua files.
We intent to implement the following pipeline:
TS AST --transformer--> TS AST --printer--> Lua
The transformed AST should only contain nodes that have an Lua equivalent, this will basically make the transformed AST a Lua AST.
This AST should only contain the following nodes:
This list is a draft and should change in the future.
Benefits