11import * as ts from "typescript" ;
2- import { Visitors } from "../context" ;
2+ import * as lua from "../../LuaAST" ;
3+ import { FunctionVisitor , Visitors } from "../context" ;
34import { transformElementAccessExpression , transformPropertyAccessExpression , transformQualifiedName } from "./access" ;
45import { transformBinaryExpression } from "./binary-expression" ;
56import { transformBlock } from "./block" ;
@@ -36,14 +37,18 @@ import { transformReturnStatement } from "./return";
3637import { transformSourceFileNode } from "./sourceFile" ;
3738import { transformSwitchStatement } from "./switch" ;
3839import { transformTaggedTemplateExpression , transformTemplateExpression } from "./template" ;
39- import { todoMoveSomewhereVisitors } from "./todo-move-somewhere" ;
4040import { transformTypeOfExpression } from "./typeof" ;
41+ import { typescriptVisitors } from "./typescript" ;
4142import { transformPostfixUnaryExpression , transformPrefixUnaryExpression } from "./unary-expression" ;
4243import { transformVariableStatement } from "./variable" ;
4344
45+ const transformEmptyStatement : FunctionVisitor < ts . EmptyStatement > = ( ) => undefined ;
46+ const transformParenthesizedExpression : FunctionVisitor < ts . ParenthesizedExpression > = ( node , context ) =>
47+ lua . createParenthesizedExpression ( context . transformExpression ( node . expression ) , node ) ;
48+
4449export const standardVisitors : Visitors = {
4550 ...literalVisitors ,
46- ...todoMoveSomewhereVisitors ,
51+ ...typescriptVisitors ,
4752 [ ts . SyntaxKind . ArrowFunction ] : transformFunctionLikeDeclaration ,
4853 [ ts . SyntaxKind . BinaryExpression ] : transformBinaryExpression ,
4954 [ ts . SyntaxKind . Block ] : transformBlock ,
@@ -56,6 +61,7 @@ export const standardVisitors: Visitors = {
5661 [ ts . SyntaxKind . DeleteExpression ] : transformDeleteExpression ,
5762 [ ts . SyntaxKind . DoStatement ] : transformDoStatement ,
5863 [ ts . SyntaxKind . ElementAccessExpression ] : transformElementAccessExpression ,
64+ [ ts . SyntaxKind . EmptyStatement ] : transformEmptyStatement ,
5965 [ ts . SyntaxKind . EnumDeclaration ] : transformEnumDeclaration ,
6066 [ ts . SyntaxKind . ExportAssignment ] : transformExportAssignment ,
6167 [ ts . SyntaxKind . ExportDeclaration ] : transformExportDeclaration ,
@@ -72,6 +78,7 @@ export const standardVisitors: Visitors = {
7278 [ ts . SyntaxKind . ImportEqualsDeclaration ] : transformImportEqualsDeclaration ,
7379 [ ts . SyntaxKind . ModuleDeclaration ] : transformModuleDeclaration ,
7480 [ ts . SyntaxKind . NewExpression ] : transformNewExpression ,
81+ [ ts . SyntaxKind . ParenthesizedExpression ] : transformParenthesizedExpression ,
7582 [ ts . SyntaxKind . PostfixUnaryExpression ] : transformPostfixUnaryExpression ,
7683 [ ts . SyntaxKind . PrefixUnaryExpression ] : transformPrefixUnaryExpression ,
7784 [ ts . SyntaxKind . PropertyAccessExpression ] : transformPropertyAccessExpression ,
0 commit comments