typescript-to-lua 1.4.2 → 1.5.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.d.ts +5 -1
- package/dist/LuaAST.d.ts +9 -7
- package/dist/LuaAST.js +19 -13
- package/dist/LuaLib.d.ts +1 -2
- package/dist/LuaLib.js +1 -2
- package/dist/LuaPrinter.js +1 -2
- package/dist/cli/parse.js +10 -0
- package/dist/lualib/ArrayConcat.lua +16 -12
- package/dist/lualib/ArrayEvery.lua +4 -8
- package/dist/lualib/ArrayFilter.lua +6 -8
- package/dist/lualib/ArrayFind.lua +4 -7
- package/dist/lualib/ArrayFindIndex.lua +4 -9
- package/dist/lualib/ArrayFlat.lua +17 -7
- package/dist/lualib/ArrayFlatMap.lua +11 -10
- package/dist/lualib/ArrayForEach.lua +3 -7
- package/dist/lualib/ArrayFrom.lua +2 -5
- package/dist/lualib/ArrayIncludes.lua +2 -2
- package/dist/lualib/ArrayIndexOf.lua +13 -21
- package/dist/lualib/ArrayIsArray.lua +1 -1
- package/dist/lualib/ArrayJoin.lua +4 -7
- package/dist/lualib/ArrayMap.lua +5 -9
- package/dist/lualib/ArrayPush.lua +6 -4
- package/dist/lualib/ArrayPushArray.lua +8 -0
- package/dist/lualib/ArrayReduce.lua +8 -8
- package/dist/lualib/ArrayReduceRight.lua +8 -8
- package/dist/lualib/ArrayReverse.lua +7 -7
- package/dist/lualib/ArraySetLength.lua +3 -7
- package/dist/lualib/ArraySlice.lua +26 -19
- package/dist/lualib/ArraySome.lua +4 -8
- package/dist/lualib/ArraySort.lua +4 -4
- package/dist/lualib/ArraySplice.lua +47 -58
- package/dist/lualib/ArrayToObject.lua +3 -7
- package/dist/lualib/ArrayUnshift.lua +11 -8
- package/dist/lualib/Await.lua +21 -34
- package/dist/lualib/FunctionBind.lua +5 -11
- package/dist/lualib/ObjectAssign.lua +5 -7
- package/dist/lualib/ObjectEntries.lua +3 -1
- package/dist/lualib/ObjectKeys.lua +3 -1
- package/dist/lualib/ObjectValues.lua +3 -1
- package/dist/lualib/Promise.lua +8 -7
- package/dist/lualib/PromiseAny.lua +3 -3
- package/dist/lualib/PromiseRace.lua +1 -1
- package/dist/lualib/SourceMapTraceBack.lua +14 -1
- package/dist/lualib/Spread.lua +5 -7
- package/dist/lualib/StringReplace.lua +17 -14
- package/dist/lualib/StringReplaceAll.lua +36 -29
- package/dist/lualib/StringSplit.lua +32 -32
- package/dist/lualib/lualib_bundle.lua +393 -423
- package/dist/lualib/lualib_module_info.json +13 -23
- package/dist/transformation/builtins/array.d.ts +2 -3
- package/dist/transformation/builtins/array.js +43 -12
- package/dist/transformation/builtins/console.d.ts +2 -2
- package/dist/transformation/builtins/console.js +8 -9
- package/dist/transformation/builtins/function.d.ts +1 -2
- package/dist/transformation/builtins/function.js +5 -6
- package/dist/transformation/builtins/index.js +22 -23
- package/dist/transformation/builtins/math.d.ts +1 -2
- package/dist/transformation/builtins/math.js +3 -4
- package/dist/transformation/builtins/number.d.ts +3 -3
- package/dist/transformation/builtins/number.js +10 -12
- package/dist/transformation/builtins/object.d.ts +2 -3
- package/dist/transformation/builtins/object.js +16 -17
- package/dist/transformation/builtins/promise.d.ts +2 -2
- package/dist/transformation/builtins/promise.js +7 -7
- package/dist/transformation/builtins/string.d.ts +2 -3
- package/dist/transformation/builtins/string.js +8 -10
- package/dist/transformation/builtins/symbol.d.ts +2 -2
- package/dist/transformation/builtins/symbol.js +6 -7
- package/dist/transformation/utils/diagnostics.d.ts +7 -2
- package/dist/transformation/utils/diagnostics.js +4 -1
- package/dist/transformation/utils/lua-ast.d.ts +1 -0
- package/dist/transformation/utils/lua-ast.js +89 -3
- package/dist/transformation/utils/typescript/index.d.ts +1 -0
- package/dist/transformation/utils/typescript/index.js +9 -1
- package/dist/transformation/visitors/async-await.d.ts +1 -1
- package/dist/transformation/visitors/async-await.js +7 -14
- package/dist/transformation/visitors/call.d.ts +1 -3
- package/dist/transformation/visitors/call.js +26 -13
- package/dist/transformation/visitors/class/index.js +1 -1
- package/dist/transformation/visitors/class/members/accessors.js +1 -1
- package/dist/transformation/visitors/class/members/constructor.js +1 -1
- package/dist/transformation/visitors/errors.js +52 -9
- package/dist/transformation/visitors/function.js +5 -5
- package/dist/transformation/visitors/modules/import.d.ts +1 -0
- package/dist/transformation/visitors/modules/import.js +9 -1
- package/dist/transformation/visitors/return.js +5 -4
- package/dist/transformation/visitors/spread.js +1 -7
- package/package.json +1 -1
- package/dist/lualib/ArrayShift.lua +0 -3
- package/dist/lualib/StringConcat.lua +0 -8
|
@@ -45,7 +45,6 @@
|
|
|
45
45
|
"__TS__ArrayFrom"
|
|
46
46
|
],
|
|
47
47
|
"dependencies": [
|
|
48
|
-
"ArrayPush",
|
|
49
48
|
"Iterator"
|
|
50
49
|
]
|
|
51
50
|
},
|
|
@@ -79,6 +78,11 @@
|
|
|
79
78
|
"__TS__ArrayPush"
|
|
80
79
|
]
|
|
81
80
|
},
|
|
81
|
+
"ArrayPushArray": {
|
|
82
|
+
"exports": [
|
|
83
|
+
"__TS__ArrayPushArray"
|
|
84
|
+
]
|
|
85
|
+
},
|
|
82
86
|
"ArrayReduce": {
|
|
83
87
|
"exports": [
|
|
84
88
|
"__TS__ArrayReduce"
|
|
@@ -94,11 +98,6 @@
|
|
|
94
98
|
"__TS__ArrayReverse"
|
|
95
99
|
]
|
|
96
100
|
},
|
|
97
|
-
"ArrayShift": {
|
|
98
|
-
"exports": [
|
|
99
|
-
"__TS__ArrayShift"
|
|
100
|
-
]
|
|
101
|
-
},
|
|
102
101
|
"ArrayUnshift": {
|
|
103
102
|
"exports": [
|
|
104
103
|
"__TS__ArrayUnshift"
|
|
@@ -135,7 +134,7 @@
|
|
|
135
134
|
],
|
|
136
135
|
"dependencies": [
|
|
137
136
|
"ArrayIsArray",
|
|
138
|
-
"
|
|
137
|
+
"ArrayFlat"
|
|
139
138
|
]
|
|
140
139
|
},
|
|
141
140
|
"ArrayFlatMap": {
|
|
@@ -143,8 +142,7 @@
|
|
|
143
142
|
"__TS__ArrayFlatMap"
|
|
144
143
|
],
|
|
145
144
|
"dependencies": [
|
|
146
|
-
"ArrayIsArray"
|
|
147
|
-
"ArrayConcat"
|
|
145
|
+
"ArrayIsArray"
|
|
148
146
|
]
|
|
149
147
|
},
|
|
150
148
|
"ArraySetLength": {
|
|
@@ -233,7 +231,8 @@
|
|
|
233
231
|
"__TS__FunctionBind"
|
|
234
232
|
],
|
|
235
233
|
"dependencies": [
|
|
236
|
-
"Unpack"
|
|
234
|
+
"Unpack",
|
|
235
|
+
"ArrayUnshift"
|
|
237
236
|
]
|
|
238
237
|
},
|
|
239
238
|
"Generator": {
|
|
@@ -390,8 +389,7 @@
|
|
|
390
389
|
"New",
|
|
391
390
|
"InstanceOf",
|
|
392
391
|
"Class",
|
|
393
|
-
"FunctionBind"
|
|
394
|
-
"ArrayPush"
|
|
392
|
+
"FunctionBind"
|
|
395
393
|
]
|
|
396
394
|
},
|
|
397
395
|
"PromiseAll": {
|
|
@@ -423,7 +421,6 @@
|
|
|
423
421
|
"dependencies": [
|
|
424
422
|
"InstanceOf",
|
|
425
423
|
"Promise",
|
|
426
|
-
"ArrayPush",
|
|
427
424
|
"Iterator",
|
|
428
425
|
"New"
|
|
429
426
|
]
|
|
@@ -435,7 +432,6 @@
|
|
|
435
432
|
"dependencies": [
|
|
436
433
|
"InstanceOf",
|
|
437
434
|
"Promise",
|
|
438
|
-
"ArrayPush",
|
|
439
435
|
"Iterator",
|
|
440
436
|
"New"
|
|
441
437
|
]
|
|
@@ -521,11 +517,6 @@
|
|
|
521
517
|
"__TS__StringCharCodeAt"
|
|
522
518
|
]
|
|
523
519
|
},
|
|
524
|
-
"StringConcat": {
|
|
525
|
-
"exports": [
|
|
526
|
-
"__TS__StringConcat"
|
|
527
|
-
]
|
|
528
|
-
},
|
|
529
520
|
"StringEndsWith": {
|
|
530
521
|
"exports": [
|
|
531
522
|
"__TS__StringEndsWith"
|
|
@@ -554,6 +545,9 @@
|
|
|
554
545
|
"StringReplaceAll": {
|
|
555
546
|
"exports": [
|
|
556
547
|
"__TS__StringReplaceAll"
|
|
548
|
+
],
|
|
549
|
+
"dependencies": [
|
|
550
|
+
"StringSplit"
|
|
557
551
|
]
|
|
558
552
|
},
|
|
559
553
|
"StringSlice": {
|
|
@@ -564,10 +558,6 @@
|
|
|
564
558
|
"StringSplit": {
|
|
565
559
|
"exports": [
|
|
566
560
|
"__TS__StringSplit"
|
|
567
|
-
],
|
|
568
|
-
"dependencies": [
|
|
569
|
-
"StringAccess",
|
|
570
|
-
"StringSubstring"
|
|
571
561
|
]
|
|
572
562
|
},
|
|
573
563
|
"StringStartsWith": {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as ts from "typescript";
|
|
2
2
|
import * as lua from "../../LuaAST";
|
|
3
3
|
import { TransformationContext } from "../context";
|
|
4
|
-
|
|
5
|
-
export declare function
|
|
6
|
-
export declare function transformArrayPrototypeCall(context: TransformationContext, node: PropertyCallExpression): lua.CallExpression | undefined;
|
|
4
|
+
export declare function transformArrayConstructorCall(context: TransformationContext, node: ts.CallExpression, calledMethod: ts.PropertyAccessExpression): lua.Expression | undefined;
|
|
5
|
+
export declare function transformArrayPrototypeCall(context: TransformationContext, node: ts.CallExpression, calledMethod: ts.PropertyAccessExpression): lua.Expression | undefined;
|
|
7
6
|
export declare function transformArrayProperty(context: TransformationContext, node: ts.PropertyAccessExpression): lua.UnaryExpression | undefined;
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.transformArrayProperty = exports.transformArrayPrototypeCall = exports.transformArrayConstructorCall = void 0;
|
|
4
|
+
const ts = require("typescript");
|
|
4
5
|
const lua = require("../../LuaAST");
|
|
5
6
|
const diagnostics_1 = require("../utils/diagnostics");
|
|
6
7
|
const lualib_1 = require("../utils/lualib");
|
|
7
8
|
const call_1 = require("../visitors/call");
|
|
8
9
|
const typescript_1 = require("../utils/typescript");
|
|
10
|
+
const expression_list_1 = require("../visitors/expression-list");
|
|
9
11
|
const lua_ast_1 = require("../utils/lua-ast");
|
|
10
|
-
function transformArrayConstructorCall(context, node) {
|
|
11
|
-
const expression = node.expression;
|
|
12
|
+
function transformArrayConstructorCall(context, node, calledMethod) {
|
|
12
13
|
const signature = context.checker.getResolvedSignature(node);
|
|
13
14
|
const params = (0, call_1.transformArguments)(context, node.arguments, signature);
|
|
14
|
-
const expressionName =
|
|
15
|
+
const expressionName = calledMethod.name.text;
|
|
15
16
|
switch (expressionName) {
|
|
16
17
|
case "from":
|
|
17
18
|
return (0, lualib_1.transformLuaLibFunction)(context, lualib_1.LuaLibFeature.ArrayFrom, node, ...params);
|
|
@@ -20,26 +21,53 @@ function transformArrayConstructorCall(context, node) {
|
|
|
20
21
|
case "of":
|
|
21
22
|
return (0, lua_ast_1.wrapInTable)(...params);
|
|
22
23
|
default:
|
|
23
|
-
context.diagnostics.push((0, diagnostics_1.unsupportedProperty)(
|
|
24
|
+
context.diagnostics.push((0, diagnostics_1.unsupportedProperty)(calledMethod.name, "Array", expressionName));
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
27
|
exports.transformArrayConstructorCall = transformArrayConstructorCall;
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Optimized single element Array.push
|
|
30
|
+
*
|
|
31
|
+
* array[#array+1] = el
|
|
32
|
+
* return (#array + 1)
|
|
33
|
+
*/
|
|
34
|
+
function transformSingleElementArrayPush(context, node, caller, param) {
|
|
35
|
+
const expressionIsUsed = !ts.isExpressionStatement((0, typescript_1.findFirstNonOuterParent)(node));
|
|
36
|
+
const arrayIdentifier = lua.isIdentifier(caller) ? caller : (0, expression_list_1.moveToPrecedingTemp)(context, caller);
|
|
37
|
+
// #array + 1
|
|
38
|
+
let lengthExpression = lua.createBinaryExpression(lua.createUnaryExpression(arrayIdentifier, lua.SyntaxKind.LengthOperator), lua.createNumericLiteral(1), lua.SyntaxKind.AdditionOperator);
|
|
39
|
+
if (expressionIsUsed) {
|
|
40
|
+
// store length in a temp
|
|
41
|
+
lengthExpression = (0, expression_list_1.moveToPrecedingTemp)(context, lengthExpression);
|
|
42
|
+
}
|
|
43
|
+
const pushStatement = lua.createAssignmentStatement(lua.createTableIndexExpression(arrayIdentifier, lengthExpression), param, node);
|
|
44
|
+
context.addPrecedingStatements(pushStatement);
|
|
45
|
+
return expressionIsUsed ? lengthExpression : lua.createNilLiteral();
|
|
46
|
+
}
|
|
47
|
+
function transformArrayPrototypeCall(context, node, calledMethod) {
|
|
29
48
|
const signature = context.checker.getResolvedSignature(node);
|
|
30
|
-
const [caller, params] = (0, call_1.transformCallAndArguments)(context,
|
|
31
|
-
const expressionName =
|
|
49
|
+
const [caller, params] = (0, call_1.transformCallAndArguments)(context, calledMethod.expression, node.arguments, signature);
|
|
50
|
+
const expressionName = calledMethod.name.text;
|
|
32
51
|
switch (expressionName) {
|
|
33
52
|
case "concat":
|
|
34
53
|
return (0, lualib_1.transformLuaLibFunction)(context, lualib_1.LuaLibFeature.ArrayConcat, node, caller, ...params);
|
|
35
54
|
case "entries":
|
|
36
55
|
return (0, lualib_1.transformLuaLibFunction)(context, lualib_1.LuaLibFeature.ArrayEntries, node, caller);
|
|
37
56
|
case "push":
|
|
57
|
+
if (node.arguments.length === 1) {
|
|
58
|
+
const param = params[0];
|
|
59
|
+
if ((0, lua_ast_1.isUnpackCall)(param)) {
|
|
60
|
+
return (0, lualib_1.transformLuaLibFunction)(context, lualib_1.LuaLibFeature.ArrayPushArray, node, caller, param.params[0]);
|
|
61
|
+
}
|
|
62
|
+
if (!lua.isDotsLiteral(param)) {
|
|
63
|
+
return transformSingleElementArrayPush(context, node, caller, param);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
38
66
|
return (0, lualib_1.transformLuaLibFunction)(context, lualib_1.LuaLibFeature.ArrayPush, node, caller, ...params);
|
|
39
67
|
case "reverse":
|
|
40
68
|
return (0, lualib_1.transformLuaLibFunction)(context, lualib_1.LuaLibFeature.ArrayReverse, node, caller);
|
|
41
69
|
case "shift":
|
|
42
|
-
return (
|
|
70
|
+
return lua.createCallExpression(lua.createTableIndexExpression(lua.createIdentifier("table"), lua.createStringLiteral("remove")), [caller, lua.createNumericLiteral(1)], node);
|
|
43
71
|
case "unshift":
|
|
44
72
|
return (0, lualib_1.transformLuaLibFunction)(context, lualib_1.LuaLibFeature.ArrayUnshift, node, caller, ...params);
|
|
45
73
|
case "sort":
|
|
@@ -73,15 +101,18 @@ function transformArrayPrototypeCall(context, node) {
|
|
|
73
101
|
case "splice":
|
|
74
102
|
return (0, lualib_1.transformLuaLibFunction)(context, lualib_1.LuaLibFeature.ArraySplice, node, caller, ...params);
|
|
75
103
|
case "join":
|
|
76
|
-
const callerType = context.checker.getTypeAtLocation(
|
|
104
|
+
const callerType = context.checker.getTypeAtLocation(calledMethod.expression);
|
|
77
105
|
const elementType = context.checker.getElementTypeOfArrayType(callerType);
|
|
78
106
|
if (elementType && ((0, typescript_1.isStringType)(context, elementType) || (0, typescript_1.isNumberType)(context, elementType))) {
|
|
79
107
|
const defaultSeparatorLiteral = lua.createStringLiteral(",");
|
|
108
|
+
const param = params[0];
|
|
80
109
|
const parameters = [
|
|
81
110
|
caller,
|
|
82
111
|
node.arguments.length === 0
|
|
83
112
|
? defaultSeparatorLiteral
|
|
84
|
-
: lua.
|
|
113
|
+
: lua.isStringLiteral(param)
|
|
114
|
+
? param
|
|
115
|
+
: lua.createBinaryExpression(param, defaultSeparatorLiteral, lua.SyntaxKind.OrOperator),
|
|
85
116
|
];
|
|
86
117
|
return lua.createCallExpression(lua.createTableIndexExpression(lua.createIdentifier("table"), lua.createStringLiteral("concat")), parameters, node);
|
|
87
118
|
}
|
|
@@ -91,7 +122,7 @@ function transformArrayPrototypeCall(context, node) {
|
|
|
91
122
|
case "flatMap":
|
|
92
123
|
return (0, lualib_1.transformLuaLibFunction)(context, lualib_1.LuaLibFeature.ArrayFlatMap, node, caller, ...params);
|
|
93
124
|
default:
|
|
94
|
-
context.diagnostics.push((0, diagnostics_1.unsupportedProperty)(
|
|
125
|
+
context.diagnostics.push((0, diagnostics_1.unsupportedProperty)(calledMethod.name, "array", expressionName));
|
|
95
126
|
}
|
|
96
127
|
}
|
|
97
128
|
exports.transformArrayPrototypeCall = transformArrayPrototypeCall;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
+
import * as ts from "typescript";
|
|
1
2
|
import * as lua from "../../LuaAST";
|
|
2
3
|
import { TransformationContext } from "../context";
|
|
3
|
-
|
|
4
|
-
export declare function transformConsoleCall(context: TransformationContext, expression: PropertyCallExpression): lua.Expression | undefined;
|
|
4
|
+
export declare function transformConsoleCall(context: TransformationContext, node: ts.CallExpression, calledMethod: ts.PropertyAccessExpression): lua.Expression | undefined;
|
|
@@ -6,17 +6,16 @@ const lua = require("../../LuaAST");
|
|
|
6
6
|
const diagnostics_1 = require("../utils/diagnostics");
|
|
7
7
|
const call_1 = require("../visitors/call");
|
|
8
8
|
const isStringFormatTemplate = (node) => ts.isStringLiteral(node) && node.text.includes("%");
|
|
9
|
-
function transformConsoleCall(context,
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const parameters = (0, call_1.transformArguments)(context, expression.arguments, signature);
|
|
9
|
+
function transformConsoleCall(context, node, calledMethod) {
|
|
10
|
+
const methodName = calledMethod.name.text;
|
|
11
|
+
const signature = context.checker.getResolvedSignature(node);
|
|
12
|
+
const parameters = (0, call_1.transformArguments)(context, node.arguments, signature);
|
|
14
13
|
switch (methodName) {
|
|
15
14
|
case "error":
|
|
16
15
|
case "info":
|
|
17
16
|
case "log":
|
|
18
17
|
case "warn":
|
|
19
|
-
if (
|
|
18
|
+
if (node.arguments.length > 0 && isStringFormatTemplate(node.arguments[0])) {
|
|
20
19
|
// print(string.format([arguments]))
|
|
21
20
|
const stringFormatCall = lua.createCallExpression(lua.createTableIndexExpression(lua.createIdentifier("string"), lua.createStringLiteral("format")), parameters);
|
|
22
21
|
return lua.createCallExpression(lua.createIdentifier("print"), [stringFormatCall]);
|
|
@@ -24,7 +23,7 @@ function transformConsoleCall(context, expression) {
|
|
|
24
23
|
// print([arguments])
|
|
25
24
|
return lua.createCallExpression(lua.createIdentifier("print"), parameters);
|
|
26
25
|
case "assert":
|
|
27
|
-
if (
|
|
26
|
+
if (node.arguments.length > 1 && isStringFormatTemplate(node.arguments[1])) {
|
|
28
27
|
// assert([condition], string.format([arguments]))
|
|
29
28
|
const stringFormatCall = lua.createCallExpression(lua.createTableIndexExpression(lua.createIdentifier("string"), lua.createStringLiteral("format")), parameters.slice(1));
|
|
30
29
|
return lua.createCallExpression(lua.createIdentifier("assert"), [parameters[0], stringFormatCall]);
|
|
@@ -32,7 +31,7 @@ function transformConsoleCall(context, expression) {
|
|
|
32
31
|
// assert()
|
|
33
32
|
return lua.createCallExpression(lua.createIdentifier("assert"), parameters);
|
|
34
33
|
case "trace":
|
|
35
|
-
if (
|
|
34
|
+
if (node.arguments.length > 0 && isStringFormatTemplate(node.arguments[0])) {
|
|
36
35
|
// print(debug.traceback(string.format([arguments])))
|
|
37
36
|
const stringFormatCall = lua.createCallExpression(lua.createTableIndexExpression(lua.createIdentifier("string"), lua.createStringLiteral("format")), parameters);
|
|
38
37
|
const debugTracebackCall = lua.createCallExpression(lua.createTableIndexExpression(lua.createIdentifier("debug"), lua.createStringLiteral("traceback")), [stringFormatCall]);
|
|
@@ -42,7 +41,7 @@ function transformConsoleCall(context, expression) {
|
|
|
42
41
|
const debugTracebackCall = lua.createCallExpression(lua.createTableIndexExpression(lua.createIdentifier("debug"), lua.createStringLiteral("traceback")), parameters);
|
|
43
42
|
return lua.createCallExpression(lua.createIdentifier("print"), [debugTracebackCall]);
|
|
44
43
|
default:
|
|
45
|
-
context.diagnostics.push((0, diagnostics_1.unsupportedProperty)(
|
|
44
|
+
context.diagnostics.push((0, diagnostics_1.unsupportedProperty)(calledMethod.name, "console", methodName));
|
|
46
45
|
}
|
|
47
46
|
}
|
|
48
47
|
exports.transformConsoleCall = transformConsoleCall;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as ts from "typescript";
|
|
2
2
|
import * as lua from "../../LuaAST";
|
|
3
3
|
import { TransformationContext } from "../context";
|
|
4
|
-
|
|
5
|
-
export declare function transformFunctionPrototypeCall(context: TransformationContext, node: PropertyCallExpression): lua.CallExpression | undefined;
|
|
4
|
+
export declare function transformFunctionPrototypeCall(context: TransformationContext, node: ts.CallExpression, calledMethod: ts.PropertyAccessExpression): lua.CallExpression | undefined;
|
|
6
5
|
export declare function transformFunctionProperty(context: TransformationContext, node: ts.PropertyAccessExpression): lua.Expression | undefined;
|
|
@@ -8,15 +8,14 @@ const function_context_1 = require("../utils/function-context");
|
|
|
8
8
|
const lua_ast_1 = require("../utils/lua-ast");
|
|
9
9
|
const lualib_1 = require("../utils/lualib");
|
|
10
10
|
const call_1 = require("../visitors/call");
|
|
11
|
-
function transformFunctionPrototypeCall(context, node) {
|
|
12
|
-
const
|
|
13
|
-
const callerType = context.checker.getTypeAtLocation(expression.expression);
|
|
11
|
+
function transformFunctionPrototypeCall(context, node, calledMethod) {
|
|
12
|
+
const callerType = context.checker.getTypeAtLocation(calledMethod.expression);
|
|
14
13
|
if ((0, function_context_1.getFunctionContextType)(context, callerType) === function_context_1.ContextType.Void) {
|
|
15
14
|
context.diagnostics.push((0, diagnostics_1.unsupportedSelfFunctionConversion)(node));
|
|
16
15
|
}
|
|
17
16
|
const signature = context.checker.getResolvedSignature(node);
|
|
18
|
-
const [caller, params] = (0, call_1.transformCallAndArguments)(context,
|
|
19
|
-
const expressionName =
|
|
17
|
+
const [caller, params] = (0, call_1.transformCallAndArguments)(context, calledMethod.expression, node.arguments, signature);
|
|
18
|
+
const expressionName = calledMethod.name.text;
|
|
20
19
|
switch (expressionName) {
|
|
21
20
|
case "apply":
|
|
22
21
|
const nonContextArgs = params.length > 1 ? [(0, lua_ast_1.createUnpackCall)(context, params[1], node.arguments[1])] : [];
|
|
@@ -26,7 +25,7 @@ function transformFunctionPrototypeCall(context, node) {
|
|
|
26
25
|
case "call":
|
|
27
26
|
return lua.createCallExpression(caller, params, node);
|
|
28
27
|
case "toString":
|
|
29
|
-
context.diagnostics.push((0, diagnostics_1.unsupportedProperty)(
|
|
28
|
+
context.diagnostics.push((0, diagnostics_1.unsupportedProperty)(calledMethod.name, "function", expressionName));
|
|
30
29
|
}
|
|
31
30
|
}
|
|
32
31
|
exports.transformFunctionPrototypeCall = transformFunctionPrototypeCall;
|
|
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.checkForLuaLibType = exports.transformBuiltinIdentifierExpression = exports.transformBuiltinCallExpression = exports.transformBuiltinPropertyAccessExpression = void 0;
|
|
4
4
|
const ts = require("typescript");
|
|
5
5
|
const lua = require("../../LuaAST");
|
|
6
|
-
const utils_1 = require("../../utils");
|
|
7
6
|
const lua_ast_1 = require("../utils/lua-ast");
|
|
8
7
|
const lualib_1 = require("../utils/lualib");
|
|
9
8
|
const symbols_1 = require("../utils/symbols");
|
|
10
9
|
const typescript_1 = require("../utils/typescript");
|
|
10
|
+
const call_1 = require("../visitors/call");
|
|
11
11
|
const array_1 = require("./array");
|
|
12
12
|
const console_1 = require("./console");
|
|
13
13
|
const function_1 = require("./function");
|
|
@@ -55,80 +55,79 @@ function transformBuiltinCallExpression(context, node, isOptionalCall) {
|
|
|
55
55
|
return result;
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
const
|
|
59
|
-
if (!ts.isPropertyAccessExpression(
|
|
58
|
+
const calledMethod = ts.getOriginalNode((0, call_1.getCalledExpression)(node));
|
|
59
|
+
if (!ts.isPropertyAccessExpression(calledMethod)) {
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
|
-
const isOptionalAccess =
|
|
63
|
-
(0, utils_1.assume)(node);
|
|
62
|
+
const isOptionalAccess = calledMethod.questionDotToken;
|
|
64
63
|
// If the function being called is of type owner.func, get the type of owner
|
|
65
|
-
const ownerType = context.checker.getTypeAtLocation(
|
|
64
|
+
const ownerType = context.checker.getTypeAtLocation(calledMethod.expression);
|
|
66
65
|
if ((0, typescript_1.isStandardLibraryType)(context, ownerType, undefined)) {
|
|
67
66
|
const symbol = ownerType.getSymbol();
|
|
68
67
|
switch (symbol === null || symbol === void 0 ? void 0 : symbol.name) {
|
|
69
68
|
case "ArrayConstructor":
|
|
70
69
|
if (isOptionalCall || isOptionalAccess)
|
|
71
70
|
return unsupportedOptionalCall();
|
|
72
|
-
return (0, array_1.transformArrayConstructorCall)(context, node);
|
|
71
|
+
return (0, array_1.transformArrayConstructorCall)(context, node, calledMethod);
|
|
73
72
|
case "Console":
|
|
74
73
|
if (isOptionalCall || isOptionalAccess)
|
|
75
74
|
return unsupportedOptionalCall();
|
|
76
|
-
return (0, console_1.transformConsoleCall)(context, node);
|
|
75
|
+
return (0, console_1.transformConsoleCall)(context, node, calledMethod);
|
|
77
76
|
case "Math":
|
|
78
77
|
if (isOptionalCall || isOptionalAccess)
|
|
79
78
|
return unsupportedOptionalCall();
|
|
80
|
-
return (0, math_1.transformMathCall)(context, node);
|
|
79
|
+
return (0, math_1.transformMathCall)(context, node, calledMethod);
|
|
81
80
|
case "StringConstructor":
|
|
82
81
|
if (isOptionalCall || isOptionalAccess)
|
|
83
82
|
return unsupportedOptionalCall();
|
|
84
|
-
return (0, string_1.transformStringConstructorCall)(context, node);
|
|
83
|
+
return (0, string_1.transformStringConstructorCall)(context, node, calledMethod);
|
|
85
84
|
case "ObjectConstructor":
|
|
86
85
|
if (isOptionalCall || isOptionalAccess)
|
|
87
86
|
return unsupportedOptionalCall();
|
|
88
|
-
return (0, object_1.transformObjectConstructorCall)(context, node);
|
|
87
|
+
return (0, object_1.transformObjectConstructorCall)(context, node, calledMethod);
|
|
89
88
|
case "SymbolConstructor":
|
|
90
89
|
if (isOptionalCall || isOptionalAccess)
|
|
91
90
|
return unsupportedOptionalCall();
|
|
92
|
-
return (0, symbol_1.transformSymbolConstructorCall)(context, node);
|
|
91
|
+
return (0, symbol_1.transformSymbolConstructorCall)(context, node, calledMethod);
|
|
93
92
|
case "NumberConstructor":
|
|
94
93
|
if (isOptionalCall || isOptionalAccess)
|
|
95
94
|
return unsupportedOptionalCall();
|
|
96
|
-
return (0, number_1.transformNumberConstructorCall)(context, node);
|
|
95
|
+
return (0, number_1.transformNumberConstructorCall)(context, node, calledMethod);
|
|
97
96
|
case "PromiseConstructor":
|
|
98
97
|
if (isOptionalCall || isOptionalAccess)
|
|
99
98
|
return unsupportedOptionalCall();
|
|
100
|
-
return (0, promise_1.transformPromiseConstructorCall)(context, node);
|
|
99
|
+
return (0, promise_1.transformPromiseConstructorCall)(context, node, calledMethod);
|
|
101
100
|
}
|
|
102
101
|
}
|
|
103
102
|
const isStringFunction = (0, typescript_1.isStringType)(context, ownerType) ||
|
|
104
|
-
(
|
|
103
|
+
(calledMethod.questionDotToken && (0, typescript_1.isNullableType)(context, ownerType, typescript_1.isStringType));
|
|
105
104
|
if (isStringFunction && (0, typescript_1.hasStandardLibrarySignature)(context, node)) {
|
|
106
105
|
if (isOptionalCall)
|
|
107
106
|
return unsupportedOptionalCall();
|
|
108
|
-
return (0, string_1.transformStringPrototypeCall)(context, node);
|
|
107
|
+
return (0, string_1.transformStringPrototypeCall)(context, node, calledMethod);
|
|
109
108
|
}
|
|
110
109
|
const isNumberFunction = (0, typescript_1.isNumberType)(context, ownerType) ||
|
|
111
|
-
(
|
|
110
|
+
(calledMethod.questionDotToken && (0, typescript_1.isNullableType)(context, ownerType, typescript_1.isNumberType));
|
|
112
111
|
if (isNumberFunction && (0, typescript_1.hasStandardLibrarySignature)(context, node)) {
|
|
113
112
|
if (isOptionalCall)
|
|
114
113
|
return unsupportedOptionalCall();
|
|
115
|
-
return (0, number_1.transformNumberPrototypeCall)(context, node);
|
|
114
|
+
return (0, number_1.transformNumberPrototypeCall)(context, node, calledMethod);
|
|
116
115
|
}
|
|
117
116
|
const isArrayFunction = (0, typescript_1.isArrayType)(context, ownerType) ||
|
|
118
|
-
(
|
|
117
|
+
(calledMethod.questionDotToken && (0, typescript_1.isNullableType)(context, ownerType, typescript_1.isArrayType));
|
|
119
118
|
if (isArrayFunction && (0, typescript_1.hasStandardLibrarySignature)(context, node)) {
|
|
120
119
|
if (isOptionalCall)
|
|
121
120
|
return unsupportedOptionalCall();
|
|
122
|
-
return (0, array_1.transformArrayPrototypeCall)(context, node);
|
|
121
|
+
return (0, array_1.transformArrayPrototypeCall)(context, node, calledMethod);
|
|
123
122
|
}
|
|
124
123
|
const isFunctionFunction = (0, typescript_1.isFunctionType)(ownerType) ||
|
|
125
|
-
(
|
|
124
|
+
(calledMethod.questionDotToken && (0, typescript_1.isNullableType)(context, ownerType, (_, t) => (0, typescript_1.isFunctionType)(t)));
|
|
126
125
|
if (isFunctionFunction && (0, typescript_1.hasStandardLibrarySignature)(context, node)) {
|
|
127
126
|
if (isOptionalCall)
|
|
128
127
|
return unsupportedOptionalCall();
|
|
129
|
-
return (0, function_1.transformFunctionPrototypeCall)(context, node);
|
|
128
|
+
return (0, function_1.transformFunctionPrototypeCall)(context, node, calledMethod);
|
|
130
129
|
}
|
|
131
|
-
const objectResult = (0, object_1.transformObjectPrototypeCall)(context, node,
|
|
130
|
+
const objectResult = (0, object_1.transformObjectPrototypeCall)(context, node, calledMethod);
|
|
132
131
|
if (objectResult) {
|
|
133
132
|
if (isOptionalCall)
|
|
134
133
|
return unsupportedOptionalCall();
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as ts from "typescript";
|
|
2
2
|
import * as lua from "../../LuaAST";
|
|
3
3
|
import { TransformationContext } from "../context";
|
|
4
|
-
import { PropertyCallExpression } from "../visitors/call";
|
|
5
4
|
export declare function transformMathProperty(context: TransformationContext, node: ts.PropertyAccessExpression): lua.Expression | undefined;
|
|
6
|
-
export declare function transformMathCall(context: TransformationContext, node:
|
|
5
|
+
export declare function transformMathCall(context: TransformationContext, node: ts.CallExpression, calledMethod: ts.PropertyAccessExpression): lua.Expression | undefined;
|
|
@@ -26,12 +26,11 @@ function transformMathProperty(context, node) {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
exports.transformMathProperty = transformMathProperty;
|
|
29
|
-
function transformMathCall(context, node) {
|
|
30
|
-
const expression = node.expression;
|
|
29
|
+
function transformMathCall(context, node, calledMethod) {
|
|
31
30
|
const signature = context.checker.getResolvedSignature(node);
|
|
32
31
|
const params = (0, call_1.transformArguments)(context, node.arguments, signature);
|
|
33
32
|
const math = lua.createIdentifier("math");
|
|
34
|
-
const expressionName =
|
|
33
|
+
const expressionName = calledMethod.name.text;
|
|
35
34
|
switch (expressionName) {
|
|
36
35
|
// Lua 5.3: math.atan(y, x)
|
|
37
36
|
// Otherwise: math.atan2(y, x)
|
|
@@ -90,7 +89,7 @@ function transformMathCall(context, node) {
|
|
|
90
89
|
return lua.createCallExpression(lua.createTableIndexExpression(math, method), params, node);
|
|
91
90
|
}
|
|
92
91
|
default:
|
|
93
|
-
context.diagnostics.push((0, diagnostics_1.unsupportedProperty)(
|
|
92
|
+
context.diagnostics.push((0, diagnostics_1.unsupportedProperty)(calledMethod.name, "Math", expressionName));
|
|
94
93
|
}
|
|
95
94
|
}
|
|
96
95
|
exports.transformMathCall = transformMathCall;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import ts = require("typescript");
|
|
1
2
|
import * as lua from "../../LuaAST";
|
|
2
3
|
import { TransformationContext } from "../context";
|
|
3
|
-
|
|
4
|
-
export declare function
|
|
5
|
-
export declare function transformNumberConstructorCall(context: TransformationContext, expression: PropertyCallExpression): lua.CallExpression | undefined;
|
|
4
|
+
export declare function transformNumberPrototypeCall(context: TransformationContext, node: ts.CallExpression, calledMethod: ts.PropertyAccessExpression): lua.Expression | undefined;
|
|
5
|
+
export declare function transformNumberConstructorCall(context: TransformationContext, node: ts.CallExpression, calledMethod: ts.PropertyAccessExpression): lua.CallExpression | undefined;
|
|
@@ -5,33 +5,31 @@ const lua = require("../../LuaAST");
|
|
|
5
5
|
const diagnostics_1 = require("../utils/diagnostics");
|
|
6
6
|
const lualib_1 = require("../utils/lualib");
|
|
7
7
|
const call_1 = require("../visitors/call");
|
|
8
|
-
function transformNumberPrototypeCall(context, node) {
|
|
9
|
-
const expression = node.expression;
|
|
8
|
+
function transformNumberPrototypeCall(context, node, calledMethod) {
|
|
10
9
|
const signature = context.checker.getResolvedSignature(node);
|
|
11
10
|
const params = (0, call_1.transformArguments)(context, node.arguments, signature);
|
|
12
|
-
const caller = context.transformExpression(
|
|
13
|
-
const expressionName =
|
|
11
|
+
const caller = context.transformExpression(calledMethod.expression);
|
|
12
|
+
const expressionName = calledMethod.name.text;
|
|
14
13
|
switch (expressionName) {
|
|
15
14
|
case "toString":
|
|
16
15
|
return params.length === 0
|
|
17
16
|
? lua.createCallExpression(lua.createIdentifier("tostring"), [caller], node)
|
|
18
17
|
: (0, lualib_1.transformLuaLibFunction)(context, lualib_1.LuaLibFeature.NumberToString, node, caller, ...params);
|
|
19
18
|
default:
|
|
20
|
-
context.diagnostics.push((0, diagnostics_1.unsupportedProperty)(
|
|
19
|
+
context.diagnostics.push((0, diagnostics_1.unsupportedProperty)(calledMethod.name, "number", expressionName));
|
|
21
20
|
}
|
|
22
21
|
}
|
|
23
22
|
exports.transformNumberPrototypeCall = transformNumberPrototypeCall;
|
|
24
|
-
function transformNumberConstructorCall(context,
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const methodName = method.name.text;
|
|
23
|
+
function transformNumberConstructorCall(context, node, calledMethod) {
|
|
24
|
+
const parameters = (0, call_1.transformArguments)(context, node.arguments);
|
|
25
|
+
const methodName = calledMethod.name.text;
|
|
28
26
|
switch (methodName) {
|
|
29
27
|
case "isNaN":
|
|
30
|
-
return (0, lualib_1.transformLuaLibFunction)(context, lualib_1.LuaLibFeature.NumberIsNaN,
|
|
28
|
+
return (0, lualib_1.transformLuaLibFunction)(context, lualib_1.LuaLibFeature.NumberIsNaN, node, ...parameters);
|
|
31
29
|
case "isFinite":
|
|
32
|
-
return (0, lualib_1.transformLuaLibFunction)(context, lualib_1.LuaLibFeature.NumberIsFinite,
|
|
30
|
+
return (0, lualib_1.transformLuaLibFunction)(context, lualib_1.LuaLibFeature.NumberIsFinite, node, ...parameters);
|
|
33
31
|
default:
|
|
34
|
-
context.diagnostics.push((0, diagnostics_1.unsupportedProperty)(
|
|
32
|
+
context.diagnostics.push((0, diagnostics_1.unsupportedProperty)(calledMethod.name, "Number", methodName));
|
|
35
33
|
}
|
|
36
34
|
}
|
|
37
35
|
exports.transformNumberConstructorCall = transformNumberConstructorCall;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as lua from "../../LuaAST";
|
|
2
2
|
import * as ts from "typescript";
|
|
3
3
|
import { TransformationContext } from "../context";
|
|
4
|
-
|
|
5
|
-
export declare function
|
|
6
|
-
export declare function transformObjectPrototypeCall(context: TransformationContext, node: ts.CallExpression, expression: ts.PropertyAccessExpression): lua.Expression | undefined;
|
|
4
|
+
export declare function transformObjectConstructorCall(context: TransformationContext, node: ts.CallExpression, calledMethod: ts.PropertyAccessExpression): lua.Expression | undefined;
|
|
5
|
+
export declare function transformObjectPrototypeCall(context: TransformationContext, node: ts.CallExpression, calledMethod: ts.PropertyAccessExpression): lua.Expression | undefined;
|
|
@@ -5,41 +5,40 @@ const lua = require("../../LuaAST");
|
|
|
5
5
|
const diagnostics_1 = require("../utils/diagnostics");
|
|
6
6
|
const lualib_1 = require("../utils/lualib");
|
|
7
7
|
const call_1 = require("../visitors/call");
|
|
8
|
-
function transformObjectConstructorCall(context,
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const methodName = method.name.text;
|
|
8
|
+
function transformObjectConstructorCall(context, node, calledMethod) {
|
|
9
|
+
const args = (0, call_1.transformArguments)(context, node.arguments);
|
|
10
|
+
const methodName = calledMethod.name.text;
|
|
12
11
|
switch (methodName) {
|
|
13
12
|
case "assign":
|
|
14
|
-
return (0, lualib_1.transformLuaLibFunction)(context, lualib_1.LuaLibFeature.ObjectAssign,
|
|
13
|
+
return (0, lualib_1.transformLuaLibFunction)(context, lualib_1.LuaLibFeature.ObjectAssign, node, ...args);
|
|
15
14
|
case "defineProperty":
|
|
16
|
-
return (0, lualib_1.transformLuaLibFunction)(context, lualib_1.LuaLibFeature.ObjectDefineProperty,
|
|
15
|
+
return (0, lualib_1.transformLuaLibFunction)(context, lualib_1.LuaLibFeature.ObjectDefineProperty, node, ...args);
|
|
17
16
|
case "entries":
|
|
18
|
-
return (0, lualib_1.transformLuaLibFunction)(context, lualib_1.LuaLibFeature.ObjectEntries,
|
|
17
|
+
return (0, lualib_1.transformLuaLibFunction)(context, lualib_1.LuaLibFeature.ObjectEntries, node, ...args);
|
|
19
18
|
case "fromEntries":
|
|
20
|
-
return (0, lualib_1.transformLuaLibFunction)(context, lualib_1.LuaLibFeature.ObjectFromEntries,
|
|
19
|
+
return (0, lualib_1.transformLuaLibFunction)(context, lualib_1.LuaLibFeature.ObjectFromEntries, node, ...args);
|
|
21
20
|
case "getOwnPropertyDescriptor":
|
|
22
|
-
return (0, lualib_1.transformLuaLibFunction)(context, lualib_1.LuaLibFeature.ObjectGetOwnPropertyDescriptor,
|
|
21
|
+
return (0, lualib_1.transformLuaLibFunction)(context, lualib_1.LuaLibFeature.ObjectGetOwnPropertyDescriptor, node, ...args);
|
|
23
22
|
case "getOwnPropertyDescriptors":
|
|
24
|
-
return (0, lualib_1.transformLuaLibFunction)(context, lualib_1.LuaLibFeature.ObjectGetOwnPropertyDescriptors,
|
|
23
|
+
return (0, lualib_1.transformLuaLibFunction)(context, lualib_1.LuaLibFeature.ObjectGetOwnPropertyDescriptors, node, ...args);
|
|
25
24
|
case "keys":
|
|
26
|
-
return (0, lualib_1.transformLuaLibFunction)(context, lualib_1.LuaLibFeature.ObjectKeys,
|
|
25
|
+
return (0, lualib_1.transformLuaLibFunction)(context, lualib_1.LuaLibFeature.ObjectKeys, node, ...args);
|
|
27
26
|
case "values":
|
|
28
|
-
return (0, lualib_1.transformLuaLibFunction)(context, lualib_1.LuaLibFeature.ObjectValues,
|
|
27
|
+
return (0, lualib_1.transformLuaLibFunction)(context, lualib_1.LuaLibFeature.ObjectValues, node, ...args);
|
|
29
28
|
default:
|
|
30
|
-
context.diagnostics.push((0, diagnostics_1.unsupportedProperty)(
|
|
29
|
+
context.diagnostics.push((0, diagnostics_1.unsupportedProperty)(calledMethod.name, "Object", methodName));
|
|
31
30
|
}
|
|
32
31
|
}
|
|
33
32
|
exports.transformObjectConstructorCall = transformObjectConstructorCall;
|
|
34
|
-
function transformObjectPrototypeCall(context, node,
|
|
33
|
+
function transformObjectPrototypeCall(context, node, calledMethod) {
|
|
35
34
|
const signature = context.checker.getResolvedSignature(node);
|
|
36
|
-
const name =
|
|
35
|
+
const name = calledMethod.name.text;
|
|
37
36
|
switch (name) {
|
|
38
37
|
case "toString":
|
|
39
38
|
const toStringIdentifier = lua.createIdentifier("tostring");
|
|
40
|
-
return lua.createCallExpression(toStringIdentifier, [context.transformExpression(
|
|
39
|
+
return lua.createCallExpression(toStringIdentifier, [context.transformExpression(calledMethod.expression)], node);
|
|
41
40
|
case "hasOwnProperty":
|
|
42
|
-
const expr = context.transformExpression(
|
|
41
|
+
const expr = context.transformExpression(calledMethod.expression);
|
|
43
42
|
const parameters = (0, call_1.transformArguments)(context, node.arguments, signature);
|
|
44
43
|
const rawGetIdentifier = lua.createIdentifier("rawget");
|
|
45
44
|
const rawGetCall = lua.createCallExpression(rawGetIdentifier, [expr, ...parameters]);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as ts from "typescript";
|
|
2
2
|
import * as lua from "../../LuaAST";
|
|
3
3
|
import { TransformationContext } from "../context";
|
|
4
|
-
import { PropertyCallExpression } from "../visitors/call";
|
|
5
4
|
export declare function isPromiseClass(context: TransformationContext, node: ts.Identifier): boolean;
|
|
6
5
|
export declare function createPromiseIdentifier(original: ts.Node): lua.Identifier;
|
|
7
|
-
export declare function transformPromiseConstructorCall(context: TransformationContext, node:
|
|
6
|
+
export declare function transformPromiseConstructorCall(context: TransformationContext, node: ts.CallExpression, calledMethod: ts.PropertyAccessExpression): lua.Expression | undefined;
|
|
7
|
+
export declare function createStaticPromiseFunctionAccessor(functionName: string, node: ts.Node): lua.TableIndexExpression;
|