ts-simple-ast
Version:
TypeScript compiler wrapper for AST navigation and code generation.
89 lines (88 loc) • 5.55 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
/* barrel:ignore */
var ts = require("typescript");
var compiler = require("./../compiler");
// when changing this, make sure to run `npm run code-generate`.
// that will automatically update all other parts of the application that need to be updated when this changes.
// using an "any" type here because I couldn't figure out a way of getting the typescript compiler to understand this
exports.nodeToWrapperMappings = (_a = {},
_a[ts.SyntaxKind.SourceFile] = compiler.SourceFile,
_a[ts.SyntaxKind.ArrayLiteralExpression] = compiler.ArrayLiteralExpression,
_a[ts.SyntaxKind.BinaryExpression] = compiler.BinaryExpression,
_a[ts.SyntaxKind.Block] = compiler.Block,
_a[ts.SyntaxKind.CallExpression] = compiler.CallExpression,
_a[ts.SyntaxKind.ClassDeclaration] = compiler.ClassDeclaration,
_a[ts.SyntaxKind.Constructor] = compiler.ConstructorDeclaration,
_a[ts.SyntaxKind.ConstructSignature] = compiler.ConstructSignatureDeclaration,
_a[ts.SyntaxKind.ComputedPropertyName] = compiler.ComputedPropertyName,
_a[ts.SyntaxKind.Decorator] = compiler.Decorator,
_a[ts.SyntaxKind.EnumDeclaration] = compiler.EnumDeclaration,
_a[ts.SyntaxKind.EnumMember] = compiler.EnumMember,
_a[ts.SyntaxKind.ExportAssignment] = compiler.ExportAssignment,
_a[ts.SyntaxKind.ExportDeclaration] = compiler.ExportDeclaration,
_a[ts.SyntaxKind.ExportSpecifier] = compiler.ExportSpecifier,
_a[ts.SyntaxKind.ExpressionWithTypeArguments] = compiler.ExpressionWithTypeArguments,
_a[ts.SyntaxKind.ExpressionStatement] = compiler.ExpressionStatement,
_a[ts.SyntaxKind.FunctionDeclaration] = compiler.FunctionDeclaration,
_a[ts.SyntaxKind.FunctionExpression] = compiler.FunctionExpression,
_a[ts.SyntaxKind.GetAccessor] = compiler.GetAccessorDeclaration,
_a[ts.SyntaxKind.HeritageClause] = compiler.HeritageClause,
_a[ts.SyntaxKind.Identifier] = compiler.Identifier,
_a[ts.SyntaxKind.ImportDeclaration] = compiler.ImportDeclaration,
_a[ts.SyntaxKind.ImportSpecifier] = compiler.ImportSpecifier,
_a[ts.SyntaxKind.InterfaceDeclaration] = compiler.InterfaceDeclaration,
_a[ts.SyntaxKind.MethodDeclaration] = compiler.MethodDeclaration,
_a[ts.SyntaxKind.MethodSignature] = compiler.MethodSignature,
_a[ts.SyntaxKind.ModuleDeclaration] = compiler.NamespaceDeclaration,
_a[ts.SyntaxKind.NumericLiteral] = compiler.NumericLiteral,
_a[ts.SyntaxKind.FirstLiteralToken] = compiler.NumericLiteral,
_a[ts.SyntaxKind.ObjectLiteralExpression] = compiler.ObjectLiteralExpression,
_a[ts.SyntaxKind.Parameter] = compiler.ParameterDeclaration,
_a[ts.SyntaxKind.PropertyAccessExpression] = compiler.PropertyAccessExpression,
_a[ts.SyntaxKind.PropertyAssignment] = compiler.PropertyAssignment,
_a[ts.SyntaxKind.PropertyDeclaration] = compiler.PropertyDeclaration,
_a[ts.SyntaxKind.PropertySignature] = compiler.PropertySignature,
_a[ts.SyntaxKind.QualifiedName] = compiler.QualifiedName,
_a[ts.SyntaxKind.FirstNode] = compiler.QualifiedName,
_a[ts.SyntaxKind.RegularExpressionLiteral] = compiler.RegularExpressionLiteral,
_a[ts.SyntaxKind.ReturnStatement] = compiler.ReturnStatement,
_a[ts.SyntaxKind.SetAccessor] = compiler.SetAccessorDeclaration,
_a[ts.SyntaxKind.ShorthandPropertyAssignment] = compiler.ShorthandPropertyAssignment,
_a[ts.SyntaxKind.SpreadAssignment] = compiler.SpreadAssignment,
_a[ts.SyntaxKind.StringLiteral] = compiler.StringLiteral,
_a[ts.SyntaxKind.SyntaxList] = compiler.SyntaxList,
_a[ts.SyntaxKind.TypeAliasDeclaration] = compiler.TypeAliasDeclaration,
_a[ts.SyntaxKind.TypeParameter] = compiler.TypeParameterDeclaration,
_a[ts.SyntaxKind.TypeReference] = compiler.TypeReferenceNode,
_a[ts.SyntaxKind.VariableDeclaration] = compiler.VariableDeclaration,
_a[ts.SyntaxKind.VariableStatement] = compiler.VariableStatement,
_a[ts.SyntaxKind.JSDocComment] = compiler.JSDoc,
_a[ts.SyntaxKind.FirstTypeNode] = compiler.TypeNode,
_a[ts.SyntaxKind.LastTypeNode] = compiler.TypeNode,
_a[ts.SyntaxKind.JSDocTag] = compiler.JSDocUnknownTag,
_a[ts.SyntaxKind.JSDocAugmentsTag] = compiler.JSDocAugmentsTag,
_a[ts.SyntaxKind.JSDocClassTag] = compiler.JSDocClassTag,
_a[ts.SyntaxKind.JSDocReturnTag] = compiler.JSDocReturnTag,
_a[ts.SyntaxKind.JSDocTypeTag] = compiler.JSDocTypeTag,
_a[ts.SyntaxKind.JSDocTypedefTag] = compiler.JSDocTypedefTag,
_a[ts.SyntaxKind.JSDocPropertyTag] = compiler.JSDocPropertyTag,
_a[ts.SyntaxKind.SemicolonToken] = compiler.Node,
// literals
_a[ts.SyntaxKind.AnyKeyword] = compiler.Expression,
_a[ts.SyntaxKind.BooleanKeyword] = compiler.Expression,
_a[ts.SyntaxKind.FalseKeyword] = compiler.BooleanLiteral,
_a[ts.SyntaxKind.ImportKeyword] = compiler.Expression,
_a[ts.SyntaxKind.NeverKeyword] = compiler.Expression,
_a[ts.SyntaxKind.NullKeyword] = compiler.Expression,
_a[ts.SyntaxKind.NumberKeyword] = compiler.Expression,
_a[ts.SyntaxKind.ObjectKeyword] = compiler.Expression,
_a[ts.SyntaxKind.StringKeyword] = compiler.Expression,
_a[ts.SyntaxKind.SymbolKeyword] = compiler.Expression,
_a[ts.SyntaxKind.SuperKeyword] = compiler.Expression,
_a[ts.SyntaxKind.ThisKeyword] = compiler.Expression,
_a[ts.SyntaxKind.TrueKeyword] = compiler.BooleanLiteral,
_a[ts.SyntaxKind.UndefinedKeyword] = compiler.Expression,
_a[ts.SyntaxKind.VoidKeyword] = compiler.Expression,
_a);
var _a;