typescript-to-lua 1.25.2 → 1.26.1
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.d.ts +1 -0
- package/dist/LuaLib.js +13 -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/MathSign.lua +5 -4
- package/dist/lualib/5.0/MathTrunc.lua +6 -0
- package/dist/lualib/5.0/Set.lua +58 -0
- package/dist/lualib/5.0/lualib_bundle.lua +79 -12
- package/dist/lualib/5.0/lualib_module_info.json +13 -1
- package/dist/lualib/universal/MathSign.lua +5 -4
- package/dist/lualib/universal/MathTrunc.lua +6 -0
- package/dist/lualib/universal/Set.lua +58 -0
- package/dist/lualib/universal/lualib_bundle.lua +79 -12
- package/dist/lualib/universal/lualib_module_info.json +13 -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 +5 -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.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as ts from "typescript";
|
|
2
2
|
export declare const prepareDiagnosticForFormatting: (diagnostic: ts.Diagnostic) => {
|
|
3
3
|
code: any;
|
|
4
|
-
reportsUnnecessary?: {}
|
|
5
|
-
reportsDeprecated?: {}
|
|
6
|
-
source?: string
|
|
7
|
-
relatedInformation?: ts.DiagnosticRelatedInformation[]
|
|
4
|
+
reportsUnnecessary?: {};
|
|
5
|
+
reportsDeprecated?: {};
|
|
6
|
+
source?: string;
|
|
7
|
+
relatedInformation?: ts.DiagnosticRelatedInformation[];
|
|
8
8
|
category: ts.DiagnosticCategory;
|
|
9
9
|
file: ts.SourceFile | undefined;
|
|
10
10
|
start: number | undefined;
|
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
|
|
@@ -1500,13 +1500,29 @@ local function __TS__MathModf(x)
|
|
|
1500
1500
|
return integral, x - integral
|
|
1501
1501
|
end
|
|
1502
1502
|
|
|
1503
|
+
local function __TS__NumberIsNaN(value)
|
|
1504
|
+
return value ~= value
|
|
1505
|
+
end
|
|
1506
|
+
|
|
1503
1507
|
local function __TS__MathSign(val)
|
|
1504
|
-
if val
|
|
1505
|
-
return
|
|
1506
|
-
|
|
1508
|
+
if __TS__NumberIsNaN(val) or val == 0 then
|
|
1509
|
+
return val
|
|
1510
|
+
end
|
|
1511
|
+
if val < 0 then
|
|
1507
1512
|
return -1
|
|
1508
1513
|
end
|
|
1509
|
-
return
|
|
1514
|
+
return 1
|
|
1515
|
+
end
|
|
1516
|
+
|
|
1517
|
+
local function __TS__NumberIsFinite(value)
|
|
1518
|
+
return type(value) == "number" and value == value and value ~= 1 / 0 and value ~= -(1 / 0)
|
|
1519
|
+
end
|
|
1520
|
+
|
|
1521
|
+
local function __TS__MathTrunc(val)
|
|
1522
|
+
if not __TS__NumberIsFinite(val) or val == 0 then
|
|
1523
|
+
return val
|
|
1524
|
+
end
|
|
1525
|
+
return val > 0 and math.floor(val) or math.ceil(val)
|
|
1510
1526
|
end
|
|
1511
1527
|
|
|
1512
1528
|
local function __TS__Number(value)
|
|
@@ -1536,18 +1552,10 @@ local function __TS__Number(value)
|
|
|
1536
1552
|
end
|
|
1537
1553
|
end
|
|
1538
1554
|
|
|
1539
|
-
local function __TS__NumberIsFinite(value)
|
|
1540
|
-
return type(value) == "number" and value == value and value ~= 1 / 0 and value ~= -(1 / 0)
|
|
1541
|
-
end
|
|
1542
|
-
|
|
1543
1555
|
local function __TS__NumberIsInteger(value)
|
|
1544
1556
|
return __TS__NumberIsFinite(value) and math.floor(value) == value
|
|
1545
1557
|
end
|
|
1546
1558
|
|
|
1547
|
-
local function __TS__NumberIsNaN(value)
|
|
1548
|
-
return value ~= value
|
|
1549
|
-
end
|
|
1550
|
-
|
|
1551
1559
|
local function __TS__StringSubstring(self, start, ____end)
|
|
1552
1560
|
if ____end ~= ____end then
|
|
1553
1561
|
____end = 0
|
|
@@ -2096,6 +2104,64 @@ do
|
|
|
2096
2104
|
end
|
|
2097
2105
|
}
|
|
2098
2106
|
end
|
|
2107
|
+
function Set.prototype.union(self, other)
|
|
2108
|
+
local result = __TS__New(Set, self)
|
|
2109
|
+
for ____, item in __TS__Iterator(other) do
|
|
2110
|
+
result:add(item)
|
|
2111
|
+
end
|
|
2112
|
+
return result
|
|
2113
|
+
end
|
|
2114
|
+
function Set.prototype.intersection(self, other)
|
|
2115
|
+
local result = __TS__New(Set)
|
|
2116
|
+
for ____, item in __TS__Iterator(self) do
|
|
2117
|
+
if other:has(item) then
|
|
2118
|
+
result:add(item)
|
|
2119
|
+
end
|
|
2120
|
+
end
|
|
2121
|
+
return result
|
|
2122
|
+
end
|
|
2123
|
+
function Set.prototype.difference(self, other)
|
|
2124
|
+
local result = __TS__New(Set, self)
|
|
2125
|
+
for ____, item in __TS__Iterator(other) do
|
|
2126
|
+
result:delete(item)
|
|
2127
|
+
end
|
|
2128
|
+
return result
|
|
2129
|
+
end
|
|
2130
|
+
function Set.prototype.symmetricDifference(self, other)
|
|
2131
|
+
local result = __TS__New(Set, self)
|
|
2132
|
+
for ____, item in __TS__Iterator(other) do
|
|
2133
|
+
if self:has(item) then
|
|
2134
|
+
result:delete(item)
|
|
2135
|
+
else
|
|
2136
|
+
result:add(item)
|
|
2137
|
+
end
|
|
2138
|
+
end
|
|
2139
|
+
return result
|
|
2140
|
+
end
|
|
2141
|
+
function Set.prototype.isSubsetOf(self, other)
|
|
2142
|
+
for ____, item in __TS__Iterator(self) do
|
|
2143
|
+
if not other:has(item) then
|
|
2144
|
+
return false
|
|
2145
|
+
end
|
|
2146
|
+
end
|
|
2147
|
+
return true
|
|
2148
|
+
end
|
|
2149
|
+
function Set.prototype.isSupersetOf(self, other)
|
|
2150
|
+
for ____, item in __TS__Iterator(other) do
|
|
2151
|
+
if not self:has(item) then
|
|
2152
|
+
return false
|
|
2153
|
+
end
|
|
2154
|
+
end
|
|
2155
|
+
return true
|
|
2156
|
+
end
|
|
2157
|
+
function Set.prototype.isDisjointFrom(self, other)
|
|
2158
|
+
for ____, item in __TS__Iterator(self) do
|
|
2159
|
+
if other:has(item) then
|
|
2160
|
+
return false
|
|
2161
|
+
end
|
|
2162
|
+
end
|
|
2163
|
+
return true
|
|
2164
|
+
end
|
|
2099
2165
|
Set[Symbol.species] = Set
|
|
2100
2166
|
end
|
|
2101
2167
|
|
|
@@ -2661,6 +2727,7 @@ return {
|
|
|
2661
2727
|
__TS__MathAtan2 = __TS__MathAtan2,
|
|
2662
2728
|
__TS__MathModf = __TS__MathModf,
|
|
2663
2729
|
__TS__MathSign = __TS__MathSign,
|
|
2730
|
+
__TS__MathTrunc = __TS__MathTrunc,
|
|
2664
2731
|
__TS__New = __TS__New,
|
|
2665
2732
|
__TS__Number = __TS__Number,
|
|
2666
2733
|
__TS__NumberIsFinite = __TS__NumberIsFinite,
|
|
@@ -383,6 +383,17 @@
|
|
|
383
383
|
"MathSign": {
|
|
384
384
|
"exports": [
|
|
385
385
|
"__TS__MathSign"
|
|
386
|
+
],
|
|
387
|
+
"dependencies": [
|
|
388
|
+
"NumberIsNaN"
|
|
389
|
+
]
|
|
390
|
+
},
|
|
391
|
+
"MathTrunc": {
|
|
392
|
+
"exports": [
|
|
393
|
+
"__TS__MathTrunc"
|
|
394
|
+
],
|
|
395
|
+
"dependencies": [
|
|
396
|
+
"NumberIsFinite"
|
|
386
397
|
]
|
|
387
398
|
},
|
|
388
399
|
"New": {
|
|
@@ -566,7 +577,8 @@
|
|
|
566
577
|
"dependencies": [
|
|
567
578
|
"Class",
|
|
568
579
|
"Symbol",
|
|
569
|
-
"Iterator"
|
|
580
|
+
"Iterator",
|
|
581
|
+
"New"
|
|
570
582
|
]
|
|
571
583
|
},
|
|
572
584
|
"SetDescriptor": {
|
|
@@ -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
|
|
@@ -1440,13 +1440,29 @@ local __TS__MathAtan2 = math.atan2 or math.atan
|
|
|
1440
1440
|
|
|
1441
1441
|
local __TS__MathModf = math.modf
|
|
1442
1442
|
|
|
1443
|
+
local function __TS__NumberIsNaN(value)
|
|
1444
|
+
return value ~= value
|
|
1445
|
+
end
|
|
1446
|
+
|
|
1443
1447
|
local function __TS__MathSign(val)
|
|
1444
|
-
if val
|
|
1445
|
-
return
|
|
1446
|
-
|
|
1448
|
+
if __TS__NumberIsNaN(val) or val == 0 then
|
|
1449
|
+
return val
|
|
1450
|
+
end
|
|
1451
|
+
if val < 0 then
|
|
1447
1452
|
return -1
|
|
1448
1453
|
end
|
|
1449
|
-
return
|
|
1454
|
+
return 1
|
|
1455
|
+
end
|
|
1456
|
+
|
|
1457
|
+
local function __TS__NumberIsFinite(value)
|
|
1458
|
+
return type(value) == "number" and value == value and value ~= math.huge and value ~= -math.huge
|
|
1459
|
+
end
|
|
1460
|
+
|
|
1461
|
+
local function __TS__MathTrunc(val)
|
|
1462
|
+
if not __TS__NumberIsFinite(val) or val == 0 then
|
|
1463
|
+
return val
|
|
1464
|
+
end
|
|
1465
|
+
return val > 0 and math.floor(val) or math.ceil(val)
|
|
1450
1466
|
end
|
|
1451
1467
|
|
|
1452
1468
|
local function __TS__Number(value)
|
|
@@ -1476,18 +1492,10 @@ local function __TS__Number(value)
|
|
|
1476
1492
|
end
|
|
1477
1493
|
end
|
|
1478
1494
|
|
|
1479
|
-
local function __TS__NumberIsFinite(value)
|
|
1480
|
-
return type(value) == "number" and value == value and value ~= math.huge and value ~= -math.huge
|
|
1481
|
-
end
|
|
1482
|
-
|
|
1483
1495
|
local function __TS__NumberIsInteger(value)
|
|
1484
1496
|
return __TS__NumberIsFinite(value) and math.floor(value) == value
|
|
1485
1497
|
end
|
|
1486
1498
|
|
|
1487
|
-
local function __TS__NumberIsNaN(value)
|
|
1488
|
-
return value ~= value
|
|
1489
|
-
end
|
|
1490
|
-
|
|
1491
1499
|
local function __TS__StringSubstring(self, start, ____end)
|
|
1492
1500
|
if ____end ~= ____end then
|
|
1493
1501
|
____end = 0
|
|
@@ -2027,6 +2035,64 @@ do
|
|
|
2027
2035
|
end
|
|
2028
2036
|
}
|
|
2029
2037
|
end
|
|
2038
|
+
function Set.prototype.union(self, other)
|
|
2039
|
+
local result = __TS__New(Set, self)
|
|
2040
|
+
for ____, item in __TS__Iterator(other) do
|
|
2041
|
+
result:add(item)
|
|
2042
|
+
end
|
|
2043
|
+
return result
|
|
2044
|
+
end
|
|
2045
|
+
function Set.prototype.intersection(self, other)
|
|
2046
|
+
local result = __TS__New(Set)
|
|
2047
|
+
for ____, item in __TS__Iterator(self) do
|
|
2048
|
+
if other:has(item) then
|
|
2049
|
+
result:add(item)
|
|
2050
|
+
end
|
|
2051
|
+
end
|
|
2052
|
+
return result
|
|
2053
|
+
end
|
|
2054
|
+
function Set.prototype.difference(self, other)
|
|
2055
|
+
local result = __TS__New(Set, self)
|
|
2056
|
+
for ____, item in __TS__Iterator(other) do
|
|
2057
|
+
result:delete(item)
|
|
2058
|
+
end
|
|
2059
|
+
return result
|
|
2060
|
+
end
|
|
2061
|
+
function Set.prototype.symmetricDifference(self, other)
|
|
2062
|
+
local result = __TS__New(Set, self)
|
|
2063
|
+
for ____, item in __TS__Iterator(other) do
|
|
2064
|
+
if self:has(item) then
|
|
2065
|
+
result:delete(item)
|
|
2066
|
+
else
|
|
2067
|
+
result:add(item)
|
|
2068
|
+
end
|
|
2069
|
+
end
|
|
2070
|
+
return result
|
|
2071
|
+
end
|
|
2072
|
+
function Set.prototype.isSubsetOf(self, other)
|
|
2073
|
+
for ____, item in __TS__Iterator(self) do
|
|
2074
|
+
if not other:has(item) then
|
|
2075
|
+
return false
|
|
2076
|
+
end
|
|
2077
|
+
end
|
|
2078
|
+
return true
|
|
2079
|
+
end
|
|
2080
|
+
function Set.prototype.isSupersetOf(self, other)
|
|
2081
|
+
for ____, item in __TS__Iterator(other) do
|
|
2082
|
+
if not self:has(item) then
|
|
2083
|
+
return false
|
|
2084
|
+
end
|
|
2085
|
+
end
|
|
2086
|
+
return true
|
|
2087
|
+
end
|
|
2088
|
+
function Set.prototype.isDisjointFrom(self, other)
|
|
2089
|
+
for ____, item in __TS__Iterator(self) do
|
|
2090
|
+
if other:has(item) then
|
|
2091
|
+
return false
|
|
2092
|
+
end
|
|
2093
|
+
end
|
|
2094
|
+
return true
|
|
2095
|
+
end
|
|
2030
2096
|
Set[Symbol.species] = Set
|
|
2031
2097
|
end
|
|
2032
2098
|
|
|
@@ -2601,6 +2667,7 @@ return {
|
|
|
2601
2667
|
__TS__MathAtan2 = __TS__MathAtan2,
|
|
2602
2668
|
__TS__MathModf = __TS__MathModf,
|
|
2603
2669
|
__TS__MathSign = __TS__MathSign,
|
|
2670
|
+
__TS__MathTrunc = __TS__MathTrunc,
|
|
2604
2671
|
__TS__New = __TS__New,
|
|
2605
2672
|
__TS__Number = __TS__Number,
|
|
2606
2673
|
__TS__NumberIsFinite = __TS__NumberIsFinite,
|
|
@@ -389,6 +389,17 @@
|
|
|
389
389
|
"MathSign": {
|
|
390
390
|
"exports": [
|
|
391
391
|
"__TS__MathSign"
|
|
392
|
+
],
|
|
393
|
+
"dependencies": [
|
|
394
|
+
"NumberIsNaN"
|
|
395
|
+
]
|
|
396
|
+
},
|
|
397
|
+
"MathTrunc": {
|
|
398
|
+
"exports": [
|
|
399
|
+
"__TS__MathTrunc"
|
|
400
|
+
],
|
|
401
|
+
"dependencies": [
|
|
402
|
+
"NumberIsFinite"
|
|
392
403
|
]
|
|
393
404
|
},
|
|
394
405
|
"New": {
|
|
@@ -572,7 +583,8 @@
|
|
|
572
583
|
"dependencies": [
|
|
573
584
|
"Class",
|
|
574
585
|
"Symbol",
|
|
575
|
-
"Iterator"
|
|
586
|
+
"Iterator",
|
|
587
|
+
"New"
|
|
576
588
|
]
|
|
577
589
|
},
|
|
578
590
|
"SetDescriptor": {
|
|
@@ -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
|