typescript-to-lua 1.33.2 → 1.35.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 +1 -0
- package/dist/CompilerOptions.js +35 -4
- package/dist/LuaAST.js +34 -1
- package/dist/LuaLib.js +35 -2
- package/dist/LuaPrinter.js +36 -3
- package/dist/cli/diagnostics.js +34 -1
- package/dist/cli/parse.js +35 -2
- package/dist/cli/report.js +34 -1
- package/dist/cli/tsconfig.js +36 -3
- package/dist/lualib/5.0/Map.lua +36 -12
- package/dist/lualib/5.0/ObjectAssign.lua +4 -2
- package/dist/lualib/5.0/Promise.lua +11 -20
- package/dist/lualib/5.0/Set.lua +36 -12
- package/dist/lualib/5.0/SetDescriptor.lua +7 -0
- package/dist/lualib/5.0/SourceMapTraceBack.lua +1 -1
- package/dist/lualib/5.0/lualib_bundle.lua +95 -47
- package/dist/lualib/universal/Map.lua +36 -12
- package/dist/lualib/universal/ObjectAssign.lua +4 -2
- package/dist/lualib/universal/Promise.lua +11 -20
- package/dist/lualib/universal/Set.lua +36 -12
- package/dist/lualib/universal/SetDescriptor.lua +7 -0
- package/dist/lualib/universal/SourceMapTraceBack.lua +1 -1
- package/dist/lualib/universal/lualib_bundle.lua +95 -47
- package/dist/lualib-build/plugin.js +36 -3
- package/dist/lualib-build/util.js +34 -1
- package/dist/transformation/builtins/array.js +35 -2
- package/dist/transformation/builtins/console.js +35 -2
- package/dist/transformation/builtins/function.js +34 -1
- package/dist/transformation/builtins/index.js +35 -2
- package/dist/transformation/builtins/math.js +41 -3
- package/dist/transformation/builtins/number.js +42 -5
- package/dist/transformation/builtins/object.js +34 -1
- package/dist/transformation/builtins/promise.js +34 -1
- package/dist/transformation/builtins/string.js +34 -1
- package/dist/transformation/builtins/symbol.js +34 -1
- package/dist/transformation/context/context.js +35 -2
- package/dist/transformation/context/visitors.js +34 -1
- package/dist/transformation/index.js +34 -1
- package/dist/transformation/pre-transformers/using-transformer.js +34 -1
- package/dist/transformation/utils/annotations.js +34 -1
- package/dist/transformation/utils/assignment-validation.js +34 -1
- package/dist/transformation/utils/diagnostics.js +35 -2
- package/dist/transformation/utils/export.js +35 -2
- package/dist/transformation/utils/function-context.js +36 -4
- package/dist/transformation/utils/language-extensions.js +34 -1
- package/dist/transformation/utils/lua-ast.js +35 -2
- package/dist/transformation/utils/lualib.js +34 -1
- package/dist/transformation/utils/scope.d.ts +6 -0
- package/dist/transformation/utils/scope.js +56 -2
- package/dist/transformation/utils/typescript/index.js +27 -3
- package/dist/transformation/utils/typescript/nodes.js +34 -1
- package/dist/transformation/utils/typescript/types.js +34 -1
- package/dist/transformation/visitors/access.js +35 -2
- package/dist/transformation/visitors/async-await.js +35 -2
- package/dist/transformation/visitors/binary-expression/assignments.js +35 -2
- package/dist/transformation/visitors/binary-expression/bit.js +41 -2
- package/dist/transformation/visitors/binary-expression/compound.js +35 -2
- package/dist/transformation/visitors/binary-expression/destructuring-assignments.js +35 -2
- package/dist/transformation/visitors/binary-expression/index.js +35 -2
- package/dist/transformation/visitors/block.js +35 -2
- package/dist/transformation/visitors/break-continue.js +52 -2
- package/dist/transformation/visitors/call.js +35 -2
- package/dist/transformation/visitors/class/decorators.js +35 -2
- package/dist/transformation/visitors/class/index.js +35 -2
- package/dist/transformation/visitors/class/members/accessors.js +35 -2
- package/dist/transformation/visitors/class/members/constructor.js +35 -2
- package/dist/transformation/visitors/class/members/fields.js +34 -1
- package/dist/transformation/visitors/class/members/method.js +35 -2
- package/dist/transformation/visitors/class/new.js +34 -1
- package/dist/transformation/visitors/class/setup.js +35 -2
- package/dist/transformation/visitors/class/utils.js +34 -1
- package/dist/transformation/visitors/conditional.js +35 -2
- package/dist/transformation/visitors/delete.js +35 -2
- package/dist/transformation/visitors/enum.js +36 -3
- package/dist/transformation/visitors/errors.js +119 -21
- package/dist/transformation/visitors/expression-list.js +35 -2
- package/dist/transformation/visitors/expression-statement.js +34 -1
- package/dist/transformation/visitors/function.js +35 -2
- package/dist/transformation/visitors/identifier.js +35 -2
- package/dist/transformation/visitors/index.js +34 -1
- package/dist/transformation/visitors/language-extensions/iterable.js +35 -2
- package/dist/transformation/visitors/language-extensions/multi.js +35 -2
- package/dist/transformation/visitors/language-extensions/operators.js +34 -1
- package/dist/transformation/visitors/language-extensions/range.js +36 -3
- package/dist/transformation/visitors/language-extensions/table.js +34 -1
- package/dist/transformation/visitors/language-extensions/vararg.js +34 -1
- package/dist/transformation/visitors/literal.js +35 -2
- package/dist/transformation/visitors/loops/do-while.js +34 -1
- package/dist/transformation/visitors/loops/for-in.js +34 -1
- package/dist/transformation/visitors/loops/for-of.js +35 -2
- package/dist/transformation/visitors/loops/for.js +35 -2
- package/dist/transformation/visitors/loops/utils.js +35 -2
- package/dist/transformation/visitors/modules/export.js +36 -3
- package/dist/transformation/visitors/modules/import.js +36 -3
- package/dist/transformation/visitors/namespace.js +35 -2
- package/dist/transformation/visitors/optional-chaining.js +35 -2
- package/dist/transformation/visitors/return.js +75 -19
- package/dist/transformation/visitors/sourceFile.js +35 -2
- package/dist/transformation/visitors/spread.js +35 -2
- package/dist/transformation/visitors/switch.js +35 -2
- package/dist/transformation/visitors/template.js +35 -2
- package/dist/transformation/visitors/typeof.js +35 -2
- package/dist/transformation/visitors/typescript.js +34 -1
- package/dist/transformation/visitors/unary-expression.js +35 -2
- package/dist/transformation/visitors/variable-declaration.js +36 -3
- package/dist/transformation/visitors/void.js +35 -2
- package/dist/transpilation/bundle.js +37 -2
- package/dist/transpilation/diagnostics.d.ts +1 -1
- package/dist/transpilation/diagnostics.js +37 -3
- package/dist/transpilation/index.js +25 -3
- package/dist/transpilation/plugins.js +34 -1
- package/dist/transpilation/resolve.js +48 -12
- package/dist/transpilation/transformers.js +36 -3
- package/dist/transpilation/transpile.js +36 -3
- package/dist/transpilation/transpiler.js +56 -9
- package/dist/transpilation/utils.js +37 -4
- package/dist/tstl.js +37 -4
- package/dist/utils.js +37 -4
- package/package.json +11 -11
|
@@ -657,7 +657,6 @@ do
|
|
|
657
657
|
self.state = 0
|
|
658
658
|
self.fulfilledCallbacks = {}
|
|
659
659
|
self.rejectedCallbacks = {}
|
|
660
|
-
self.finallyCallbacks = {}
|
|
661
660
|
local success, ____error = ____pcall(
|
|
662
661
|
executor,
|
|
663
662
|
nil,
|
|
@@ -707,14 +706,17 @@ do
|
|
|
707
706
|
return self["then"](self, nil, onRejected)
|
|
708
707
|
end
|
|
709
708
|
function __TS__Promise.prototype.finally(self, onFinally)
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
if self.state ~= 0 then
|
|
709
|
+
return self["then"](
|
|
710
|
+
self,
|
|
711
|
+
onFinally and (function(____, value)
|
|
714
712
|
onFinally(nil)
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
713
|
+
return value
|
|
714
|
+
end) or nil,
|
|
715
|
+
onFinally and (function(____, reason)
|
|
716
|
+
onFinally(nil)
|
|
717
|
+
error(reason, 0)
|
|
718
|
+
end) or nil
|
|
719
|
+
)
|
|
718
720
|
end
|
|
719
721
|
function __TS__Promise.prototype.resolve(self, value)
|
|
720
722
|
if isPromiseLike(value) then
|
|
@@ -738,22 +740,11 @@ do
|
|
|
738
740
|
end
|
|
739
741
|
function __TS__Promise.prototype.invokeCallbacks(self, callbacks, value)
|
|
740
742
|
local callbacksLength = table.getn(callbacks)
|
|
741
|
-
local finallyCallbacks = self.finallyCallbacks
|
|
742
|
-
local finallyCallbacksLength = table.getn(finallyCallbacks)
|
|
743
743
|
if callbacksLength ~= 0 then
|
|
744
744
|
for i = 1, callbacksLength - 1 do
|
|
745
745
|
callbacks[i](callbacks, value)
|
|
746
746
|
end
|
|
747
|
-
|
|
748
|
-
return callbacks[callbacksLength](callbacks, value)
|
|
749
|
-
end
|
|
750
|
-
callbacks[callbacksLength](callbacks, value)
|
|
751
|
-
end
|
|
752
|
-
if finallyCallbacksLength ~= 0 then
|
|
753
|
-
for i = 1, finallyCallbacksLength - 1 do
|
|
754
|
-
finallyCallbacks[i](finallyCallbacks)
|
|
755
|
-
end
|
|
756
|
-
return finallyCallbacks[finallyCallbacksLength](finallyCallbacks)
|
|
747
|
+
return callbacks[callbacksLength](callbacks, value)
|
|
757
748
|
end
|
|
758
749
|
end
|
|
759
750
|
function __TS__Promise.prototype.createPromiseResolvingCallback(self, f, resolve, reject)
|
|
@@ -908,8 +899,10 @@ local function __TS__ObjectAssign(target, ...)
|
|
|
908
899
|
local sources = arg
|
|
909
900
|
for i = 1, table.getn(sources) do
|
|
910
901
|
local source = sources[i]
|
|
911
|
-
|
|
912
|
-
|
|
902
|
+
if type(source) == "table" then
|
|
903
|
+
for key in pairs(source) do
|
|
904
|
+
target[key] = source[key]
|
|
905
|
+
end
|
|
913
906
|
end
|
|
914
907
|
end
|
|
915
908
|
return target
|
|
@@ -1015,6 +1008,13 @@ do
|
|
|
1015
1008
|
metatable = {}
|
|
1016
1009
|
setmetatable(target, metatable)
|
|
1017
1010
|
end
|
|
1011
|
+
if not isPrototype and not rawget(metatable, "_isOwnDescriptorMetatable") then
|
|
1012
|
+
local instanceMetatable = {}
|
|
1013
|
+
instanceMetatable._isOwnDescriptorMetatable = true
|
|
1014
|
+
setmetatable(instanceMetatable, metatable)
|
|
1015
|
+
setmetatable(target, instanceMetatable)
|
|
1016
|
+
metatable = instanceMetatable
|
|
1017
|
+
end
|
|
1018
1018
|
local value = rawget(target, key)
|
|
1019
1019
|
if value ~= nil then
|
|
1020
1020
|
rawset(target, key, nil)
|
|
@@ -1412,46 +1412,70 @@ do
|
|
|
1412
1412
|
return self:entries()
|
|
1413
1413
|
end
|
|
1414
1414
|
function Map.prototype.entries(self)
|
|
1415
|
+
local function getFirstKey()
|
|
1416
|
+
return self.firstKey
|
|
1417
|
+
end
|
|
1415
1418
|
local items = self.items
|
|
1416
1419
|
local nextKey = self.nextKey
|
|
1417
|
-
local key
|
|
1420
|
+
local key
|
|
1421
|
+
local started = false
|
|
1418
1422
|
return {
|
|
1419
1423
|
[Symbol.iterator] = function(self)
|
|
1420
1424
|
return self
|
|
1421
1425
|
end,
|
|
1422
1426
|
next = function(self)
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1427
|
+
if not started then
|
|
1428
|
+
started = true
|
|
1429
|
+
key = getFirstKey(nil)
|
|
1430
|
+
else
|
|
1431
|
+
key = nextKey[key]
|
|
1432
|
+
end
|
|
1433
|
+
return {done = not key, value = {key, items[key]}}
|
|
1426
1434
|
end
|
|
1427
1435
|
}
|
|
1428
1436
|
end
|
|
1429
1437
|
function Map.prototype.keys(self)
|
|
1438
|
+
local function getFirstKey()
|
|
1439
|
+
return self.firstKey
|
|
1440
|
+
end
|
|
1430
1441
|
local nextKey = self.nextKey
|
|
1431
|
-
local key
|
|
1442
|
+
local key
|
|
1443
|
+
local started = false
|
|
1432
1444
|
return {
|
|
1433
1445
|
[Symbol.iterator] = function(self)
|
|
1434
1446
|
return self
|
|
1435
1447
|
end,
|
|
1436
1448
|
next = function(self)
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1449
|
+
if not started then
|
|
1450
|
+
started = true
|
|
1451
|
+
key = getFirstKey(nil)
|
|
1452
|
+
else
|
|
1453
|
+
key = nextKey[key]
|
|
1454
|
+
end
|
|
1455
|
+
return {done = not key, value = key}
|
|
1440
1456
|
end
|
|
1441
1457
|
}
|
|
1442
1458
|
end
|
|
1443
1459
|
function Map.prototype.values(self)
|
|
1460
|
+
local function getFirstKey()
|
|
1461
|
+
return self.firstKey
|
|
1462
|
+
end
|
|
1444
1463
|
local items = self.items
|
|
1445
1464
|
local nextKey = self.nextKey
|
|
1446
|
-
local key
|
|
1465
|
+
local key
|
|
1466
|
+
local started = false
|
|
1447
1467
|
return {
|
|
1448
1468
|
[Symbol.iterator] = function(self)
|
|
1449
1469
|
return self
|
|
1450
1470
|
end,
|
|
1451
1471
|
next = function(self)
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1472
|
+
if not started then
|
|
1473
|
+
started = true
|
|
1474
|
+
key = getFirstKey(nil)
|
|
1475
|
+
else
|
|
1476
|
+
key = nextKey[key]
|
|
1477
|
+
end
|
|
1478
|
+
return {done = not key, value = items[key]}
|
|
1455
1479
|
end
|
|
1456
1480
|
}
|
|
1457
1481
|
end
|
|
@@ -2068,44 +2092,68 @@ do
|
|
|
2068
2092
|
return self:values()
|
|
2069
2093
|
end
|
|
2070
2094
|
function Set.prototype.entries(self)
|
|
2095
|
+
local function getFirstKey()
|
|
2096
|
+
return self.firstKey
|
|
2097
|
+
end
|
|
2071
2098
|
local nextKey = self.nextKey
|
|
2072
|
-
local key
|
|
2099
|
+
local key
|
|
2100
|
+
local started = false
|
|
2073
2101
|
return {
|
|
2074
2102
|
[Symbol.iterator] = function(self)
|
|
2075
2103
|
return self
|
|
2076
2104
|
end,
|
|
2077
2105
|
next = function(self)
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2106
|
+
if not started then
|
|
2107
|
+
started = true
|
|
2108
|
+
key = getFirstKey(nil)
|
|
2109
|
+
else
|
|
2110
|
+
key = nextKey[key]
|
|
2111
|
+
end
|
|
2112
|
+
return {done = not key, value = {key, key}}
|
|
2081
2113
|
end
|
|
2082
2114
|
}
|
|
2083
2115
|
end
|
|
2084
2116
|
function Set.prototype.keys(self)
|
|
2117
|
+
local function getFirstKey()
|
|
2118
|
+
return self.firstKey
|
|
2119
|
+
end
|
|
2085
2120
|
local nextKey = self.nextKey
|
|
2086
|
-
local key
|
|
2121
|
+
local key
|
|
2122
|
+
local started = false
|
|
2087
2123
|
return {
|
|
2088
2124
|
[Symbol.iterator] = function(self)
|
|
2089
2125
|
return self
|
|
2090
2126
|
end,
|
|
2091
2127
|
next = function(self)
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2128
|
+
if not started then
|
|
2129
|
+
started = true
|
|
2130
|
+
key = getFirstKey(nil)
|
|
2131
|
+
else
|
|
2132
|
+
key = nextKey[key]
|
|
2133
|
+
end
|
|
2134
|
+
return {done = not key, value = key}
|
|
2095
2135
|
end
|
|
2096
2136
|
}
|
|
2097
2137
|
end
|
|
2098
2138
|
function Set.prototype.values(self)
|
|
2139
|
+
local function getFirstKey()
|
|
2140
|
+
return self.firstKey
|
|
2141
|
+
end
|
|
2099
2142
|
local nextKey = self.nextKey
|
|
2100
|
-
local key
|
|
2143
|
+
local key
|
|
2144
|
+
local started = false
|
|
2101
2145
|
return {
|
|
2102
2146
|
[Symbol.iterator] = function(self)
|
|
2103
2147
|
return self
|
|
2104
2148
|
end,
|
|
2105
2149
|
next = function(self)
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2150
|
+
if not started then
|
|
2151
|
+
started = true
|
|
2152
|
+
key = getFirstKey(nil)
|
|
2153
|
+
else
|
|
2154
|
+
key = nextKey[key]
|
|
2155
|
+
end
|
|
2156
|
+
return {done = not key, value = key}
|
|
2109
2157
|
end
|
|
2110
2158
|
}
|
|
2111
2159
|
end
|
|
@@ -2309,7 +2357,7 @@ local function __TS__SourceMapTraceBack(fileName, sourceMap)
|
|
|
2309
2357
|
end
|
|
2310
2358
|
local result = string.gsub(
|
|
2311
2359
|
trace,
|
|
2312
|
-
"(
|
|
2360
|
+
"([^%s<]+)%.lua:(%d+)",
|
|
2313
2361
|
function(file, line) return replacer(nil, file .. ".lua", file .. ".ts", line) end
|
|
2314
2362
|
)
|
|
2315
2363
|
local function stringReplacer(____, file, line)
|
|
@@ -93,46 +93,70 @@ do
|
|
|
93
93
|
return self:entries()
|
|
94
94
|
end
|
|
95
95
|
function Map.prototype.entries(self)
|
|
96
|
+
local function getFirstKey()
|
|
97
|
+
return self.firstKey
|
|
98
|
+
end
|
|
96
99
|
local items = self.items
|
|
97
100
|
local nextKey = self.nextKey
|
|
98
|
-
local key
|
|
101
|
+
local key
|
|
102
|
+
local started = false
|
|
99
103
|
return {
|
|
100
104
|
[Symbol.iterator] = function(self)
|
|
101
105
|
return self
|
|
102
106
|
end,
|
|
103
107
|
next = function(self)
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
108
|
+
if not started then
|
|
109
|
+
started = true
|
|
110
|
+
key = getFirstKey(nil)
|
|
111
|
+
else
|
|
112
|
+
key = nextKey[key]
|
|
113
|
+
end
|
|
114
|
+
return {done = not key, value = {key, items[key]}}
|
|
107
115
|
end
|
|
108
116
|
}
|
|
109
117
|
end
|
|
110
118
|
function Map.prototype.keys(self)
|
|
119
|
+
local function getFirstKey()
|
|
120
|
+
return self.firstKey
|
|
121
|
+
end
|
|
111
122
|
local nextKey = self.nextKey
|
|
112
|
-
local key
|
|
123
|
+
local key
|
|
124
|
+
local started = false
|
|
113
125
|
return {
|
|
114
126
|
[Symbol.iterator] = function(self)
|
|
115
127
|
return self
|
|
116
128
|
end,
|
|
117
129
|
next = function(self)
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
130
|
+
if not started then
|
|
131
|
+
started = true
|
|
132
|
+
key = getFirstKey(nil)
|
|
133
|
+
else
|
|
134
|
+
key = nextKey[key]
|
|
135
|
+
end
|
|
136
|
+
return {done = not key, value = key}
|
|
121
137
|
end
|
|
122
138
|
}
|
|
123
139
|
end
|
|
124
140
|
function Map.prototype.values(self)
|
|
141
|
+
local function getFirstKey()
|
|
142
|
+
return self.firstKey
|
|
143
|
+
end
|
|
125
144
|
local items = self.items
|
|
126
145
|
local nextKey = self.nextKey
|
|
127
|
-
local key
|
|
146
|
+
local key
|
|
147
|
+
local started = false
|
|
128
148
|
return {
|
|
129
149
|
[Symbol.iterator] = function(self)
|
|
130
150
|
return self
|
|
131
151
|
end,
|
|
132
152
|
next = function(self)
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
153
|
+
if not started then
|
|
154
|
+
started = true
|
|
155
|
+
key = getFirstKey(nil)
|
|
156
|
+
else
|
|
157
|
+
key = nextKey[key]
|
|
158
|
+
end
|
|
159
|
+
return {done = not key, value = items[key]}
|
|
136
160
|
end
|
|
137
161
|
}
|
|
138
162
|
end
|
|
@@ -2,8 +2,10 @@ local function __TS__ObjectAssign(target, ...)
|
|
|
2
2
|
local sources = {...}
|
|
3
3
|
for i = 1, #sources do
|
|
4
4
|
local source = sources[i]
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
if type(source) == "table" then
|
|
6
|
+
for key in pairs(source) do
|
|
7
|
+
target[key] = source[key]
|
|
8
|
+
end
|
|
7
9
|
end
|
|
8
10
|
end
|
|
9
11
|
return target
|
|
@@ -25,7 +25,6 @@ do
|
|
|
25
25
|
self.state = 0
|
|
26
26
|
self.fulfilledCallbacks = {}
|
|
27
27
|
self.rejectedCallbacks = {}
|
|
28
|
-
self.finallyCallbacks = {}
|
|
29
28
|
local success, ____error = ____pcall(
|
|
30
29
|
executor,
|
|
31
30
|
nil,
|
|
@@ -75,14 +74,17 @@ do
|
|
|
75
74
|
return self["then"](self, nil, onRejected)
|
|
76
75
|
end
|
|
77
76
|
function __TS__Promise.prototype.finally(self, onFinally)
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
if self.state ~= 0 then
|
|
77
|
+
return self["then"](
|
|
78
|
+
self,
|
|
79
|
+
onFinally and (function(____, value)
|
|
82
80
|
onFinally(nil)
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
81
|
+
return value
|
|
82
|
+
end) or nil,
|
|
83
|
+
onFinally and (function(____, reason)
|
|
84
|
+
onFinally(nil)
|
|
85
|
+
error(reason, 0)
|
|
86
|
+
end) or nil
|
|
87
|
+
)
|
|
86
88
|
end
|
|
87
89
|
function __TS__Promise.prototype.resolve(self, value)
|
|
88
90
|
if isPromiseLike(value) then
|
|
@@ -106,22 +108,11 @@ do
|
|
|
106
108
|
end
|
|
107
109
|
function __TS__Promise.prototype.invokeCallbacks(self, callbacks, value)
|
|
108
110
|
local callbacksLength = #callbacks
|
|
109
|
-
local finallyCallbacks = self.finallyCallbacks
|
|
110
|
-
local finallyCallbacksLength = #finallyCallbacks
|
|
111
111
|
if callbacksLength ~= 0 then
|
|
112
112
|
for i = 1, callbacksLength - 1 do
|
|
113
113
|
callbacks[i](callbacks, value)
|
|
114
114
|
end
|
|
115
|
-
|
|
116
|
-
return callbacks[callbacksLength](callbacks, value)
|
|
117
|
-
end
|
|
118
|
-
callbacks[callbacksLength](callbacks, value)
|
|
119
|
-
end
|
|
120
|
-
if finallyCallbacksLength ~= 0 then
|
|
121
|
-
for i = 1, finallyCallbacksLength - 1 do
|
|
122
|
-
finallyCallbacks[i](finallyCallbacks)
|
|
123
|
-
end
|
|
124
|
-
return finallyCallbacks[finallyCallbacksLength](finallyCallbacks)
|
|
115
|
+
return callbacks[callbacksLength](callbacks, value)
|
|
125
116
|
end
|
|
126
117
|
end
|
|
127
118
|
function __TS__Promise.prototype.createPromiseResolvingCallback(self, f, resolve, reject)
|
|
@@ -85,44 +85,68 @@ do
|
|
|
85
85
|
return self:values()
|
|
86
86
|
end
|
|
87
87
|
function Set.prototype.entries(self)
|
|
88
|
+
local function getFirstKey()
|
|
89
|
+
return self.firstKey
|
|
90
|
+
end
|
|
88
91
|
local nextKey = self.nextKey
|
|
89
|
-
local key
|
|
92
|
+
local key
|
|
93
|
+
local started = false
|
|
90
94
|
return {
|
|
91
95
|
[Symbol.iterator] = function(self)
|
|
92
96
|
return self
|
|
93
97
|
end,
|
|
94
98
|
next = function(self)
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
99
|
+
if not started then
|
|
100
|
+
started = true
|
|
101
|
+
key = getFirstKey(nil)
|
|
102
|
+
else
|
|
103
|
+
key = nextKey[key]
|
|
104
|
+
end
|
|
105
|
+
return {done = not key, value = {key, key}}
|
|
98
106
|
end
|
|
99
107
|
}
|
|
100
108
|
end
|
|
101
109
|
function Set.prototype.keys(self)
|
|
110
|
+
local function getFirstKey()
|
|
111
|
+
return self.firstKey
|
|
112
|
+
end
|
|
102
113
|
local nextKey = self.nextKey
|
|
103
|
-
local key
|
|
114
|
+
local key
|
|
115
|
+
local started = false
|
|
104
116
|
return {
|
|
105
117
|
[Symbol.iterator] = function(self)
|
|
106
118
|
return self
|
|
107
119
|
end,
|
|
108
120
|
next = function(self)
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
121
|
+
if not started then
|
|
122
|
+
started = true
|
|
123
|
+
key = getFirstKey(nil)
|
|
124
|
+
else
|
|
125
|
+
key = nextKey[key]
|
|
126
|
+
end
|
|
127
|
+
return {done = not key, value = key}
|
|
112
128
|
end
|
|
113
129
|
}
|
|
114
130
|
end
|
|
115
131
|
function Set.prototype.values(self)
|
|
132
|
+
local function getFirstKey()
|
|
133
|
+
return self.firstKey
|
|
134
|
+
end
|
|
116
135
|
local nextKey = self.nextKey
|
|
117
|
-
local key
|
|
136
|
+
local key
|
|
137
|
+
local started = false
|
|
118
138
|
return {
|
|
119
139
|
[Symbol.iterator] = function(self)
|
|
120
140
|
return self
|
|
121
141
|
end,
|
|
122
142
|
next = function(self)
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
143
|
+
if not started then
|
|
144
|
+
started = true
|
|
145
|
+
key = getFirstKey(nil)
|
|
146
|
+
else
|
|
147
|
+
key = nextKey[key]
|
|
148
|
+
end
|
|
149
|
+
return {done = not key, value = key}
|
|
126
150
|
end
|
|
127
151
|
}
|
|
128
152
|
end
|
|
@@ -31,6 +31,13 @@ do
|
|
|
31
31
|
metatable = {}
|
|
32
32
|
setmetatable(target, metatable)
|
|
33
33
|
end
|
|
34
|
+
if not isPrototype and not rawget(metatable, "_isOwnDescriptorMetatable") then
|
|
35
|
+
local instanceMetatable = {}
|
|
36
|
+
instanceMetatable._isOwnDescriptorMetatable = true
|
|
37
|
+
setmetatable(instanceMetatable, metatable)
|
|
38
|
+
setmetatable(target, instanceMetatable)
|
|
39
|
+
metatable = instanceMetatable
|
|
40
|
+
end
|
|
34
41
|
local value = rawget(target, key)
|
|
35
42
|
if value ~= nil then
|
|
36
43
|
rawset(target, key, nil)
|
|
@@ -29,7 +29,7 @@ local function __TS__SourceMapTraceBack(fileName, sourceMap)
|
|
|
29
29
|
end
|
|
30
30
|
local result = string.gsub(
|
|
31
31
|
trace,
|
|
32
|
-
"(
|
|
32
|
+
"([^%s<]+)%.lua:(%d+)",
|
|
33
33
|
function(file, line) return replacer(nil, file .. ".lua", file .. ".ts", line) end
|
|
34
34
|
)
|
|
35
35
|
local function stringReplacer(____, file, line)
|