Skip to content

Commit e238cc7

Browse files
ark120202Perryvw
authored andcommitted
Transformation Pipeline Refactor (#705)
* Transformation Pipeline Refactor * Add missing export * Fix formatting * Fix memory leak * Rename `setIfMissing` to `getOrUpdate` * Change `SymbolId` brand style * Extract constructed object visitor to a variable * Add -expression to n-ary transformer names * Handle `@noResolve` in `export *` and external module references * Remove disabled tshelper tests * Resolve some TODOs * Rename decorators/directives to annotations * Remove 'custom' from annotation functions * Simplify few error creators * Refactor standard transformers to a single plugin * Refactor typeof tests * Refactor class accessor checks * Import Lua AST as `lua` instead of `tstl` * Fix formatting * Move plugin out of transformation pipeline * Allow to specify custom printer through plugins * Make printer plugin stateless * Fix 'printer' property name in error message * Make standard transformers have lowest priority * Add few comments to public plugin API * Simplify some code * Use canonical casing for annotations * Move `OmittedExpression` handling to context visitors * Move TODO visitors to `typescript` file * Class `creation` -> `setup` * Merge `annotations` utils files * Some minor refactors * Rename prototype transform functions * Update `printer` comment * `variable` -> `variable-declaration` * Rename `transformation/transformers` to `transformation/visitors` * Remove unnecessary import
1 parent 757302b commit e238cc7

File tree

112 files changed

+8527
-8070
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+8527
-8070
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"main": "dist/index.js",
1919
"types": "dist/index.d.ts",
2020
"scripts": {
21-
"build": "tsc -p tsconfig.json && npm run build-lualib",
21+
"build": "tsc && npm run build-lualib",
2222
"build-lualib": "ts-node --files ./build_lualib.ts",
2323
"pretest": "npm run lint && ts-node --files --transpile-only ./build_lualib.ts",
2424
"test": "jest",

src/Decorator.ts

Lines changed: 0 additions & 39 deletions
This file was deleted.

src/LuaAST.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// Simplified Lua AST based roughly on http://lua-users.org/wiki/MetaLuaAbstractSyntaxTree,
2-
// https://www.lua.org/manual/5.3/manual.html (9 – The Complete Syntax of Lua) and the TS AST implementation
2+
// https://www.lua.org/manual/5.3/manual.html#9 and the TS AST implementation
33

44
// We can elide a lot of nodes especially tokens and keywords
5-
// because we dont create the AST from text
5+
// because we don't create the AST from text
66

77
import * as ts from "typescript";
88

@@ -121,7 +121,7 @@ export type BinaryOperator =
121121

122122
export type Operator = UnaryOperator | BinaryOperator;
123123

124-
export type SymbolId = number;
124+
export type SymbolId = number & { _symbolIdBrand: any };
125125

126126
export interface TextRange {
127127
line?: number;
@@ -616,7 +616,7 @@ export function isStringLiteral(node: Node): node is StringLiteral {
616616

617617
export function createStringLiteral(value: string, tsOriginal?: ts.Node, parent?: Node): StringLiteral {
618618
const expression = createNode(SyntaxKind.StringLiteral, tsOriginal, parent) as StringLiteral;
619-
expression.value = value as string;
619+
expression.value = value;
620620
return expression;
621621
}
622622

src/LuaKeywords.ts

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
 (0)