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
package/dist/cli/report.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.prepareDiagnosticForFormatting = void 0;
|
|
4
|
+
exports.createDiagnosticReporter = createDiagnosticReporter;
|
|
4
5
|
const ts = require("typescript");
|
|
5
6
|
const prepareDiagnosticForFormatting = (diagnostic) => diagnostic.source === "typescript-to-lua" ? { ...diagnostic, code: "TL" } : diagnostic;
|
|
6
7
|
exports.prepareDiagnosticForFormatting = prepareDiagnosticForFormatting;
|
|
@@ -8,5 +9,4 @@ function createDiagnosticReporter(pretty, system = ts.sys) {
|
|
|
8
9
|
const reporter = ts.createDiagnosticReporter(system, pretty);
|
|
9
10
|
return diagnostic => reporter((0, exports.prepareDiagnosticForFormatting)(diagnostic));
|
|
10
11
|
}
|
|
11
|
-
exports.createDiagnosticReporter = createDiagnosticReporter;
|
|
12
12
|
//# sourceMappingURL=report.js.map
|
package/dist/cli/tsconfig.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.locateConfigFile = locateConfigFile;
|
|
4
|
+
exports.parseConfigFileWithSystem = parseConfigFileWithSystem;
|
|
5
|
+
exports.createConfigFileUpdater = createConfigFileUpdater;
|
|
4
6
|
const path = require("path");
|
|
5
7
|
const ts = require("typescript");
|
|
6
8
|
const utils_1 = require("../utils");
|
|
@@ -36,7 +38,6 @@ function locateConfigFile(commandLine) {
|
|
|
36
38
|
return cliDiagnostics.theSpecifiedPathDoesNotExist(project);
|
|
37
39
|
}
|
|
38
40
|
}
|
|
39
|
-
exports.locateConfigFile = locateConfigFile;
|
|
40
41
|
function parseConfigFileWithSystem(configFileName, commandLineOptions, system = ts.sys) {
|
|
41
42
|
var _a;
|
|
42
43
|
const configRootDir = path.dirname(configFileName);
|
|
@@ -46,7 +47,6 @@ function parseConfigFileWithSystem(configFileName, commandLineOptions, system =
|
|
|
46
47
|
parsedConfigFile.raw.tstl = Object.assign(extendedTstlOptions, (_a = parsedConfigFile.raw.tstl) !== null && _a !== void 0 ? _a : {});
|
|
47
48
|
return (0, parse_1.updateParsedConfigFile)(parsedConfigFile);
|
|
48
49
|
}
|
|
49
|
-
exports.parseConfigFileWithSystem = parseConfigFileWithSystem;
|
|
50
50
|
function resolveNpmModuleConfig(moduleName, configRootDir, host) {
|
|
51
51
|
const resolved = ts.nodeNextJsonConfigResolver(moduleName, path.join(configRootDir, "tsconfig.json"), host);
|
|
52
52
|
if (resolved.resolvedModule) {
|
|
@@ -105,5 +105,4 @@ function createConfigFileUpdater(optionsToExtend) {
|
|
|
105
105
|
return parsedConfigFile.errors;
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
|
-
exports.createConfigFileUpdater = createConfigFileUpdater;
|
|
109
108
|
//# sourceMappingURL=tsconfig.js.map
|
package/dist/lualib/5.0/Set.lua
CHANGED
|
@@ -126,5 +126,63 @@ do
|
|
|
126
126
|
end
|
|
127
127
|
}
|
|
128
128
|
end
|
|
129
|
+
function Set.prototype.union(self, other)
|
|
130
|
+
local result = __TS__New(Set, self)
|
|
131
|
+
for ____, item in __TS__Iterator(other) do
|
|
132
|
+
result:add(item)
|
|
133
|
+
end
|
|
134
|
+
return result
|
|
135
|
+
end
|
|
136
|
+
function Set.prototype.intersection(self, other)
|
|
137
|
+
local result = __TS__New(Set)
|
|
138
|
+
for ____, item in __TS__Iterator(self) do
|
|
139
|
+
if other:has(item) then
|
|
140
|
+
result:add(item)
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
return result
|
|
144
|
+
end
|
|
145
|
+
function Set.prototype.difference(self, other)
|
|
146
|
+
local result = __TS__New(Set, self)
|
|
147
|
+
for ____, item in __TS__Iterator(other) do
|
|
148
|
+
result:delete(item)
|
|
149
|
+
end
|
|
150
|
+
return result
|
|
151
|
+
end
|
|
152
|
+
function Set.prototype.symmetricDifference(self, other)
|
|
153
|
+
local result = __TS__New(Set, self)
|
|
154
|
+
for ____, item in __TS__Iterator(other) do
|
|
155
|
+
if self:has(item) then
|
|
156
|
+
result:delete(item)
|
|
157
|
+
else
|
|
158
|
+
result:add(item)
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
return result
|
|
162
|
+
end
|
|
163
|
+
function Set.prototype.isSubsetOf(self, other)
|
|
164
|
+
for ____, item in __TS__Iterator(self) do
|
|
165
|
+
if not other:has(item) then
|
|
166
|
+
return false
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
return true
|
|
170
|
+
end
|
|
171
|
+
function Set.prototype.isSupersetOf(self, other)
|
|
172
|
+
for ____, item in __TS__Iterator(other) do
|
|
173
|
+
if not self:has(item) then
|
|
174
|
+
return false
|
|
175
|
+
end
|
|
176
|
+
end
|
|
177
|
+
return true
|
|
178
|
+
end
|
|
179
|
+
function Set.prototype.isDisjointFrom(self, other)
|
|
180
|
+
for ____, item in __TS__Iterator(self) do
|
|
181
|
+
if other:has(item) then
|
|
182
|
+
return false
|
|
183
|
+
end
|
|
184
|
+
end
|
|
185
|
+
return true
|
|
186
|
+
end
|
|
129
187
|
Set[Symbol.species] = Set
|
|
130
188
|
end
|
|
@@ -2096,6 +2096,64 @@ do
|
|
|
2096
2096
|
end
|
|
2097
2097
|
}
|
|
2098
2098
|
end
|
|
2099
|
+
function Set.prototype.union(self, other)
|
|
2100
|
+
local result = __TS__New(Set, self)
|
|
2101
|
+
for ____, item in __TS__Iterator(other) do
|
|
2102
|
+
result:add(item)
|
|
2103
|
+
end
|
|
2104
|
+
return result
|
|
2105
|
+
end
|
|
2106
|
+
function Set.prototype.intersection(self, other)
|
|
2107
|
+
local result = __TS__New(Set)
|
|
2108
|
+
for ____, item in __TS__Iterator(self) do
|
|
2109
|
+
if other:has(item) then
|
|
2110
|
+
result:add(item)
|
|
2111
|
+
end
|
|
2112
|
+
end
|
|
2113
|
+
return result
|
|
2114
|
+
end
|
|
2115
|
+
function Set.prototype.difference(self, other)
|
|
2116
|
+
local result = __TS__New(Set, self)
|
|
2117
|
+
for ____, item in __TS__Iterator(other) do
|
|
2118
|
+
result:delete(item)
|
|
2119
|
+
end
|
|
2120
|
+
return result
|
|
2121
|
+
end
|
|
2122
|
+
function Set.prototype.symmetricDifference(self, other)
|
|
2123
|
+
local result = __TS__New(Set, self)
|
|
2124
|
+
for ____, item in __TS__Iterator(other) do
|
|
2125
|
+
if self:has(item) then
|
|
2126
|
+
result:delete(item)
|
|
2127
|
+
else
|
|
2128
|
+
result:add(item)
|
|
2129
|
+
end
|
|
2130
|
+
end
|
|
2131
|
+
return result
|
|
2132
|
+
end
|
|
2133
|
+
function Set.prototype.isSubsetOf(self, other)
|
|
2134
|
+
for ____, item in __TS__Iterator(self) do
|
|
2135
|
+
if not other:has(item) then
|
|
2136
|
+
return false
|
|
2137
|
+
end
|
|
2138
|
+
end
|
|
2139
|
+
return true
|
|
2140
|
+
end
|
|
2141
|
+
function Set.prototype.isSupersetOf(self, other)
|
|
2142
|
+
for ____, item in __TS__Iterator(other) do
|
|
2143
|
+
if not self:has(item) then
|
|
2144
|
+
return false
|
|
2145
|
+
end
|
|
2146
|
+
end
|
|
2147
|
+
return true
|
|
2148
|
+
end
|
|
2149
|
+
function Set.prototype.isDisjointFrom(self, other)
|
|
2150
|
+
for ____, item in __TS__Iterator(self) do
|
|
2151
|
+
if other:has(item) then
|
|
2152
|
+
return false
|
|
2153
|
+
end
|
|
2154
|
+
end
|
|
2155
|
+
return true
|
|
2156
|
+
end
|
|
2099
2157
|
Set[Symbol.species] = Set
|
|
2100
2158
|
end
|
|
2101
2159
|
|
|
@@ -126,5 +126,63 @@ do
|
|
|
126
126
|
end
|
|
127
127
|
}
|
|
128
128
|
end
|
|
129
|
+
function Set.prototype.union(self, other)
|
|
130
|
+
local result = __TS__New(Set, self)
|
|
131
|
+
for ____, item in __TS__Iterator(other) do
|
|
132
|
+
result:add(item)
|
|
133
|
+
end
|
|
134
|
+
return result
|
|
135
|
+
end
|
|
136
|
+
function Set.prototype.intersection(self, other)
|
|
137
|
+
local result = __TS__New(Set)
|
|
138
|
+
for ____, item in __TS__Iterator(self) do
|
|
139
|
+
if other:has(item) then
|
|
140
|
+
result:add(item)
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
return result
|
|
144
|
+
end
|
|
145
|
+
function Set.prototype.difference(self, other)
|
|
146
|
+
local result = __TS__New(Set, self)
|
|
147
|
+
for ____, item in __TS__Iterator(other) do
|
|
148
|
+
result:delete(item)
|
|
149
|
+
end
|
|
150
|
+
return result
|
|
151
|
+
end
|
|
152
|
+
function Set.prototype.symmetricDifference(self, other)
|
|
153
|
+
local result = __TS__New(Set, self)
|
|
154
|
+
for ____, item in __TS__Iterator(other) do
|
|
155
|
+
if self:has(item) then
|
|
156
|
+
result:delete(item)
|
|
157
|
+
else
|
|
158
|
+
result:add(item)
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
return result
|
|
162
|
+
end
|
|
163
|
+
function Set.prototype.isSubsetOf(self, other)
|
|
164
|
+
for ____, item in __TS__Iterator(self) do
|
|
165
|
+
if not other:has(item) then
|
|
166
|
+
return false
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
return true
|
|
170
|
+
end
|
|
171
|
+
function Set.prototype.isSupersetOf(self, other)
|
|
172
|
+
for ____, item in __TS__Iterator(other) do
|
|
173
|
+
if not self:has(item) then
|
|
174
|
+
return false
|
|
175
|
+
end
|
|
176
|
+
end
|
|
177
|
+
return true
|
|
178
|
+
end
|
|
179
|
+
function Set.prototype.isDisjointFrom(self, other)
|
|
180
|
+
for ____, item in __TS__Iterator(self) do
|
|
181
|
+
if other:has(item) then
|
|
182
|
+
return false
|
|
183
|
+
end
|
|
184
|
+
end
|
|
185
|
+
return true
|
|
186
|
+
end
|
|
129
187
|
Set[Symbol.species] = Set
|
|
130
188
|
end
|
|
@@ -2027,6 +2027,64 @@ do
|
|
|
2027
2027
|
end
|
|
2028
2028
|
}
|
|
2029
2029
|
end
|
|
2030
|
+
function Set.prototype.union(self, other)
|
|
2031
|
+
local result = __TS__New(Set, self)
|
|
2032
|
+
for ____, item in __TS__Iterator(other) do
|
|
2033
|
+
result:add(item)
|
|
2034
|
+
end
|
|
2035
|
+
return result
|
|
2036
|
+
end
|
|
2037
|
+
function Set.prototype.intersection(self, other)
|
|
2038
|
+
local result = __TS__New(Set)
|
|
2039
|
+
for ____, item in __TS__Iterator(self) do
|
|
2040
|
+
if other:has(item) then
|
|
2041
|
+
result:add(item)
|
|
2042
|
+
end
|
|
2043
|
+
end
|
|
2044
|
+
return result
|
|
2045
|
+
end
|
|
2046
|
+
function Set.prototype.difference(self, other)
|
|
2047
|
+
local result = __TS__New(Set, self)
|
|
2048
|
+
for ____, item in __TS__Iterator(other) do
|
|
2049
|
+
result:delete(item)
|
|
2050
|
+
end
|
|
2051
|
+
return result
|
|
2052
|
+
end
|
|
2053
|
+
function Set.prototype.symmetricDifference(self, other)
|
|
2054
|
+
local result = __TS__New(Set, self)
|
|
2055
|
+
for ____, item in __TS__Iterator(other) do
|
|
2056
|
+
if self:has(item) then
|
|
2057
|
+
result:delete(item)
|
|
2058
|
+
else
|
|
2059
|
+
result:add(item)
|
|
2060
|
+
end
|
|
2061
|
+
end
|
|
2062
|
+
return result
|
|
2063
|
+
end
|
|
2064
|
+
function Set.prototype.isSubsetOf(self, other)
|
|
2065
|
+
for ____, item in __TS__Iterator(self) do
|
|
2066
|
+
if not other:has(item) then
|
|
2067
|
+
return false
|
|
2068
|
+
end
|
|
2069
|
+
end
|
|
2070
|
+
return true
|
|
2071
|
+
end
|
|
2072
|
+
function Set.prototype.isSupersetOf(self, other)
|
|
2073
|
+
for ____, item in __TS__Iterator(other) do
|
|
2074
|
+
if not self:has(item) then
|
|
2075
|
+
return false
|
|
2076
|
+
end
|
|
2077
|
+
end
|
|
2078
|
+
return true
|
|
2079
|
+
end
|
|
2080
|
+
function Set.prototype.isDisjointFrom(self, other)
|
|
2081
|
+
for ____, item in __TS__Iterator(self) do
|
|
2082
|
+
if other:has(item) then
|
|
2083
|
+
return false
|
|
2084
|
+
end
|
|
2085
|
+
end
|
|
2086
|
+
return true
|
|
2087
|
+
end
|
|
2030
2088
|
Set[Symbol.species] = Set
|
|
2031
2089
|
end
|
|
2032
2090
|
|
|
@@ -7,7 +7,7 @@ export declare const lualibDiagnostic: ((message: string, file?: ts.SourceFile |
|
|
|
7
7
|
};
|
|
8
8
|
declare class LuaLibPlugin implements tstl.Plugin {
|
|
9
9
|
visitors: {
|
|
10
|
-
|
|
10
|
+
307: (file: ts.SourceFile, context: tstl.TransformationContext) => tstl.File;
|
|
11
11
|
};
|
|
12
12
|
printer: tstl.Printer;
|
|
13
13
|
afterPrint(program: ts.Program, options: tstl.CompilerOptions, emitHost: EmitHost, result: ProcessedFile[]): ts.Diagnostic[];
|
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.isExportTableDeclaration = isExportTableDeclaration;
|
|
4
|
+
exports.isExportTable = isExportTable;
|
|
5
|
+
exports.isExportTableIndex = isExportTableIndex;
|
|
6
|
+
exports.isExportAlias = isExportAlias;
|
|
7
|
+
exports.isExportAssignment = isExportAssignment;
|
|
8
|
+
exports.isRequire = isRequire;
|
|
9
|
+
exports.isImport = isImport;
|
|
10
|
+
exports.isExportsReturn = isExportsReturn;
|
|
4
11
|
const tstl = require("..");
|
|
5
12
|
function isExportTableDeclaration(node) {
|
|
6
13
|
return tstl.isVariableDeclarationStatement(node) && isExportTable(node.left[0]);
|
|
7
14
|
}
|
|
8
|
-
exports.isExportTableDeclaration = isExportTableDeclaration;
|
|
9
15
|
function isExportTable(node) {
|
|
10
16
|
return tstl.isIdentifier(node) && node.text === "____exports";
|
|
11
17
|
}
|
|
12
|
-
exports.isExportTable = isExportTable;
|
|
13
18
|
function isExportTableIndex(node) {
|
|
14
19
|
return tstl.isTableIndexExpression(node) && isExportTable(node.table) && tstl.isStringLiteral(node.index);
|
|
15
20
|
}
|
|
16
|
-
exports.isExportTableIndex = isExportTableIndex;
|
|
17
21
|
function isExportAlias(node) {
|
|
18
22
|
return tstl.isVariableDeclarationStatement(node) && node.right !== undefined && isExportTableIndex(node.right[0]);
|
|
19
23
|
}
|
|
20
|
-
exports.isExportAlias = isExportAlias;
|
|
21
24
|
function isExportAssignment(node) {
|
|
22
25
|
return tstl.isAssignmentStatement(node) && isExportTableIndex(node.left[0]);
|
|
23
26
|
}
|
|
24
|
-
exports.isExportAssignment = isExportAssignment;
|
|
25
27
|
function isRequire(node) {
|
|
26
28
|
return (tstl.isVariableDeclarationStatement(node) &&
|
|
27
29
|
node.right &&
|
|
@@ -29,15 +31,12 @@ function isRequire(node) {
|
|
|
29
31
|
tstl.isIdentifier(node.right[0].expression) &&
|
|
30
32
|
node.right[0].expression.text === "require");
|
|
31
33
|
}
|
|
32
|
-
exports.isRequire = isRequire;
|
|
33
34
|
function isImport(node, importNames) {
|
|
34
35
|
return tstl.isVariableDeclarationStatement(node) && importNames.has(node.left[0].text);
|
|
35
36
|
}
|
|
36
|
-
exports.isImport = isImport;
|
|
37
37
|
function isExportsReturn(node) {
|
|
38
38
|
return (tstl.isReturnStatement(node) &&
|
|
39
39
|
tstl.isIdentifier(node.expressions[0]) &&
|
|
40
40
|
node.expressions[0].text === "____exports");
|
|
41
41
|
}
|
|
42
|
-
exports.isExportsReturn = isExportsReturn;
|
|
43
42
|
//# sourceMappingURL=util.js.map
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.startSection = startSection;
|
|
4
|
+
exports.endSection = endSection;
|
|
5
|
+
exports.isMeasurementEnabled = isMeasurementEnabled;
|
|
6
|
+
exports.enableMeasurement = enableMeasurement;
|
|
7
|
+
exports.disableMeasurement = disableMeasurement;
|
|
8
|
+
exports.forEachMeasure = forEachMeasure;
|
|
9
|
+
exports.getTotalDuration = getTotalDuration;
|
|
4
10
|
const perf_hooks_1 = require("perf_hooks");
|
|
5
11
|
// We use our own performance hooks implementation for easier use, but also call node's performance hooks, so it shows up in the profiler.
|
|
6
12
|
let enabled = false;
|
|
@@ -42,7 +48,6 @@ function measure(measureName, startMarkName, endMarkName) {
|
|
|
42
48
|
function startSection(name) {
|
|
43
49
|
mark("start " + name);
|
|
44
50
|
}
|
|
45
|
-
exports.startSection = startSection;
|
|
46
51
|
/**
|
|
47
52
|
* Ends a performance measurement section.
|
|
48
53
|
* @param name name of the measurement
|
|
@@ -51,17 +56,14 @@ function endSection(name) {
|
|
|
51
56
|
mark("end " + name);
|
|
52
57
|
measure(name, "start " + name, "end " + name);
|
|
53
58
|
}
|
|
54
|
-
exports.endSection = endSection;
|
|
55
59
|
function isMeasurementEnabled() {
|
|
56
60
|
return enabled;
|
|
57
61
|
}
|
|
58
|
-
exports.isMeasurementEnabled = isMeasurementEnabled;
|
|
59
62
|
function enableMeasurement() {
|
|
60
63
|
if (!enabled) {
|
|
61
64
|
enabled = true;
|
|
62
65
|
}
|
|
63
66
|
}
|
|
64
|
-
exports.enableMeasurement = enableMeasurement;
|
|
65
67
|
function disableMeasurement() {
|
|
66
68
|
if (enabled) {
|
|
67
69
|
enabled = false;
|
|
@@ -69,15 +71,12 @@ function disableMeasurement() {
|
|
|
69
71
|
durations.clear();
|
|
70
72
|
}
|
|
71
73
|
}
|
|
72
|
-
exports.disableMeasurement = disableMeasurement;
|
|
73
74
|
function forEachMeasure(callback) {
|
|
74
75
|
durations.forEach((duration, measureName) => callback(measureName, duration));
|
|
75
76
|
}
|
|
76
|
-
exports.forEachMeasure = forEachMeasure;
|
|
77
77
|
function getTotalDuration() {
|
|
78
78
|
let total = 0;
|
|
79
79
|
forEachMeasure((_, duration) => (total += duration));
|
|
80
80
|
return total;
|
|
81
81
|
}
|
|
82
|
-
exports.getTotalDuration = getTotalDuration;
|
|
83
82
|
//# sourceMappingURL=measure-performance.js.map
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.transformArrayConstructorCall = transformArrayConstructorCall;
|
|
4
|
+
exports.transformArrayPrototypeCall = transformArrayPrototypeCall;
|
|
5
|
+
exports.transformArrayProperty = transformArrayProperty;
|
|
4
6
|
const ts = require("typescript");
|
|
5
7
|
const CompilerOptions_1 = require("../../CompilerOptions");
|
|
6
8
|
const lua = require("../../LuaAST");
|
|
@@ -25,7 +27,6 @@ function transformArrayConstructorCall(context, node, calledMethod) {
|
|
|
25
27
|
context.diagnostics.push((0, diagnostics_1.unsupportedProperty)(calledMethod.name, "Array", expressionName));
|
|
26
28
|
}
|
|
27
29
|
}
|
|
28
|
-
exports.transformArrayConstructorCall = transformArrayConstructorCall;
|
|
29
30
|
function createTableLengthExpression(context, expression, node) {
|
|
30
31
|
if (context.luaTarget === CompilerOptions_1.LuaTarget.Lua50) {
|
|
31
32
|
const tableGetn = lua.createTableIndexExpression(lua.createIdentifier("table"), lua.createStringLiteral("getn"));
|
|
@@ -149,7 +150,6 @@ function transformArrayPrototypeCall(context, node, calledMethod) {
|
|
|
149
150
|
context.diagnostics.push((0, diagnostics_1.unsupportedProperty)(calledMethod.name, "array", expressionName));
|
|
150
151
|
}
|
|
151
152
|
}
|
|
152
|
-
exports.transformArrayPrototypeCall = transformArrayPrototypeCall;
|
|
153
153
|
function transformArrayProperty(context, node) {
|
|
154
154
|
switch (node.name.text) {
|
|
155
155
|
case "length":
|
|
@@ -159,5 +159,4 @@ function transformArrayProperty(context, node) {
|
|
|
159
159
|
return undefined;
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
|
-
exports.transformArrayProperty = transformArrayProperty;
|
|
163
162
|
//# sourceMappingURL=array.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.transformConsoleCall =
|
|
3
|
+
exports.transformConsoleCall = transformConsoleCall;
|
|
4
4
|
const ts = require("typescript");
|
|
5
5
|
const lua = require("../../LuaAST");
|
|
6
6
|
const diagnostics_1 = require("../utils/diagnostics");
|
|
@@ -44,5 +44,4 @@ function transformConsoleCall(context, node, calledMethod) {
|
|
|
44
44
|
context.diagnostics.push((0, diagnostics_1.unsupportedProperty)(calledMethod.name, "console", methodName));
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
exports.transformConsoleCall = transformConsoleCall;
|
|
48
47
|
//# sourceMappingURL=console.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.transformFunctionPrototypeCall = transformFunctionPrototypeCall;
|
|
4
|
+
exports.transformFunctionProperty = transformFunctionProperty;
|
|
4
5
|
const CompilerOptions_1 = require("../../CompilerOptions");
|
|
5
6
|
const lua = require("../../LuaAST");
|
|
6
7
|
const diagnostics_1 = require("../utils/diagnostics");
|
|
@@ -28,7 +29,6 @@ function transformFunctionPrototypeCall(context, node, calledMethod) {
|
|
|
28
29
|
context.diagnostics.push((0, diagnostics_1.unsupportedProperty)(calledMethod.name, "function", expressionName));
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
|
-
exports.transformFunctionPrototypeCall = transformFunctionPrototypeCall;
|
|
32
32
|
function transformFunctionProperty(context, node) {
|
|
33
33
|
switch (node.name.text) {
|
|
34
34
|
case "length":
|
|
@@ -51,5 +51,4 @@ function transformFunctionProperty(context, node) {
|
|
|
51
51
|
context.diagnostics.push((0, diagnostics_1.unsupportedProperty)(node.name, "function", node.name.text));
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
exports.transformFunctionProperty = transformFunctionProperty;
|
|
55
54
|
//# sourceMappingURL=function.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.tryTransformBuiltinGlobalCall =
|
|
3
|
+
exports.tryTransformBuiltinGlobalCall = tryTransformBuiltinGlobalCall;
|
|
4
4
|
const lualib_1 = require("../utils/lualib");
|
|
5
5
|
const typescript_1 = require("../utils/typescript");
|
|
6
6
|
const call_1 = require("../visitors/call");
|
|
@@ -27,5 +27,4 @@ function tryTransformBuiltinGlobalCall(context, node, expressionType) {
|
|
|
27
27
|
return (0, lualib_1.transformLuaLibFunction)(context, lualib_1.LuaLibFeature.ParseInt, node, ...getParameters());
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
exports.tryTransformBuiltinGlobalCall = tryTransformBuiltinGlobalCall;
|
|
31
30
|
//# sourceMappingURL=global.js.map
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.transformBuiltinPropertyAccessExpression = transformBuiltinPropertyAccessExpression;
|
|
4
|
+
exports.transformBuiltinCallExpression = transformBuiltinCallExpression;
|
|
5
|
+
exports.transformBuiltinIdentifierExpression = transformBuiltinIdentifierExpression;
|
|
6
|
+
exports.checkForLuaLibType = checkForLuaLibType;
|
|
4
7
|
const ts = require("typescript");
|
|
5
8
|
const lua = require("../../LuaAST");
|
|
6
9
|
const lua_ast_1 = require("../utils/lua-ast");
|
|
@@ -43,7 +46,6 @@ function transformBuiltinPropertyAccessExpression(context, node) {
|
|
|
43
46
|
return (0, function_1.transformFunctionProperty)(context, node);
|
|
44
47
|
}
|
|
45
48
|
}
|
|
46
|
-
exports.transformBuiltinPropertyAccessExpression = transformBuiltinPropertyAccessExpression;
|
|
47
49
|
function transformBuiltinCallExpression(context, node) {
|
|
48
50
|
const expressionType = context.checker.getTypeAtLocation(node.expression);
|
|
49
51
|
if (ts.isIdentifier(node.expression) && (0, typescript_1.isStandardLibraryType)(context, expressionType, undefined)) {
|
|
@@ -68,7 +70,6 @@ function transformBuiltinCallExpression(context, node) {
|
|
|
68
70
|
return objectResult;
|
|
69
71
|
}
|
|
70
72
|
}
|
|
71
|
-
exports.transformBuiltinCallExpression = transformBuiltinCallExpression;
|
|
72
73
|
function tryTransformBuiltinGlobalMethodCall(context, node, calledMethod) {
|
|
73
74
|
const ownerType = context.checker.getTypeAtLocation(calledMethod.expression);
|
|
74
75
|
const ownerSymbol = tryGetStandardLibrarySymbolOfType(context, ownerType);
|
|
@@ -151,7 +152,6 @@ function transformBuiltinIdentifierExpression(context, node, symbol) {
|
|
|
151
152
|
return lua.createIdentifier("_G", node, (0, symbols_1.getIdentifierSymbolId)(context, node, symbol), "globalThis");
|
|
152
153
|
}
|
|
153
154
|
}
|
|
154
|
-
exports.transformBuiltinIdentifierExpression = transformBuiltinIdentifierExpression;
|
|
155
155
|
const builtinErrorTypeNames = new Set([
|
|
156
156
|
"Error",
|
|
157
157
|
"ErrorConstructor",
|
|
@@ -197,7 +197,6 @@ function checkForLuaLibType(context, type) {
|
|
|
197
197
|
(0, lualib_1.importLuaLibFeature)(context, lualib_1.LuaLibFeature.Error);
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
|
-
exports.checkForLuaLibType = checkForLuaLibType;
|
|
201
200
|
function tryGetStandardLibrarySymbolOfType(context, type) {
|
|
202
201
|
if (type.isUnionOrIntersection()) {
|
|
203
202
|
for (const subType of type.types) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.transformMapConstructorCall =
|
|
3
|
+
exports.transformMapConstructorCall = transformMapConstructorCall;
|
|
4
4
|
const diagnostics_1 = require("../utils/diagnostics");
|
|
5
5
|
const call_1 = require("../visitors/call");
|
|
6
6
|
const lualib_1 = require("../utils/lualib");
|
|
@@ -14,5 +14,4 @@ function transformMapConstructorCall(context, node, calledMethod) {
|
|
|
14
14
|
context.diagnostics.push((0, diagnostics_1.unsupportedProperty)(calledMethod.name, "Map", methodName));
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
exports.transformMapConstructorCall = transformMapConstructorCall;
|
|
18
17
|
//# sourceMappingURL=map.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.transformMathProperty = transformMathProperty;
|
|
4
|
+
exports.transformMathCall = transformMathCall;
|
|
4
5
|
const CompilerOptions_1 = require("../../CompilerOptions");
|
|
5
6
|
const lua = require("../../LuaAST");
|
|
6
7
|
const diagnostics_1 = require("../utils/diagnostics");
|
|
@@ -25,7 +26,6 @@ function transformMathProperty(context, node) {
|
|
|
25
26
|
context.diagnostics.push((0, diagnostics_1.unsupportedProperty)(node.name, "Math", name));
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
|
-
exports.transformMathProperty = transformMathProperty;
|
|
29
29
|
function transformMathCall(context, node, calledMethod) {
|
|
30
30
|
var _a, _b, _c, _d;
|
|
31
31
|
const signature = context.checker.getResolvedSignature(node);
|
|
@@ -93,5 +93,4 @@ function transformMathCall(context, node, calledMethod) {
|
|
|
93
93
|
context.diagnostics.push((0, diagnostics_1.unsupportedProperty)(calledMethod.name, "Math", expressionName));
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
exports.transformMathCall = transformMathCall;
|
|
97
96
|
//# sourceMappingURL=math.js.map
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.transformNumberPrototypeCall = transformNumberPrototypeCall;
|
|
4
|
+
exports.transformNumberProperty = transformNumberProperty;
|
|
5
|
+
exports.transformNumberConstructorCall = transformNumberConstructorCall;
|
|
4
6
|
const lua = require("../../LuaAST");
|
|
5
7
|
const lua_ast_1 = require("../utils/lua-ast");
|
|
6
8
|
const diagnostics_1 = require("../utils/diagnostics");
|
|
@@ -23,7 +25,6 @@ function transformNumberPrototypeCall(context, node, calledMethod) {
|
|
|
23
25
|
context.diagnostics.push((0, diagnostics_1.unsupportedProperty)(calledMethod.name, "number", expressionName));
|
|
24
26
|
}
|
|
25
27
|
}
|
|
26
|
-
exports.transformNumberPrototypeCall = transformNumberPrototypeCall;
|
|
27
28
|
function transformNumberProperty(context, node) {
|
|
28
29
|
const name = node.name.text;
|
|
29
30
|
/*
|
|
@@ -69,7 +70,6 @@ function transformNumberProperty(context, node) {
|
|
|
69
70
|
context.diagnostics.push((0, diagnostics_1.unsupportedProperty)(node.name, "Number", name));
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
|
-
exports.transformNumberProperty = transformNumberProperty;
|
|
73
73
|
function transformNumberConstructorCall(context, node, calledMethod) {
|
|
74
74
|
const parameters = (0, call_1.transformArguments)(context, node.arguments);
|
|
75
75
|
const methodName = calledMethod.name.text;
|
|
@@ -88,5 +88,4 @@ function transformNumberConstructorCall(context, node, calledMethod) {
|
|
|
88
88
|
context.diagnostics.push((0, diagnostics_1.unsupportedProperty)(calledMethod.name, "Number", methodName));
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
exports.transformNumberConstructorCall = transformNumberConstructorCall;
|
|
92
91
|
//# sourceMappingURL=number.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.transformObjectConstructorCall = transformObjectConstructorCall;
|
|
4
|
+
exports.tryTransformObjectPrototypeCall = tryTransformObjectPrototypeCall;
|
|
4
5
|
const lua = require("../../LuaAST");
|
|
5
6
|
const diagnostics_1 = require("../utils/diagnostics");
|
|
6
7
|
const lualib_1 = require("../utils/lualib");
|
|
@@ -31,7 +32,6 @@ function transformObjectConstructorCall(context, node, calledMethod) {
|
|
|
31
32
|
context.diagnostics.push((0, diagnostics_1.unsupportedProperty)(calledMethod.name, "Object", methodName));
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
|
-
exports.transformObjectConstructorCall = transformObjectConstructorCall;
|
|
35
35
|
function tryTransformObjectPrototypeCall(context, node, calledMethod) {
|
|
36
36
|
const name = calledMethod.name.text;
|
|
37
37
|
switch (name) {
|
|
@@ -47,5 +47,4 @@ function tryTransformObjectPrototypeCall(context, node, calledMethod) {
|
|
|
47
47
|
return lua.createBinaryExpression(rawGetCall, lua.createNilLiteral(), lua.SyntaxKind.InequalityOperator, node);
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
exports.tryTransformObjectPrototypeCall = tryTransformObjectPrototypeCall;
|
|
51
50
|
//# sourceMappingURL=object.js.map
|