typescript-to-lua 1.25.2 → 1.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CompilerOptions.js +2 -2
- package/dist/LuaAST.js +76 -77
- package/dist/LuaLib.js +12 -12
- package/dist/LuaPrinter.js +2 -2
- package/dist/cli/information.js +2 -2
- package/dist/cli/parse.js +3 -3
- package/dist/cli/report.d.ts +4 -4
- package/dist/cli/report.js +2 -2
- package/dist/cli/tsconfig.js +3 -4
- package/dist/lualib/5.0/Set.lua +58 -0
- package/dist/lualib/5.0/lualib_bundle.lua +58 -0
- package/dist/lualib/5.0/lualib_module_info.json +2 -1
- package/dist/lualib/universal/Set.lua +58 -0
- package/dist/lualib/universal/lualib_bundle.lua +58 -0
- package/dist/lualib/universal/lualib_module_info.json +2 -1
- package/dist/lualib-build/plugin.d.ts +1 -1
- package/dist/lualib-build/util.js +8 -9
- package/dist/measure-performance.js +7 -8
- package/dist/transformation/builtins/array.js +3 -4
- package/dist/transformation/builtins/console.js +1 -2
- package/dist/transformation/builtins/function.js +2 -3
- package/dist/transformation/builtins/global.js +1 -2
- package/dist/transformation/builtins/index.js +4 -5
- package/dist/transformation/builtins/map.js +1 -2
- package/dist/transformation/builtins/math.js +2 -3
- package/dist/transformation/builtins/number.js +3 -4
- package/dist/transformation/builtins/object.js +2 -3
- package/dist/transformation/builtins/promise.js +4 -5
- package/dist/transformation/builtins/string.js +3 -4
- package/dist/transformation/builtins/symbol.js +1 -2
- package/dist/transformation/context/context.d.ts +0 -3
- package/dist/transformation/index.js +2 -3
- package/dist/transformation/pre-transformers/using-transformer.js +1 -2
- package/dist/transformation/utils/annotations.js +5 -5
- package/dist/transformation/utils/assignment-validation.js +1 -2
- package/dist/transformation/utils/export.js +14 -14
- package/dist/transformation/utils/function-context.js +3 -3
- package/dist/transformation/utils/language-extensions.js +10 -10
- package/dist/transformation/utils/lua-ast.js +12 -12
- package/dist/transformation/utils/lualib.js +3 -3
- package/dist/transformation/utils/preceding-statements.js +1 -2
- package/dist/transformation/utils/safe-names.js +3 -3
- package/dist/transformation/utils/scope.js +11 -11
- package/dist/transformation/utils/symbols.js +4 -5
- package/dist/transformation/utils/typescript/index.js +13 -14
- package/dist/transformation/utils/typescript/nodes.js +8 -9
- package/dist/transformation/utils/typescript/types.js +10 -11
- package/dist/transformation/visitors/access.js +4 -4
- package/dist/transformation/visitors/async-await.js +3 -3
- package/dist/transformation/visitors/binary-expression/assignments.js +5 -6
- package/dist/transformation/visitors/binary-expression/bit.js +3 -3
- package/dist/transformation/visitors/binary-expression/compound.js +3 -3
- package/dist/transformation/visitors/binary-expression/destructuring-assignments.js +3 -4
- package/dist/transformation/visitors/binary-expression/index.js +4 -4
- package/dist/transformation/visitors/block.js +3 -3
- package/dist/transformation/visitors/call.js +6 -6
- package/dist/transformation/visitors/class/decorators.js +6 -7
- package/dist/transformation/visitors/class/index.js +14 -3
- package/dist/transformation/visitors/class/members/accessors.js +1 -2
- package/dist/transformation/visitors/class/members/constructor.js +3 -4
- package/dist/transformation/visitors/class/members/fields.js +2 -3
- package/dist/transformation/visitors/class/members/method.js +3 -4
- package/dist/transformation/visitors/class/setup.js +2 -3
- package/dist/transformation/visitors/class/utils.js +5 -6
- package/dist/transformation/visitors/conditional.js +3 -3
- package/dist/transformation/visitors/enum.js +2 -2
- package/dist/transformation/visitors/expression-list.js +4 -5
- package/dist/transformation/visitors/expression-statement.js +2 -2
- package/dist/transformation/visitors/function.js +9 -9
- package/dist/transformation/visitors/identifier.js +4 -4
- package/dist/transformation/visitors/language-extensions/call-extension.js +2 -2
- package/dist/transformation/visitors/language-extensions/identifier.js +2 -3
- package/dist/transformation/visitors/language-extensions/iterable.js +3 -4
- package/dist/transformation/visitors/language-extensions/multi.js +8 -9
- package/dist/transformation/visitors/language-extensions/range.js +3 -4
- package/dist/transformation/visitors/language-extensions/table.js +2 -2
- package/dist/transformation/visitors/language-extensions/vararg.js +2 -3
- package/dist/transformation/visitors/literal.js +3 -3
- package/dist/transformation/visitors/loops/utils.js +4 -5
- package/dist/transformation/visitors/modules/export.js +0 -3
- package/dist/transformation/visitors/modules/import.js +2 -2
- package/dist/transformation/visitors/namespace.js +3 -3
- package/dist/transformation/visitors/optional-chaining.js +6 -7
- package/dist/transformation/visitors/return.js +3 -3
- package/dist/transformation/visitors/spread.js +2 -2
- package/dist/transformation/visitors/typeof.js +2 -2
- package/dist/transformation/visitors/unary-expression.js +2 -2
- package/dist/transformation/visitors/variable-declaration.js +6 -6
- package/dist/transpilation/bundle.js +3 -3
- package/dist/transpilation/find-lua-requires.js +1 -2
- package/dist/transpilation/index.js +5 -6
- package/dist/transpilation/output-collector.js +1 -2
- package/dist/transpilation/plugins.js +1 -2
- package/dist/transpilation/resolve.js +1 -2
- package/dist/transpilation/transformers.js +2 -2
- package/dist/transpilation/transpile.js +1 -2
- package/dist/transpilation/transpiler.js +6 -6
- package/dist/transpilation/utils.js +2 -2
- package/dist/utils.js +9 -9
- package/package.json +6 -7
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getSymbolInfo = getSymbolInfo;
|
|
4
|
+
exports.getSymbolIdOfSymbol = getSymbolIdOfSymbol;
|
|
5
|
+
exports.trackSymbolReference = trackSymbolReference;
|
|
6
|
+
exports.getIdentifierSymbolId = getIdentifierSymbolId;
|
|
4
7
|
const spread_1 = require("../visitors/spread");
|
|
5
8
|
const scope_1 = require("./scope");
|
|
6
9
|
function getSymbolInfo(context, symbolId) {
|
|
7
10
|
return context.symbolInfoMap.get(symbolId);
|
|
8
11
|
}
|
|
9
|
-
exports.getSymbolInfo = getSymbolInfo;
|
|
10
12
|
function getSymbolIdOfSymbol(context, symbol) {
|
|
11
13
|
return context.symbolIdMaps.get(symbol);
|
|
12
14
|
}
|
|
13
|
-
exports.getSymbolIdOfSymbol = getSymbolIdOfSymbol;
|
|
14
15
|
function trackSymbolReference(context, symbol, identifier) {
|
|
15
16
|
// Track first time symbols are seen
|
|
16
17
|
let symbolId = context.symbolIdMaps.get(symbol);
|
|
@@ -26,11 +27,9 @@ function trackSymbolReference(context, symbol, identifier) {
|
|
|
26
27
|
}
|
|
27
28
|
return symbolId;
|
|
28
29
|
}
|
|
29
|
-
exports.trackSymbolReference = trackSymbolReference;
|
|
30
30
|
function getIdentifierSymbolId(context, identifier, symbol) {
|
|
31
31
|
if (symbol) {
|
|
32
32
|
return trackSymbolReference(context, symbol, identifier);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
exports.getIdentifierSymbolId = getIdentifierSymbolId;
|
|
36
35
|
//# sourceMappingURL=symbols.js.map
|
|
@@ -14,7 +14,19 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
17
|
+
exports.hasExportEquals = hasExportEquals;
|
|
18
|
+
exports.findFirstNodeAbove = findFirstNodeAbove;
|
|
19
|
+
exports.findFirstNonOuterParent = findFirstNonOuterParent;
|
|
20
|
+
exports.expressionResultIsUsed = expressionResultIsUsed;
|
|
21
|
+
exports.getFirstDeclarationInFile = getFirstDeclarationInFile;
|
|
22
|
+
exports.isStandardLibraryDeclaration = isStandardLibraryDeclaration;
|
|
23
|
+
exports.isStandardLibraryType = isStandardLibraryType;
|
|
24
|
+
exports.hasStandardLibrarySignature = hasStandardLibrarySignature;
|
|
25
|
+
exports.inferAssignedType = inferAssignedType;
|
|
26
|
+
exports.getAllCallSignatures = getAllCallSignatures;
|
|
27
|
+
exports.isExpressionWithEvaluationEffect = isExpressionWithEvaluationEffect;
|
|
28
|
+
exports.getFunctionTypeForCall = getFunctionTypeForCall;
|
|
29
|
+
exports.isConstIdentifier = isConstIdentifier;
|
|
18
30
|
const ts = require("typescript");
|
|
19
31
|
__exportStar(require("./nodes"), exports);
|
|
20
32
|
__exportStar(require("./types"), exports);
|
|
@@ -22,7 +34,6 @@ __exportStar(require("./types"), exports);
|
|
|
22
34
|
function hasExportEquals(sourceFile) {
|
|
23
35
|
return sourceFile.statements.some(node => ts.isExportAssignment(node) && node.isExportEquals);
|
|
24
36
|
}
|
|
25
|
-
exports.hasExportEquals = hasExportEquals;
|
|
26
37
|
/**
|
|
27
38
|
* Search up until finding a node satisfying the callback
|
|
28
39
|
*/
|
|
@@ -37,7 +48,6 @@ function findFirstNodeAbove(node, callback) {
|
|
|
37
48
|
}
|
|
38
49
|
}
|
|
39
50
|
}
|
|
40
|
-
exports.findFirstNodeAbove = findFirstNodeAbove;
|
|
41
51
|
function findFirstNonOuterParent(node) {
|
|
42
52
|
let current = ts.getOriginalNode(node).parent;
|
|
43
53
|
while (ts.isOuterExpression(current)) {
|
|
@@ -45,18 +55,15 @@ function findFirstNonOuterParent(node) {
|
|
|
45
55
|
}
|
|
46
56
|
return current;
|
|
47
57
|
}
|
|
48
|
-
exports.findFirstNonOuterParent = findFirstNonOuterParent;
|
|
49
58
|
function expressionResultIsUsed(node) {
|
|
50
59
|
return !ts.isExpressionStatement(findFirstNonOuterParent(node));
|
|
51
60
|
}
|
|
52
|
-
exports.expressionResultIsUsed = expressionResultIsUsed;
|
|
53
61
|
function getFirstDeclarationInFile(symbol, sourceFile) {
|
|
54
62
|
var _a, _b;
|
|
55
63
|
const originalSourceFile = (_a = ts.getParseTreeNode(sourceFile)) !== null && _a !== void 0 ? _a : sourceFile;
|
|
56
64
|
const declarations = ((_b = symbol.getDeclarations()) !== null && _b !== void 0 ? _b : []).filter(d => d.getSourceFile() === originalSourceFile);
|
|
57
65
|
return declarations.length > 0 ? declarations.reduce((p, c) => (p.pos < c.pos ? p : c)) : undefined;
|
|
58
66
|
}
|
|
59
|
-
exports.getFirstDeclarationInFile = getFirstDeclarationInFile;
|
|
60
67
|
function isStandardLibraryDeclaration(context, declaration) {
|
|
61
68
|
var _a;
|
|
62
69
|
const parseTreeNode = (_a = ts.getParseTreeNode(declaration)) !== null && _a !== void 0 ? _a : declaration;
|
|
@@ -66,7 +73,6 @@ function isStandardLibraryDeclaration(context, declaration) {
|
|
|
66
73
|
}
|
|
67
74
|
return context.program.isSourceFileDefaultLibrary(sourceFile);
|
|
68
75
|
}
|
|
69
|
-
exports.isStandardLibraryDeclaration = isStandardLibraryDeclaration;
|
|
70
76
|
function isStandardLibraryType(context, type, name) {
|
|
71
77
|
const symbol = type.getSymbol();
|
|
72
78
|
if (!symbol || (name ? symbol.name !== name : symbol.name === "__type")) {
|
|
@@ -79,26 +85,21 @@ function isStandardLibraryType(context, type, name) {
|
|
|
79
85
|
}
|
|
80
86
|
return isStandardLibraryDeclaration(context, declaration);
|
|
81
87
|
}
|
|
82
|
-
exports.isStandardLibraryType = isStandardLibraryType;
|
|
83
88
|
function hasStandardLibrarySignature(context, callExpression) {
|
|
84
89
|
const signature = context.checker.getResolvedSignature(callExpression);
|
|
85
90
|
return (signature === null || signature === void 0 ? void 0 : signature.declaration) ? isStandardLibraryDeclaration(context, signature.declaration) : false;
|
|
86
91
|
}
|
|
87
|
-
exports.hasStandardLibrarySignature = hasStandardLibrarySignature;
|
|
88
92
|
function inferAssignedType(context, expression) {
|
|
89
93
|
var _a;
|
|
90
94
|
return (_a = context.checker.getContextualType(expression)) !== null && _a !== void 0 ? _a : context.checker.getTypeAtLocation(expression);
|
|
91
95
|
}
|
|
92
|
-
exports.inferAssignedType = inferAssignedType;
|
|
93
96
|
function getAllCallSignatures(type) {
|
|
94
97
|
return type.isUnion() ? type.types.flatMap(getAllCallSignatures) : type.getCallSignatures();
|
|
95
98
|
}
|
|
96
|
-
exports.getAllCallSignatures = getAllCallSignatures;
|
|
97
99
|
// Returns true for expressions that may have effects when evaluated
|
|
98
100
|
function isExpressionWithEvaluationEffect(node) {
|
|
99
101
|
return !(ts.isLiteralExpression(node) || ts.isIdentifier(node) || node.kind === ts.SyntaxKind.ThisKeyword);
|
|
100
102
|
}
|
|
101
|
-
exports.isExpressionWithEvaluationEffect = isExpressionWithEvaluationEffect;
|
|
102
103
|
function getFunctionTypeForCall(context, node) {
|
|
103
104
|
const signature = context.checker.getResolvedSignature(node);
|
|
104
105
|
if (!(signature === null || signature === void 0 ? void 0 : signature.declaration)) {
|
|
@@ -110,7 +111,6 @@ function getFunctionTypeForCall(context, node) {
|
|
|
110
111
|
}
|
|
111
112
|
return context.checker.getTypeFromTypeNode(typeDeclaration.type);
|
|
112
113
|
}
|
|
113
|
-
exports.getFunctionTypeForCall = getFunctionTypeForCall;
|
|
114
114
|
function isConstIdentifier(context, node) {
|
|
115
115
|
let identifier = node;
|
|
116
116
|
if (ts.isComputedPropertyName(identifier)) {
|
|
@@ -125,5 +125,4 @@ function isConstIdentifier(context, node) {
|
|
|
125
125
|
}
|
|
126
126
|
return symbol.declarations.some(d => ts.isVariableDeclarationList(d.parent) && (d.parent.flags & ts.NodeFlags.Const) !== 0);
|
|
127
127
|
}
|
|
128
|
-
exports.isConstIdentifier = isConstIdentifier;
|
|
129
128
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,28 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.isAssignmentPattern = isAssignmentPattern;
|
|
4
|
+
exports.isDestructuringAssignment = isDestructuringAssignment;
|
|
5
|
+
exports.isAmbientNode = isAmbientNode;
|
|
6
|
+
exports.isInDestructingAssignment = isInDestructingAssignment;
|
|
7
|
+
exports.isInAsyncFunction = isInAsyncFunction;
|
|
8
|
+
exports.isInGeneratorFunction = isInGeneratorFunction;
|
|
9
|
+
exports.getSymbolOfNode = getSymbolOfNode;
|
|
10
|
+
exports.isFirstDeclaration = isFirstDeclaration;
|
|
4
11
|
const ts = require("typescript");
|
|
5
12
|
const _1 = require(".");
|
|
6
13
|
function isAssignmentPattern(node) {
|
|
7
14
|
return ts.isObjectLiteralExpression(node) || ts.isArrayLiteralExpression(node);
|
|
8
15
|
}
|
|
9
|
-
exports.isAssignmentPattern = isAssignmentPattern;
|
|
10
16
|
function isDestructuringAssignment(node) {
|
|
11
17
|
return (ts.isBinaryExpression(node) &&
|
|
12
18
|
node.operatorToken.kind === ts.SyntaxKind.EqualsToken &&
|
|
13
19
|
isAssignmentPattern(node.left));
|
|
14
20
|
}
|
|
15
|
-
exports.isDestructuringAssignment = isDestructuringAssignment;
|
|
16
21
|
function isAmbientNode(node) {
|
|
17
22
|
return (ts.getCombinedModifierFlags(node) & ts.ModifierFlags.Ambient) !== 0;
|
|
18
23
|
}
|
|
19
|
-
exports.isAmbientNode = isAmbientNode;
|
|
20
24
|
function isInDestructingAssignment(node) {
|
|
21
25
|
return (node.parent &&
|
|
22
26
|
((ts.isVariableDeclaration(node.parent) && ts.isArrayBindingPattern(node.parent.name)) ||
|
|
23
27
|
(ts.isBinaryExpression(node.parent) && ts.isArrayLiteralExpression(node.parent.left))));
|
|
24
28
|
}
|
|
25
|
-
exports.isInDestructingAssignment = isInDestructingAssignment;
|
|
26
29
|
function isInAsyncFunction(node) {
|
|
27
30
|
var _a, _b;
|
|
28
31
|
// Check if node is in function declaration with `async`
|
|
@@ -37,7 +40,6 @@ function isInAsyncFunction(node) {
|
|
|
37
40
|
return false;
|
|
38
41
|
}
|
|
39
42
|
}
|
|
40
|
-
exports.isInAsyncFunction = isInAsyncFunction;
|
|
41
43
|
function isInGeneratorFunction(node) {
|
|
42
44
|
// Check if node is in function declaration with `async`
|
|
43
45
|
const declaration = (0, _1.findFirstNodeAbove)(node, ts.isFunctionDeclaration);
|
|
@@ -46,7 +48,6 @@ function isInGeneratorFunction(node) {
|
|
|
46
48
|
}
|
|
47
49
|
return declaration.asteriskToken !== undefined;
|
|
48
50
|
}
|
|
49
|
-
exports.isInGeneratorFunction = isInGeneratorFunction;
|
|
50
51
|
/**
|
|
51
52
|
* Quite hacky, avoid unless absolutely necessary!
|
|
52
53
|
*/
|
|
@@ -54,10 +55,8 @@ function getSymbolOfNode(context, node) {
|
|
|
54
55
|
var _a;
|
|
55
56
|
return (_a = node.symbol) !== null && _a !== void 0 ? _a : context.checker.getSymbolAtLocation(node);
|
|
56
57
|
}
|
|
57
|
-
exports.getSymbolOfNode = getSymbolOfNode;
|
|
58
58
|
function isFirstDeclaration(context, node) {
|
|
59
59
|
const symbol = getSymbolOfNode(context, node);
|
|
60
60
|
return symbol ? symbol.valueDeclaration === node : true;
|
|
61
61
|
}
|
|
62
|
-
exports.isFirstDeclaration = isFirstDeclaration;
|
|
63
62
|
//# sourceMappingURL=nodes.js.map
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.typeAlwaysHasSomeOfFlags = typeAlwaysHasSomeOfFlags;
|
|
4
|
+
exports.typeCanHaveSomeOfFlags = typeCanHaveSomeOfFlags;
|
|
5
|
+
exports.isStringType = isStringType;
|
|
6
|
+
exports.isNumberType = isNumberType;
|
|
7
|
+
exports.forTypeOrAnySupertype = forTypeOrAnySupertype;
|
|
8
|
+
exports.isArrayType = isArrayType;
|
|
9
|
+
exports.isAlwaysArrayType = isAlwaysArrayType;
|
|
10
|
+
exports.isFunctionType = isFunctionType;
|
|
11
|
+
exports.canBeFalsy = canBeFalsy;
|
|
12
|
+
exports.canBeFalsyWhenNotNull = canBeFalsyWhenNotNull;
|
|
4
13
|
const ts = require("typescript");
|
|
5
14
|
function typeAlwaysHasSomeOfFlags(context, type, flags) {
|
|
6
15
|
const baseConstraint = context.checker.getBaseConstraintOfType(type);
|
|
@@ -18,7 +27,6 @@ function typeAlwaysHasSomeOfFlags(context, type, flags) {
|
|
|
18
27
|
}
|
|
19
28
|
return false;
|
|
20
29
|
}
|
|
21
|
-
exports.typeAlwaysHasSomeOfFlags = typeAlwaysHasSomeOfFlags;
|
|
22
30
|
function typeCanHaveSomeOfFlags(context, type, flags) {
|
|
23
31
|
const baseConstraint = context.checker.getBaseConstraintOfType(type);
|
|
24
32
|
if (!baseConstraint) {
|
|
@@ -40,15 +48,12 @@ function typeCanHaveSomeOfFlags(context, type, flags) {
|
|
|
40
48
|
}
|
|
41
49
|
return false;
|
|
42
50
|
}
|
|
43
|
-
exports.typeCanHaveSomeOfFlags = typeCanHaveSomeOfFlags;
|
|
44
51
|
function isStringType(context, type) {
|
|
45
52
|
return typeAlwaysHasSomeOfFlags(context, type, ts.TypeFlags.StringLike);
|
|
46
53
|
}
|
|
47
|
-
exports.isStringType = isStringType;
|
|
48
54
|
function isNumberType(context, type) {
|
|
49
55
|
return typeAlwaysHasSomeOfFlags(context, type, ts.TypeFlags.NumberLike);
|
|
50
56
|
}
|
|
51
|
-
exports.isNumberType = isNumberType;
|
|
52
57
|
function isExplicitArrayType(context, type) {
|
|
53
58
|
if (context.checker.isArrayType(type) || context.checker.isTupleType(type))
|
|
54
59
|
return true;
|
|
@@ -92,19 +97,15 @@ function forTypeOrAnySupertype(context, type, predicate) {
|
|
|
92
97
|
return false;
|
|
93
98
|
return baseTypes.some(superType => forTypeOrAnySupertype(context, superType, predicate));
|
|
94
99
|
}
|
|
95
|
-
exports.forTypeOrAnySupertype = forTypeOrAnySupertype;
|
|
96
100
|
function isArrayType(context, type) {
|
|
97
101
|
return forTypeOrAnySupertype(context, type, t => isExplicitArrayType(context, t));
|
|
98
102
|
}
|
|
99
|
-
exports.isArrayType = isArrayType;
|
|
100
103
|
function isAlwaysArrayType(context, type) {
|
|
101
104
|
return forTypeOrAnySupertype(context, type, t => isAlwaysExplicitArrayType(context, t));
|
|
102
105
|
}
|
|
103
|
-
exports.isAlwaysArrayType = isAlwaysArrayType;
|
|
104
106
|
function isFunctionType(type) {
|
|
105
107
|
return type.getCallSignatures().length > 0;
|
|
106
108
|
}
|
|
107
|
-
exports.isFunctionType = isFunctionType;
|
|
108
109
|
function canBeFalsy(context, type) {
|
|
109
110
|
const strictNullChecks = context.options.strict === true || context.options.strictNullChecks === true;
|
|
110
111
|
if (!strictNullChecks && !type.isLiteral())
|
|
@@ -119,7 +120,6 @@ function canBeFalsy(context, type) {
|
|
|
119
120
|
ts.TypeFlags.Null;
|
|
120
121
|
return typeCanHaveSomeOfFlags(context, type, falsyFlags);
|
|
121
122
|
}
|
|
122
|
-
exports.canBeFalsy = canBeFalsy;
|
|
123
123
|
function canBeFalsyWhenNotNull(context, type) {
|
|
124
124
|
const falsyFlags = ts.TypeFlags.Boolean |
|
|
125
125
|
ts.TypeFlags.BooleanLiteral |
|
|
@@ -129,5 +129,4 @@ function canBeFalsyWhenNotNull(context, type) {
|
|
|
129
129
|
ts.TypeFlags.Any;
|
|
130
130
|
return typeCanHaveSomeOfFlags(context, type, falsyFlags);
|
|
131
131
|
}
|
|
132
|
-
exports.canBeFalsyWhenNotNull = canBeFalsyWhenNotNull;
|
|
133
132
|
//# sourceMappingURL=types.js.map
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.transformQualifiedName = exports.
|
|
3
|
+
exports.transformQualifiedName = exports.transformPropertyAccessExpression = exports.transformElementAccessExpression = void 0;
|
|
4
|
+
exports.transformElementAccessArgument = transformElementAccessArgument;
|
|
5
|
+
exports.transformElementAccessExpressionWithCapture = transformElementAccessExpressionWithCapture;
|
|
6
|
+
exports.transformPropertyAccessExpressionWithCapture = transformPropertyAccessExpressionWithCapture;
|
|
4
7
|
const ts = require("typescript");
|
|
5
8
|
const lua = require("../../LuaAST");
|
|
6
9
|
const builtins_1 = require("../builtins");
|
|
@@ -29,7 +32,6 @@ function transformElementAccessArgument(context, node) {
|
|
|
29
32
|
const index = context.transformExpression(node.argumentExpression);
|
|
30
33
|
return addOneToArrayAccessArgument(context, node, index);
|
|
31
34
|
}
|
|
32
|
-
exports.transformElementAccessArgument = transformElementAccessArgument;
|
|
33
35
|
const transformElementAccessExpression = (node, context) => transformElementAccessExpressionWithCapture(context, node, undefined).expression;
|
|
34
36
|
exports.transformElementAccessExpression = transformElementAccessExpression;
|
|
35
37
|
function transformElementAccessExpressionWithCapture(context, node, thisValueCapture) {
|
|
@@ -73,7 +75,6 @@ function transformElementAccessExpressionWithCapture(context, node, thisValueCap
|
|
|
73
75
|
}
|
|
74
76
|
return { expression: lua.createTableIndexExpression(table, updatedAccessExpression, node) };
|
|
75
77
|
}
|
|
76
|
-
exports.transformElementAccessExpressionWithCapture = transformElementAccessExpressionWithCapture;
|
|
77
78
|
const transformPropertyAccessExpression = (node, context) => transformPropertyAccessExpressionWithCapture(context, node, undefined).expression;
|
|
78
79
|
exports.transformPropertyAccessExpression = transformPropertyAccessExpression;
|
|
79
80
|
function transformPropertyAccessExpressionWithCapture(context, node, thisValueCapture) {
|
|
@@ -145,7 +146,6 @@ function transformPropertyAccessExpressionWithCapture(context, node, thisValueCa
|
|
|
145
146
|
}
|
|
146
147
|
return { expression: lua.createTableIndexExpression(table, lua.createStringLiteral(property), node) };
|
|
147
148
|
}
|
|
148
|
-
exports.transformPropertyAccessExpressionWithCapture = transformPropertyAccessExpressionWithCapture;
|
|
149
149
|
const transformQualifiedName = (node, context) => {
|
|
150
150
|
const right = lua.createStringLiteral(node.right.text, node.right);
|
|
151
151
|
const left = context.transformExpression(node.left);
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.transformAwaitExpression = void 0;
|
|
4
|
+
exports.isAsyncFunction = isAsyncFunction;
|
|
5
|
+
exports.wrapInAsyncAwaiter = wrapInAsyncAwaiter;
|
|
4
6
|
const ts = require("typescript");
|
|
5
7
|
const lua = require("../../LuaAST");
|
|
6
8
|
const diagnostics_1 = require("../utils/diagnostics");
|
|
@@ -19,7 +21,6 @@ function isAsyncFunction(declaration) {
|
|
|
19
21
|
var _a, _b;
|
|
20
22
|
return (_b = (_a = declaration.modifiers) === null || _a === void 0 ? void 0 : _a.some(m => m.kind === ts.SyntaxKind.AsyncKeyword)) !== null && _b !== void 0 ? _b : false;
|
|
21
23
|
}
|
|
22
|
-
exports.isAsyncFunction = isAsyncFunction;
|
|
23
24
|
function wrapInAsyncAwaiter(context, statements, includeResolveParameter = true) {
|
|
24
25
|
(0, lualib_1.importLuaLibFeature)(context, lualib_1.LuaLibFeature.Await);
|
|
25
26
|
const parameters = includeResolveParameter ? [lua.createIdentifier("____awaiter_resolve")] : [];
|
|
@@ -27,5 +28,4 @@ function wrapInAsyncAwaiter(context, statements, includeResolveParameter = true)
|
|
|
27
28
|
lua.createFunctionExpression(lua.createBlock(statements), parameters),
|
|
28
29
|
]);
|
|
29
30
|
}
|
|
30
|
-
exports.wrapInAsyncAwaiter = wrapInAsyncAwaiter;
|
|
31
31
|
//# sourceMappingURL=async-await.js.map
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.transformAssignmentLeftHandSideExpression = transformAssignmentLeftHandSideExpression;
|
|
4
|
+
exports.transformAssignment = transformAssignment;
|
|
5
|
+
exports.transformAssignmentWithRightPrecedingStatements = transformAssignmentWithRightPrecedingStatements;
|
|
6
|
+
exports.transformAssignmentExpression = transformAssignmentExpression;
|
|
7
|
+
exports.transformAssignmentStatement = transformAssignmentStatement;
|
|
4
8
|
const ts = require("typescript");
|
|
5
9
|
const typescript_1 = require("typescript");
|
|
6
10
|
const lua = require("../../../LuaAST");
|
|
@@ -43,7 +47,6 @@ function transformAssignmentLeftHandSideExpression(context, node, rightHasPreced
|
|
|
43
47
|
return lua.createAnonymousIdentifier();
|
|
44
48
|
}
|
|
45
49
|
}
|
|
46
|
-
exports.transformAssignmentLeftHandSideExpression = transformAssignmentLeftHandSideExpression;
|
|
47
50
|
function transformAssignment(context,
|
|
48
51
|
// TODO: Change type to ts.LeftHandSideExpression?
|
|
49
52
|
lhs, right, rightHasPrecedingStatements, parent) {
|
|
@@ -82,14 +85,12 @@ lhs, right, rightHasPrecedingStatements, parent) {
|
|
|
82
85
|
}),
|
|
83
86
|
];
|
|
84
87
|
}
|
|
85
|
-
exports.transformAssignment = transformAssignment;
|
|
86
88
|
function transformAssignmentWithRightPrecedingStatements(context, lhs, right, rightPrecedingStatements, parent) {
|
|
87
89
|
return [
|
|
88
90
|
...rightPrecedingStatements,
|
|
89
91
|
...transformAssignment(context, lhs, right, rightPrecedingStatements.length > 0, parent),
|
|
90
92
|
];
|
|
91
93
|
}
|
|
92
|
-
exports.transformAssignmentWithRightPrecedingStatements = transformAssignmentWithRightPrecedingStatements;
|
|
93
94
|
function transformDestructuredAssignmentExpression(context, expression) {
|
|
94
95
|
let { precedingStatements: rightPrecedingStatements, result: right } = (0, preceding_statements_1.transformInPrecedingStatementScope)(context, () => context.transformExpression(expression.right));
|
|
95
96
|
context.addPrecedingStatements(rightPrecedingStatements);
|
|
@@ -131,7 +132,6 @@ function transformAssignmentExpression(context, expression) {
|
|
|
131
132
|
return left;
|
|
132
133
|
}
|
|
133
134
|
}
|
|
134
|
-
exports.transformAssignmentExpression = transformAssignmentExpression;
|
|
135
135
|
const canBeTransformedToLuaAssignmentStatement = (context, node) => ts.isArrayLiteralExpression(node.left) &&
|
|
136
136
|
node.left.elements.every(element => {
|
|
137
137
|
if ((0, destructuring_assignments_1.isArrayLength)(context, element)) {
|
|
@@ -179,5 +179,4 @@ function transformAssignmentStatement(context, expression) {
|
|
|
179
179
|
return transformAssignmentWithRightPrecedingStatements(context, expression.left, right, precedingStatements);
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
|
-
exports.transformAssignmentStatement = transformAssignmentStatement;
|
|
183
182
|
//# sourceMappingURL=assignments.js.map
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.isBitOperator = void 0;
|
|
4
|
+
exports.transformBinaryBitOperation = transformBinaryBitOperation;
|
|
5
|
+
exports.transformUnaryBitOperation = transformUnaryBitOperation;
|
|
4
6
|
const ts = require("typescript");
|
|
5
7
|
const CompilerOptions_1 = require("../../../CompilerOptions");
|
|
6
8
|
const lua = require("../../../LuaAST");
|
|
@@ -53,7 +55,6 @@ function transformBinaryBitOperation(context, node, left, right, operator) {
|
|
|
53
55
|
return lua.createBinaryExpression(left, right, luaOperator, node);
|
|
54
56
|
}
|
|
55
57
|
}
|
|
56
|
-
exports.transformBinaryBitOperation = transformBinaryBitOperation;
|
|
57
58
|
function transformUnaryBitLibOperation(node, expression, operator, lib) {
|
|
58
59
|
let bitFunction;
|
|
59
60
|
switch (operator) {
|
|
@@ -80,5 +81,4 @@ function transformUnaryBitOperation(context, node, expression, operator) {
|
|
|
80
81
|
return lua.createUnaryExpression(expression, operator, node);
|
|
81
82
|
}
|
|
82
83
|
}
|
|
83
|
-
exports.transformUnaryBitOperation = transformUnaryBitOperation;
|
|
84
84
|
//# sourceMappingURL=bit.js.map
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.unwrapCompoundAssignmentToken = exports.isCompoundAssignmentToken = void 0;
|
|
4
|
+
exports.transformCompoundAssignmentExpression = transformCompoundAssignmentExpression;
|
|
5
|
+
exports.transformCompoundAssignmentStatement = transformCompoundAssignmentStatement;
|
|
4
6
|
const ts = require("typescript");
|
|
5
7
|
const lua = require("../../../LuaAST");
|
|
6
8
|
const utils_1 = require("../../../utils");
|
|
@@ -127,7 +129,6 @@ lhs, rhs, operator, isPostfix) {
|
|
|
127
129
|
context.addPrecedingStatements(precedingStatements);
|
|
128
130
|
return result;
|
|
129
131
|
}
|
|
130
|
-
exports.transformCompoundAssignmentExpression = transformCompoundAssignmentExpression;
|
|
131
132
|
function transformCompoundAssignmentStatement(context, node, lhs, rhs, operator) {
|
|
132
133
|
if ((0, destructuring_assignments_1.isArrayLength)(context, lhs)) {
|
|
133
134
|
const { precedingStatements, result: lengthSetterStatement } = transformCompoundLengthSetter(context, node, lhs, rhs, operator);
|
|
@@ -167,7 +168,6 @@ function transformCompoundAssignmentStatement(context, node, lhs, rhs, operator)
|
|
|
167
168
|
return (0, assignments_1.transformAssignmentWithRightPrecedingStatements)(context, lhs, operatorExpression, rightPrecedingStatements2);
|
|
168
169
|
}
|
|
169
170
|
}
|
|
170
|
-
exports.transformCompoundAssignmentStatement = transformCompoundAssignmentStatement;
|
|
171
171
|
function isSetterSkippingCompoundAssignmentOperator(operator) {
|
|
172
172
|
return (operator === ts.SyntaxKind.AmpersandAmpersandToken ||
|
|
173
173
|
operator === ts.SyntaxKind.BarBarToken ||
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.isArrayLength = isArrayLength;
|
|
4
|
+
exports.transformDestructuringAssignment = transformDestructuringAssignment;
|
|
5
|
+
exports.transformAssignmentPattern = transformAssignmentPattern;
|
|
4
6
|
const ts = require("typescript");
|
|
5
7
|
const _1 = require(".");
|
|
6
8
|
const lua = require("../../../LuaAST");
|
|
@@ -26,11 +28,9 @@ function isArrayLength(context, expression) {
|
|
|
26
28
|
: undefined;
|
|
27
29
|
return name === "length";
|
|
28
30
|
}
|
|
29
|
-
exports.isArrayLength = isArrayLength;
|
|
30
31
|
function transformDestructuringAssignment(context, node, root, rightHasPrecedingStatements) {
|
|
31
32
|
return transformAssignmentPattern(context, node.left, root, rightHasPrecedingStatements);
|
|
32
33
|
}
|
|
33
|
-
exports.transformDestructuringAssignment = transformDestructuringAssignment;
|
|
34
34
|
function transformAssignmentPattern(context, node, root, rightHasPrecedingStatements) {
|
|
35
35
|
switch (node.kind) {
|
|
36
36
|
case ts.SyntaxKind.ObjectLiteralExpression:
|
|
@@ -39,7 +39,6 @@ function transformAssignmentPattern(context, node, root, rightHasPrecedingStatem
|
|
|
39
39
|
return transformArrayLiteralAssignmentPattern(context, node, root, rightHasPrecedingStatements);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
exports.transformAssignmentPattern = transformAssignmentPattern;
|
|
43
42
|
function transformArrayLiteralAssignmentPattern(context, node, root, rightHasPrecedingStatements) {
|
|
44
43
|
return node.elements.flatMap((element, index) => {
|
|
45
44
|
const indexedRoot = lua.createTableIndexExpression(root, lua.createNumericLiteral(index + 1), element);
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.transformBinaryExpression = void 0;
|
|
4
|
+
exports.createShortCircuitBinaryExpressionPrecedingStatements = createShortCircuitBinaryExpressionPrecedingStatements;
|
|
5
|
+
exports.transformBinaryOperation = transformBinaryOperation;
|
|
6
|
+
exports.transformBinaryExpressionStatement = transformBinaryExpressionStatement;
|
|
4
7
|
const ts = require("typescript");
|
|
5
8
|
const CompilerOptions_1 = require("../../../CompilerOptions");
|
|
6
9
|
const lua = require("../../../LuaAST");
|
|
@@ -80,7 +83,6 @@ function createShortCircuitBinaryExpressionPrecedingStatements(context, lhs, rhs
|
|
|
80
83
|
const ifStatement = lua.createIfStatement(condition, lua.createBlock([...rightPrecedingStatements, lua.createAssignmentStatement(conditionIdentifier, rhs)]), undefined, node === null || node === void 0 ? void 0 : node.left);
|
|
81
84
|
return { precedingStatements: [assignmentStatement, ifStatement], result: conditionIdentifier };
|
|
82
85
|
}
|
|
83
|
-
exports.createShortCircuitBinaryExpressionPrecedingStatements = createShortCircuitBinaryExpressionPrecedingStatements;
|
|
84
86
|
function transformShortCircuitBinaryExpression(context, node, operator) {
|
|
85
87
|
const lhs = context.transformExpression(node.left);
|
|
86
88
|
const { precedingStatements, result } = (0, preceding_statements_1.transformInPrecedingStatementScope)(context, () => context.transformExpression(node.right));
|
|
@@ -96,7 +98,6 @@ function transformBinaryOperation(context, left, right, rightPrecedingStatements
|
|
|
96
98
|
result: transformBinaryOperationWithNoPrecedingStatements(context, left, right, operator, node),
|
|
97
99
|
};
|
|
98
100
|
}
|
|
99
|
-
exports.transformBinaryOperation = transformBinaryOperation;
|
|
100
101
|
const transformBinaryExpression = (node, context) => {
|
|
101
102
|
const operator = node.operatorToken.kind;
|
|
102
103
|
const typeOfResult = (0, typeof_1.transformTypeOfBinaryExpression)(context, node);
|
|
@@ -167,7 +168,6 @@ function transformBinaryExpressionStatement(context, node) {
|
|
|
167
168
|
return lua.createDoStatement(statements, expression);
|
|
168
169
|
}
|
|
169
170
|
}
|
|
170
|
-
exports.transformBinaryExpressionStatement = transformBinaryExpressionStatement;
|
|
171
171
|
function transformNullishCoalescingOperationNoPrecedingStatements(context, node, transformedLeft, transformedRight) {
|
|
172
172
|
const lhsType = context.checker.getTypeAtLocation(node.left);
|
|
173
173
|
// Check if we can take a shortcut to 'lhs or rhs' if the left-hand side cannot be 'false'.
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.transformBlock =
|
|
3
|
+
exports.transformBlock = void 0;
|
|
4
|
+
exports.transformBlockOrStatement = transformBlockOrStatement;
|
|
5
|
+
exports.transformScopeBlock = transformScopeBlock;
|
|
4
6
|
const ts = require("typescript");
|
|
5
7
|
const lua = require("../../LuaAST");
|
|
6
8
|
const scope_1 = require("../utils/scope");
|
|
7
9
|
function transformBlockOrStatement(context, statement) {
|
|
8
10
|
return context.transformStatements(ts.isBlock(statement) ? statement.statements : statement);
|
|
9
11
|
}
|
|
10
|
-
exports.transformBlockOrStatement = transformBlockOrStatement;
|
|
11
12
|
function transformScopeBlock(context, node, scopeType) {
|
|
12
13
|
context.pushScope(scopeType);
|
|
13
14
|
const statements = (0, scope_1.performHoisting)(context, context.transformStatements(node.statements));
|
|
14
15
|
const scope = context.popScope();
|
|
15
16
|
return [lua.createBlock(statements, node), scope];
|
|
16
17
|
}
|
|
17
|
-
exports.transformScopeBlock = transformScopeBlock;
|
|
18
18
|
const transformBlock = (node, context) => {
|
|
19
19
|
context.pushScope(scope_1.ScopeType.Block);
|
|
20
20
|
const statements = (0, scope_1.performHoisting)(context, context.transformStatements(node.statements));
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.transformCallExpression = void 0;
|
|
4
|
+
exports.validateArguments = validateArguments;
|
|
5
|
+
exports.transformArguments = transformArguments;
|
|
6
|
+
exports.transformCallAndArguments = transformCallAndArguments;
|
|
7
|
+
exports.transformContextualCallExpression = transformContextualCallExpression;
|
|
8
|
+
exports.getCalledExpression = getCalledExpression;
|
|
4
9
|
const ts = require("typescript");
|
|
5
10
|
const lua = require("../../LuaAST");
|
|
6
11
|
const builtins_1 = require("../builtins");
|
|
@@ -31,12 +36,10 @@ function validateArguments(context, params, signature) {
|
|
|
31
36
|
}
|
|
32
37
|
}
|
|
33
38
|
}
|
|
34
|
-
exports.validateArguments = validateArguments;
|
|
35
39
|
function transformArguments(context, params, signature, callContext) {
|
|
36
40
|
validateArguments(context, params, signature);
|
|
37
41
|
return (0, expression_list_1.transformExpressionList)(context, callContext ? [callContext, ...params] : params);
|
|
38
42
|
}
|
|
39
|
-
exports.transformArguments = transformArguments;
|
|
40
43
|
function transformCallWithArguments(context, callExpression, transformedArguments, argPrecedingStatements, callContext) {
|
|
41
44
|
let call = context.transformExpression(callExpression);
|
|
42
45
|
let transformedContext;
|
|
@@ -59,7 +62,6 @@ function transformCallAndArguments(context, callExpression, params, signature, c
|
|
|
59
62
|
const { precedingStatements: argPrecedingStatements, result: transformedArguments } = (0, preceding_statements_1.transformInPrecedingStatementScope)(context, () => transformArguments(context, params, signature, callContext));
|
|
60
63
|
return transformCallWithArguments(context, callExpression, transformedArguments, argPrecedingStatements);
|
|
61
64
|
}
|
|
62
|
-
exports.transformCallAndArguments = transformCallAndArguments;
|
|
63
65
|
function transformElementAccessCall(context, left, transformedArguments, argPrecedingStatements) {
|
|
64
66
|
// Cache left-side if it has effects
|
|
65
67
|
// local ____self = context; return ____self[argument](parameters);
|
|
@@ -118,7 +120,6 @@ function transformContextualCallExpression(context, node, args) {
|
|
|
118
120
|
throw new Error(`Unsupported LeftHandSideExpression kind: ${ts.SyntaxKind[left.kind]}`);
|
|
119
121
|
}
|
|
120
122
|
}
|
|
121
|
-
exports.transformContextualCallExpression = transformContextualCallExpression;
|
|
122
123
|
function transformPropertyCall(context, node, calledMethod) {
|
|
123
124
|
const signature = context.checker.getResolvedSignature(node);
|
|
124
125
|
if (calledMethod.expression.kind === ts.SyntaxKind.SuperKeyword) {
|
|
@@ -203,5 +204,4 @@ exports.transformCallExpression = transformCallExpression;
|
|
|
203
204
|
function getCalledExpression(node) {
|
|
204
205
|
return ts.skipOuterExpressions(node.expression);
|
|
205
206
|
}
|
|
206
|
-
exports.getCalledExpression = getCalledExpression;
|
|
207
207
|
//# sourceMappingURL=call.js.map
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.transformDecoratorExpression = transformDecoratorExpression;
|
|
4
|
+
exports.createClassDecoratingExpression = createClassDecoratingExpression;
|
|
5
|
+
exports.createClassMethodDecoratingExpression = createClassMethodDecoratingExpression;
|
|
6
|
+
exports.createClassAccessorDecoratingExpression = createClassAccessorDecoratingExpression;
|
|
7
|
+
exports.createClassPropertyDecoratingExpression = createClassPropertyDecoratingExpression;
|
|
8
|
+
exports.createConstructorDecoratingExpression = createConstructorDecoratingExpression;
|
|
4
9
|
const ts = require("typescript");
|
|
5
10
|
const lua = require("../../../LuaAST");
|
|
6
11
|
const diagnostics_1 = require("../../utils/diagnostics");
|
|
@@ -19,7 +24,6 @@ function transformDecoratorExpression(context, decorator) {
|
|
|
19
24
|
}
|
|
20
25
|
return context.transformExpression(expression);
|
|
21
26
|
}
|
|
22
|
-
exports.transformDecoratorExpression = transformDecoratorExpression;
|
|
23
27
|
function createClassDecoratingExpression(context, classDeclaration, className) {
|
|
24
28
|
var _a, _b, _c, _d;
|
|
25
29
|
const classDecorators = (_b = (_a = ts.getDecorators(classDeclaration)) === null || _a === void 0 ? void 0 : _a.map(d => transformDecoratorExpression(context, d))) !== null && _b !== void 0 ? _b : [];
|
|
@@ -33,7 +37,6 @@ function createClassDecoratingExpression(context, classDeclaration, className) {
|
|
|
33
37
|
name: lua.createStringLiteral((_d = (_c = classDeclaration.name) === null || _c === void 0 ? void 0 : _c.getText()) !== null && _d !== void 0 ? _d : ""),
|
|
34
38
|
});
|
|
35
39
|
}
|
|
36
|
-
exports.createClassDecoratingExpression = createClassDecoratingExpression;
|
|
37
40
|
function createClassMethodDecoratingExpression(context, methodDeclaration, originalMethod, className) {
|
|
38
41
|
var _a, _b;
|
|
39
42
|
const parameterDecorators = getParameterDecorators(context, methodDeclaration);
|
|
@@ -52,7 +55,6 @@ function createClassMethodDecoratingExpression(context, methodDeclaration, origi
|
|
|
52
55
|
static: lua.createBooleanLiteral((0, utils_2.isStaticNode)(methodDeclaration)),
|
|
53
56
|
});
|
|
54
57
|
}
|
|
55
|
-
exports.createClassMethodDecoratingExpression = createClassMethodDecoratingExpression;
|
|
56
58
|
function createClassAccessorDecoratingExpression(context, accessor, originalAccessor, className) {
|
|
57
59
|
var _a, _b;
|
|
58
60
|
const accessorDecorators = (_b = (_a = ts.getDecorators(accessor)) === null || _a === void 0 ? void 0 : _a.map(d => transformDecoratorExpression(context, d))) !== null && _b !== void 0 ? _b : [];
|
|
@@ -70,7 +72,6 @@ function createClassAccessorDecoratingExpression(context, accessor, originalAcce
|
|
|
70
72
|
static: lua.createBooleanLiteral((0, utils_2.isStaticNode)(accessor)),
|
|
71
73
|
});
|
|
72
74
|
}
|
|
73
|
-
exports.createClassAccessorDecoratingExpression = createClassAccessorDecoratingExpression;
|
|
74
75
|
function createClassPropertyDecoratingExpression(context, property, className) {
|
|
75
76
|
var _a;
|
|
76
77
|
const decorators = (_a = ts.getDecorators(property)) !== null && _a !== void 0 ? _a : [];
|
|
@@ -98,7 +99,6 @@ function createClassPropertyDecoratingExpression(context, property, className) {
|
|
|
98
99
|
static: lua.createBooleanLiteral((0, utils_2.isStaticNode)(property)),
|
|
99
100
|
});
|
|
100
101
|
}
|
|
101
|
-
exports.createClassPropertyDecoratingExpression = createClassPropertyDecoratingExpression;
|
|
102
102
|
function createDecoratingExpression(context, className, originalValue, decorators, decoratorContext) {
|
|
103
103
|
const decoratorTable = lua.createTableExpression(decorators.map(d => lua.createTableFieldExpression(d)));
|
|
104
104
|
const decoratorContextTable = objectToLuaTableLiteral(decoratorContext);
|
|
@@ -136,5 +136,4 @@ function createConstructorDecoratingExpression(context, node, className) {
|
|
|
136
136
|
return lua.createExpressionStatement(decorateMethod);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
exports.createConstructorDecoratingExpression = createConstructorDecoratingExpression;
|
|
140
139
|
//# sourceMappingURL=decorators.js.map
|