typescript-to-lua 1.13.0 → 1.13.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/lualib/5.0/Await.lua +5 -11
- package/dist/lualib/5.0/Decorate.lua +1 -1
- package/dist/lualib/5.0/Error.lua +12 -18
- package/dist/lualib/5.0/Map.lua +3 -3
- package/dist/lualib/5.0/MathModf.lua +1 -7
- package/dist/lualib/5.0/ObjectDefineProperty.lua +21 -27
- package/dist/lualib/5.0/ParseFloat.lua +2 -8
- package/dist/lualib/5.0/ParseInt.lua +9 -21
- package/dist/lualib/5.0/Set.lua +3 -3
- package/dist/lualib/5.0/SetDescriptor.lua +2 -2
- package/dist/lualib/5.0/SourceMapTraceBack.lua +4 -4
- package/dist/lualib/5.0/StringReplace.lua +1 -7
- package/dist/lualib/5.0/SymbolRegistry.lua +1 -0
- package/dist/lualib/5.0/lualib_bundle.lua +65 -112
- package/dist/lualib/universal/Await.lua +5 -11
- package/dist/lualib/universal/Decorate.lua +1 -1
- package/dist/lualib/universal/Error.lua +12 -18
- package/dist/lualib/universal/Map.lua +3 -3
- package/dist/lualib/universal/ObjectDefineProperty.lua +21 -27
- package/dist/lualib/universal/ParseFloat.lua +2 -8
- package/dist/lualib/universal/ParseInt.lua +3 -15
- package/dist/lualib/universal/Set.lua +3 -3
- package/dist/lualib/universal/SetDescriptor.lua +2 -2
- package/dist/lualib/universal/SourceMapTraceBack.lua +5 -5
- package/dist/lualib/universal/StringReplace.lua +1 -7
- package/dist/lualib/universal/SymbolRegistry.lua +1 -0
- package/dist/lualib/universal/lualib_bundle.lua +59 -100
- package/dist/transpilation/resolve.js +3 -0
- package/package.json +7 -7
|
@@ -761,13 +761,7 @@ local function __TS__AsyncAwaiter(generator)
|
|
|
761
761
|
function(____, resolve, reject)
|
|
762
762
|
local adopt, fulfilled, step, resolved, asyncCoroutine
|
|
763
763
|
function adopt(self, value)
|
|
764
|
-
|
|
765
|
-
if __TS__InstanceOf(value, __TS__Promise) then
|
|
766
|
-
____temp_0 = value
|
|
767
|
-
else
|
|
768
|
-
____temp_0 = __TS__Promise.resolve(value)
|
|
769
|
-
end
|
|
770
|
-
return ____temp_0
|
|
764
|
+
return __TS__InstanceOf(value, __TS__Promise) and value or __TS__Promise.resolve(value)
|
|
771
765
|
end
|
|
772
766
|
function fulfilled(self, value)
|
|
773
767
|
local success, resultOrError = coroutine.resume(asyncCoroutine, value)
|
|
@@ -784,8 +778,8 @@ local function __TS__AsyncAwaiter(generator)
|
|
|
784
778
|
if coroutine.status(asyncCoroutine) == "dead" then
|
|
785
779
|
resolve(nil, result)
|
|
786
780
|
else
|
|
787
|
-
local
|
|
788
|
-
|
|
781
|
+
local ____self_0 = adopt(nil, result)
|
|
782
|
+
____self_0["then"](____self_0, fulfilled, reject)
|
|
789
783
|
end
|
|
790
784
|
end
|
|
791
785
|
resolved = false
|
|
@@ -794,8 +788,8 @@ local function __TS__AsyncAwaiter(generator)
|
|
|
794
788
|
asyncCoroutine,
|
|
795
789
|
function(____, v)
|
|
796
790
|
resolved = true
|
|
797
|
-
local
|
|
798
|
-
|
|
791
|
+
local ____self_1 = adopt(nil, v)
|
|
792
|
+
____self_1["then"](____self_1, resolve, reject)
|
|
799
793
|
end
|
|
800
794
|
)
|
|
801
795
|
if success then
|
|
@@ -902,7 +896,7 @@ do
|
|
|
902
896
|
local descriptors = rawget(metatable, "_descriptors")
|
|
903
897
|
if descriptors then
|
|
904
898
|
local descriptor = descriptors[key]
|
|
905
|
-
if descriptor then
|
|
899
|
+
if descriptor ~= nil then
|
|
906
900
|
if descriptor.get then
|
|
907
901
|
return descriptor.get(self)
|
|
908
902
|
end
|
|
@@ -918,7 +912,7 @@ do
|
|
|
918
912
|
local descriptors = rawget(metatable, "_descriptors")
|
|
919
913
|
if descriptors then
|
|
920
914
|
local descriptor = descriptors[key]
|
|
921
|
-
if descriptor then
|
|
915
|
+
if descriptor ~= nil then
|
|
922
916
|
if descriptor.set then
|
|
923
917
|
descriptor.set(self, value)
|
|
924
918
|
else
|
|
@@ -971,7 +965,7 @@ local function __TS__Decorate(decorators, target, key, desc)
|
|
|
971
965
|
local i = table.getn(decorators)
|
|
972
966
|
while i >= 0 do
|
|
973
967
|
local decorator = decorators[i + 1]
|
|
974
|
-
if decorator then
|
|
968
|
+
if decorator ~= nil then
|
|
975
969
|
local oldResult = result
|
|
976
970
|
if key == nil then
|
|
977
971
|
result = decorator(nil, result)
|
|
@@ -1044,7 +1038,7 @@ do
|
|
|
1044
1038
|
if isClassicLua or caller and caller.func ~= error then
|
|
1045
1039
|
return description
|
|
1046
1040
|
else
|
|
1047
|
-
return (
|
|
1041
|
+
return (description .. "\n") .. tostring(self.stack)
|
|
1048
1042
|
end
|
|
1049
1043
|
end
|
|
1050
1044
|
end
|
|
@@ -1055,7 +1049,7 @@ do
|
|
|
1055
1049
|
{__call = function(____, _self, message) return __TS__New(Type, message) end}
|
|
1056
1050
|
)
|
|
1057
1051
|
end
|
|
1058
|
-
local
|
|
1052
|
+
local ____initErrorClass_1 = initErrorClass
|
|
1059
1053
|
local ____class_0 = __TS__Class()
|
|
1060
1054
|
____class_0.name = ""
|
|
1061
1055
|
function ____class_0.prototype.____constructor(self, message)
|
|
@@ -1066,34 +1060,28 @@ do
|
|
|
1066
1060
|
self.name = "Error"
|
|
1067
1061
|
self.stack = getErrorStack(nil, self.constructor.new)
|
|
1068
1062
|
local metatable = getmetatable(self)
|
|
1069
|
-
if not metatable.__errorToStringPatched then
|
|
1063
|
+
if metatable and not metatable.__errorToStringPatched then
|
|
1070
1064
|
metatable.__errorToStringPatched = true
|
|
1071
1065
|
metatable.__tostring = wrapErrorToString(nil, metatable.__tostring)
|
|
1072
1066
|
end
|
|
1073
1067
|
end
|
|
1074
1068
|
function ____class_0.prototype.__tostring(self)
|
|
1075
|
-
|
|
1076
|
-
if self.message ~= "" then
|
|
1077
|
-
____temp_1 = (self.name .. ": ") .. self.message
|
|
1078
|
-
else
|
|
1079
|
-
____temp_1 = self.name
|
|
1080
|
-
end
|
|
1081
|
-
return ____temp_1
|
|
1069
|
+
return self.message ~= "" and (self.name .. ": ") .. self.message or self.name
|
|
1082
1070
|
end
|
|
1083
|
-
Error =
|
|
1071
|
+
Error = ____initErrorClass_1(nil, ____class_0, "Error")
|
|
1084
1072
|
local function createErrorClass(self, name)
|
|
1085
|
-
local
|
|
1086
|
-
local
|
|
1087
|
-
|
|
1088
|
-
__TS__ClassExtends(
|
|
1089
|
-
function
|
|
1090
|
-
|
|
1073
|
+
local ____initErrorClass_3 = initErrorClass
|
|
1074
|
+
local ____class_2 = __TS__Class()
|
|
1075
|
+
____class_2.name = ____class_2.name
|
|
1076
|
+
__TS__ClassExtends(____class_2, Error)
|
|
1077
|
+
function ____class_2.prototype.____constructor(self, ...)
|
|
1078
|
+
____class_2.____super.prototype.____constructor(
|
|
1091
1079
|
self,
|
|
1092
1080
|
unpack(arg)
|
|
1093
1081
|
)
|
|
1094
1082
|
self.name = name
|
|
1095
1083
|
end
|
|
1096
|
-
return
|
|
1084
|
+
return ____initErrorClass_3(nil, ____class_2, name)
|
|
1097
1085
|
end
|
|
1098
1086
|
RangeError = createErrorClass(nil, "RangeError")
|
|
1099
1087
|
ReferenceError = createErrorClass(nil, "ReferenceError")
|
|
@@ -1285,13 +1273,13 @@ do
|
|
|
1285
1273
|
self.size = self.size - 1
|
|
1286
1274
|
local next = self.nextKey[key]
|
|
1287
1275
|
local previous = self.previousKey[key]
|
|
1288
|
-
if next and previous then
|
|
1276
|
+
if next ~= nil and previous ~= nil then
|
|
1289
1277
|
self.nextKey[previous] = next
|
|
1290
1278
|
self.previousKey[next] = previous
|
|
1291
|
-
elseif next then
|
|
1279
|
+
elseif next ~= nil then
|
|
1292
1280
|
self.firstKey = next
|
|
1293
1281
|
self.previousKey[next] = nil
|
|
1294
|
-
elseif previous then
|
|
1282
|
+
elseif previous ~= nil then
|
|
1295
1283
|
self.lastKey = previous
|
|
1296
1284
|
self.nextKey[previous] = nil
|
|
1297
1285
|
else
|
|
@@ -1414,13 +1402,7 @@ end
|
|
|
1414
1402
|
local __TS__MathAtan2 = math.atan2 or math.atan
|
|
1415
1403
|
|
|
1416
1404
|
local function __TS__MathModf(x)
|
|
1417
|
-
local
|
|
1418
|
-
if x > 0 then
|
|
1419
|
-
____temp_0 = math.floor(x)
|
|
1420
|
-
else
|
|
1421
|
-
____temp_0 = math.ceil(x)
|
|
1422
|
-
end
|
|
1423
|
-
local integral = ____temp_0
|
|
1405
|
+
local integral = x > 0 and math.floor(x) or math.ceil(x)
|
|
1424
1406
|
return integral, x - integral
|
|
1425
1407
|
end
|
|
1426
1408
|
|
|
@@ -1517,13 +1499,7 @@ do
|
|
|
1517
1499
|
end
|
|
1518
1500
|
|
|
1519
1501
|
local function __TS__ObjectDefineProperty(target, key, desc)
|
|
1520
|
-
local
|
|
1521
|
-
if type(key) == "number" then
|
|
1522
|
-
____temp_0 = key + 1
|
|
1523
|
-
else
|
|
1524
|
-
____temp_0 = key
|
|
1525
|
-
end
|
|
1526
|
-
local luaKey = ____temp_0
|
|
1502
|
+
local luaKey = type(key) == "number" and key + 1 or key
|
|
1527
1503
|
local value = rawget(target, luaKey)
|
|
1528
1504
|
local hasGetterOrSetter = desc.get ~= nil or desc.set ~= nil
|
|
1529
1505
|
local descriptor
|
|
@@ -1537,39 +1513,39 @@ local function __TS__ObjectDefineProperty(target, key, desc)
|
|
|
1537
1513
|
descriptor = desc
|
|
1538
1514
|
else
|
|
1539
1515
|
local valueExists = value ~= nil
|
|
1540
|
-
local
|
|
1541
|
-
local
|
|
1542
|
-
local
|
|
1516
|
+
local ____desc_set_4 = desc.set
|
|
1517
|
+
local ____desc_get_5 = desc.get
|
|
1518
|
+
local ____temp_0
|
|
1543
1519
|
if desc.configurable ~= nil then
|
|
1544
|
-
|
|
1520
|
+
____temp_0 = desc.configurable
|
|
1545
1521
|
else
|
|
1546
|
-
|
|
1522
|
+
____temp_0 = valueExists
|
|
1547
1523
|
end
|
|
1548
|
-
local
|
|
1524
|
+
local ____temp_1
|
|
1549
1525
|
if desc.enumerable ~= nil then
|
|
1550
|
-
|
|
1526
|
+
____temp_1 = desc.enumerable
|
|
1551
1527
|
else
|
|
1552
|
-
|
|
1528
|
+
____temp_1 = valueExists
|
|
1553
1529
|
end
|
|
1554
|
-
local
|
|
1530
|
+
local ____temp_2
|
|
1555
1531
|
if desc.writable ~= nil then
|
|
1556
|
-
|
|
1532
|
+
____temp_2 = desc.writable
|
|
1557
1533
|
else
|
|
1558
|
-
|
|
1534
|
+
____temp_2 = valueExists
|
|
1559
1535
|
end
|
|
1560
|
-
local
|
|
1536
|
+
local ____temp_3
|
|
1561
1537
|
if desc.value ~= nil then
|
|
1562
|
-
|
|
1538
|
+
____temp_3 = desc.value
|
|
1563
1539
|
else
|
|
1564
|
-
|
|
1540
|
+
____temp_3 = value
|
|
1565
1541
|
end
|
|
1566
1542
|
descriptor = {
|
|
1567
|
-
set =
|
|
1568
|
-
get =
|
|
1569
|
-
configurable =
|
|
1570
|
-
enumerable =
|
|
1571
|
-
writable =
|
|
1572
|
-
value =
|
|
1543
|
+
set = ____desc_set_4,
|
|
1544
|
+
get = ____desc_get_5,
|
|
1545
|
+
configurable = ____temp_0,
|
|
1546
|
+
enumerable = ____temp_1,
|
|
1547
|
+
writable = ____temp_2,
|
|
1548
|
+
value = ____temp_3
|
|
1573
1549
|
}
|
|
1574
1550
|
end
|
|
1575
1551
|
__TS__SetDescriptor(target, luaKey, descriptor)
|
|
@@ -1639,14 +1615,8 @@ end
|
|
|
1639
1615
|
|
|
1640
1616
|
local function __TS__ParseFloat(numberString)
|
|
1641
1617
|
local infinityMatch = __TS__Match(numberString, "^%s*(-?Infinity)")
|
|
1642
|
-
if infinityMatch then
|
|
1643
|
-
|
|
1644
|
-
if __TS__StringAccess(infinityMatch, 0) == "-" then
|
|
1645
|
-
____temp_0 = -(1 / 0)
|
|
1646
|
-
else
|
|
1647
|
-
____temp_0 = 1 / 0
|
|
1648
|
-
end
|
|
1649
|
-
return ____temp_0
|
|
1618
|
+
if infinityMatch ~= nil then
|
|
1619
|
+
return __TS__StringAccess(infinityMatch, 0) == "-" and -(1 / 0) or 1 / 0
|
|
1650
1620
|
end
|
|
1651
1621
|
local number = tonumber(__TS__Match(numberString, "^%s*(-?%d+%.?%d*)"))
|
|
1652
1622
|
return number or 0 / 0
|
|
@@ -1677,33 +1647,21 @@ do
|
|
|
1677
1647
|
if base == nil then
|
|
1678
1648
|
base = 10
|
|
1679
1649
|
local hexMatch = __TS__Match(numberString, "^%s*-?0[xX]")
|
|
1680
|
-
if hexMatch then
|
|
1650
|
+
if hexMatch ~= nil then
|
|
1681
1651
|
base = 16
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
)
|
|
1688
|
-
|
|
1689
|
-
____TS__Match_result__0_0 = __TS__StringSubstring(
|
|
1690
|
-
numberString,
|
|
1691
|
-
string.len(hexMatch)
|
|
1692
|
-
)
|
|
1693
|
-
end
|
|
1694
|
-
numberString = ____TS__Match_result__0_0
|
|
1652
|
+
numberString = __TS__Match(hexMatch, "-") and "-" .. __TS__StringSubstring(
|
|
1653
|
+
numberString,
|
|
1654
|
+
string.len(hexMatch)
|
|
1655
|
+
) or __TS__StringSubstring(
|
|
1656
|
+
numberString,
|
|
1657
|
+
string.len(hexMatch)
|
|
1658
|
+
)
|
|
1695
1659
|
end
|
|
1696
1660
|
end
|
|
1697
1661
|
if base < 2 or base > 36 then
|
|
1698
1662
|
return 0 / 0
|
|
1699
1663
|
end
|
|
1700
|
-
local
|
|
1701
|
-
if base <= 10 then
|
|
1702
|
-
____temp_1 = __TS__StringSubstring(parseIntBasePattern, 0, base)
|
|
1703
|
-
else
|
|
1704
|
-
____temp_1 = __TS__StringSubstring(parseIntBasePattern, 0, 10 + 2 * (base - 10))
|
|
1705
|
-
end
|
|
1706
|
-
local allowedDigits = ____temp_1
|
|
1664
|
+
local allowedDigits = base <= 10 and __TS__StringSubstring(parseIntBasePattern, 0, base) or __TS__StringSubstring(parseIntBasePattern, 0, 10 + 2 * (base - 10))
|
|
1707
1665
|
local pattern = ("^%s*(-?[" .. allowedDigits) .. "]*)"
|
|
1708
1666
|
local number = tonumber(
|
|
1709
1667
|
__TS__Match(numberString, pattern),
|
|
@@ -1942,13 +1900,13 @@ do
|
|
|
1942
1900
|
self.size = self.size - 1
|
|
1943
1901
|
local next = self.nextKey[value]
|
|
1944
1902
|
local previous = self.previousKey[value]
|
|
1945
|
-
if next and previous then
|
|
1903
|
+
if next ~= nil and previous ~= nil then
|
|
1946
1904
|
self.nextKey[previous] = next
|
|
1947
1905
|
self.previousKey[next] = previous
|
|
1948
|
-
elseif next then
|
|
1906
|
+
elseif next ~= nil then
|
|
1949
1907
|
self.firstKey = next
|
|
1950
1908
|
self.previousKey[next] = nil
|
|
1951
|
-
elseif previous then
|
|
1909
|
+
elseif previous ~= nil then
|
|
1952
1910
|
self.lastKey = previous
|
|
1953
1911
|
self.nextKey[previous] = nil
|
|
1954
1912
|
else
|
|
@@ -2144,12 +2102,12 @@ local function __TS__SourceMapTraceBack(fileName, sourceMap)
|
|
|
2144
2102
|
end
|
|
2145
2103
|
local function replacer(____, file, srcFile, line)
|
|
2146
2104
|
local fileSourceMap = _G.__TS__sourcemap[file]
|
|
2147
|
-
if fileSourceMap and fileSourceMap[line] then
|
|
2105
|
+
if fileSourceMap ~= nil and fileSourceMap[line] ~= nil then
|
|
2148
2106
|
local data = fileSourceMap[line]
|
|
2149
2107
|
if type(data) == "number" then
|
|
2150
2108
|
return (srcFile .. ":") .. tostring(data)
|
|
2151
2109
|
end
|
|
2152
|
-
return (
|
|
2110
|
+
return (data.file .. ":") .. tostring(data.line)
|
|
2153
2111
|
end
|
|
2154
2112
|
return (file .. ":") .. line
|
|
2155
2113
|
end
|
|
@@ -2160,14 +2118,14 @@ local function __TS__SourceMapTraceBack(fileName, sourceMap)
|
|
|
2160
2118
|
)
|
|
2161
2119
|
local function stringReplacer(____, file, line)
|
|
2162
2120
|
local fileSourceMap = _G.__TS__sourcemap[file]
|
|
2163
|
-
if fileSourceMap and fileSourceMap[line] then
|
|
2121
|
+
if fileSourceMap ~= nil and fileSourceMap[line] ~= nil then
|
|
2164
2122
|
local chunkName = __TS__Match(file, "%[string \"([^\"]+)\"%]")
|
|
2165
2123
|
local sourceName = string.gsub(chunkName, ".lua$", ".ts")
|
|
2166
2124
|
local data = fileSourceMap[line]
|
|
2167
2125
|
if type(data) == "number" then
|
|
2168
2126
|
return (sourceName .. ":") .. tostring(data)
|
|
2169
2127
|
end
|
|
2170
|
-
return (
|
|
2128
|
+
return (data.file .. ":") .. tostring(data.line)
|
|
2171
2129
|
end
|
|
2172
2130
|
return (file .. ":") .. line
|
|
2173
2131
|
end
|
|
@@ -2291,13 +2249,7 @@ do
|
|
|
2291
2249
|
return source
|
|
2292
2250
|
end
|
|
2293
2251
|
local before = sub(source, 1, startPos - 1)
|
|
2294
|
-
local
|
|
2295
|
-
if type(replaceValue) == "string" then
|
|
2296
|
-
____temp_0 = replaceValue
|
|
2297
|
-
else
|
|
2298
|
-
____temp_0 = replaceValue(nil, searchValue, startPos - 1, source)
|
|
2299
|
-
end
|
|
2300
|
-
local replacement = ____temp_0
|
|
2252
|
+
local replacement = type(replaceValue) == "string" and replaceValue or replaceValue(nil, searchValue, startPos - 1, source)
|
|
2301
2253
|
local after = sub(source, endPos + 1)
|
|
2302
2254
|
return (before .. replacement) .. after
|
|
2303
2255
|
end
|
|
@@ -2440,6 +2392,7 @@ do
|
|
|
2440
2392
|
return key
|
|
2441
2393
|
end
|
|
2442
2394
|
end
|
|
2395
|
+
return nil
|
|
2443
2396
|
end
|
|
2444
2397
|
end
|
|
2445
2398
|
|
|
@@ -4,13 +4,7 @@ local function __TS__AsyncAwaiter(generator)
|
|
|
4
4
|
function(____, resolve, reject)
|
|
5
5
|
local adopt, fulfilled, step, resolved, asyncCoroutine
|
|
6
6
|
function adopt(self, value)
|
|
7
|
-
|
|
8
|
-
if __TS__InstanceOf(value, __TS__Promise) then
|
|
9
|
-
____temp_0 = value
|
|
10
|
-
else
|
|
11
|
-
____temp_0 = __TS__Promise.resolve(value)
|
|
12
|
-
end
|
|
13
|
-
return ____temp_0
|
|
7
|
+
return __TS__InstanceOf(value, __TS__Promise) and value or __TS__Promise.resolve(value)
|
|
14
8
|
end
|
|
15
9
|
function fulfilled(self, value)
|
|
16
10
|
local success, resultOrError = coroutine.resume(asyncCoroutine, value)
|
|
@@ -27,8 +21,8 @@ local function __TS__AsyncAwaiter(generator)
|
|
|
27
21
|
if coroutine.status(asyncCoroutine) == "dead" then
|
|
28
22
|
resolve(nil, result)
|
|
29
23
|
else
|
|
30
|
-
local
|
|
31
|
-
|
|
24
|
+
local ____self_0 = adopt(nil, result)
|
|
25
|
+
____self_0["then"](____self_0, fulfilled, reject)
|
|
32
26
|
end
|
|
33
27
|
end
|
|
34
28
|
resolved = false
|
|
@@ -37,8 +31,8 @@ local function __TS__AsyncAwaiter(generator)
|
|
|
37
31
|
asyncCoroutine,
|
|
38
32
|
function(____, v)
|
|
39
33
|
resolved = true
|
|
40
|
-
local
|
|
41
|
-
|
|
34
|
+
local ____self_1 = adopt(nil, v)
|
|
35
|
+
____self_1["then"](____self_1, resolve, reject)
|
|
42
36
|
end
|
|
43
37
|
)
|
|
44
38
|
if success then
|
|
@@ -4,7 +4,7 @@ local function __TS__Decorate(decorators, target, key, desc)
|
|
|
4
4
|
local i = #decorators
|
|
5
5
|
while i >= 0 do
|
|
6
6
|
local decorator = decorators[i + 1]
|
|
7
|
-
if decorator then
|
|
7
|
+
if decorator ~= nil then
|
|
8
8
|
local oldResult = result
|
|
9
9
|
if key == nil then
|
|
10
10
|
result = decorator(nil, result)
|
|
@@ -26,7 +26,7 @@ do
|
|
|
26
26
|
if isClassicLua or caller and caller.func ~= error then
|
|
27
27
|
return description
|
|
28
28
|
else
|
|
29
|
-
return (
|
|
29
|
+
return (description .. "\n") .. tostring(self.stack)
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
end
|
|
@@ -37,7 +37,7 @@ do
|
|
|
37
37
|
{__call = function(____, _self, message) return __TS__New(Type, message) end}
|
|
38
38
|
)
|
|
39
39
|
end
|
|
40
|
-
local
|
|
40
|
+
local ____initErrorClass_1 = initErrorClass
|
|
41
41
|
local ____class_0 = __TS__Class()
|
|
42
42
|
____class_0.name = ""
|
|
43
43
|
function ____class_0.prototype.____constructor(self, message)
|
|
@@ -48,31 +48,25 @@ do
|
|
|
48
48
|
self.name = "Error"
|
|
49
49
|
self.stack = getErrorStack(nil, self.constructor.new)
|
|
50
50
|
local metatable = getmetatable(self)
|
|
51
|
-
if not metatable.__errorToStringPatched then
|
|
51
|
+
if metatable and not metatable.__errorToStringPatched then
|
|
52
52
|
metatable.__errorToStringPatched = true
|
|
53
53
|
metatable.__tostring = wrapErrorToString(nil, metatable.__tostring)
|
|
54
54
|
end
|
|
55
55
|
end
|
|
56
56
|
function ____class_0.prototype.__tostring(self)
|
|
57
|
-
|
|
58
|
-
if self.message ~= "" then
|
|
59
|
-
____temp_1 = (self.name .. ": ") .. self.message
|
|
60
|
-
else
|
|
61
|
-
____temp_1 = self.name
|
|
62
|
-
end
|
|
63
|
-
return ____temp_1
|
|
57
|
+
return self.message ~= "" and (self.name .. ": ") .. self.message or self.name
|
|
64
58
|
end
|
|
65
|
-
Error =
|
|
59
|
+
Error = ____initErrorClass_1(nil, ____class_0, "Error")
|
|
66
60
|
local function createErrorClass(self, name)
|
|
67
|
-
local
|
|
68
|
-
local
|
|
69
|
-
|
|
70
|
-
__TS__ClassExtends(
|
|
71
|
-
function
|
|
72
|
-
|
|
61
|
+
local ____initErrorClass_3 = initErrorClass
|
|
62
|
+
local ____class_2 = __TS__Class()
|
|
63
|
+
____class_2.name = ____class_2.name
|
|
64
|
+
__TS__ClassExtends(____class_2, Error)
|
|
65
|
+
function ____class_2.prototype.____constructor(self, ...)
|
|
66
|
+
____class_2.____super.prototype.____constructor(self, ...)
|
|
73
67
|
self.name = name
|
|
74
68
|
end
|
|
75
|
-
return
|
|
69
|
+
return ____initErrorClass_3(nil, ____class_2, name)
|
|
76
70
|
end
|
|
77
71
|
RangeError = createErrorClass(nil, "RangeError")
|
|
78
72
|
ReferenceError = createErrorClass(nil, "ReferenceError")
|
|
@@ -43,13 +43,13 @@ do
|
|
|
43
43
|
self.size = self.size - 1
|
|
44
44
|
local next = self.nextKey[key]
|
|
45
45
|
local previous = self.previousKey[key]
|
|
46
|
-
if next and previous then
|
|
46
|
+
if next ~= nil and previous ~= nil then
|
|
47
47
|
self.nextKey[previous] = next
|
|
48
48
|
self.previousKey[next] = previous
|
|
49
|
-
elseif next then
|
|
49
|
+
elseif next ~= nil then
|
|
50
50
|
self.firstKey = next
|
|
51
51
|
self.previousKey[next] = nil
|
|
52
|
-
elseif previous then
|
|
52
|
+
elseif previous ~= nil then
|
|
53
53
|
self.lastKey = previous
|
|
54
54
|
self.nextKey[previous] = nil
|
|
55
55
|
else
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
local function __TS__ObjectDefineProperty(target, key, desc)
|
|
2
|
-
local
|
|
3
|
-
if type(key) == "number" then
|
|
4
|
-
____temp_0 = key + 1
|
|
5
|
-
else
|
|
6
|
-
____temp_0 = key
|
|
7
|
-
end
|
|
8
|
-
local luaKey = ____temp_0
|
|
2
|
+
local luaKey = type(key) == "number" and key + 1 or key
|
|
9
3
|
local value = rawget(target, luaKey)
|
|
10
4
|
local hasGetterOrSetter = desc.get ~= nil or desc.set ~= nil
|
|
11
5
|
local descriptor
|
|
@@ -19,39 +13,39 @@ local function __TS__ObjectDefineProperty(target, key, desc)
|
|
|
19
13
|
descriptor = desc
|
|
20
14
|
else
|
|
21
15
|
local valueExists = value ~= nil
|
|
22
|
-
local
|
|
23
|
-
local
|
|
24
|
-
local
|
|
16
|
+
local ____desc_set_4 = desc.set
|
|
17
|
+
local ____desc_get_5 = desc.get
|
|
18
|
+
local ____temp_0
|
|
25
19
|
if desc.configurable ~= nil then
|
|
26
|
-
|
|
20
|
+
____temp_0 = desc.configurable
|
|
27
21
|
else
|
|
28
|
-
|
|
22
|
+
____temp_0 = valueExists
|
|
29
23
|
end
|
|
30
|
-
local
|
|
24
|
+
local ____temp_1
|
|
31
25
|
if desc.enumerable ~= nil then
|
|
32
|
-
|
|
26
|
+
____temp_1 = desc.enumerable
|
|
33
27
|
else
|
|
34
|
-
|
|
28
|
+
____temp_1 = valueExists
|
|
35
29
|
end
|
|
36
|
-
local
|
|
30
|
+
local ____temp_2
|
|
37
31
|
if desc.writable ~= nil then
|
|
38
|
-
|
|
32
|
+
____temp_2 = desc.writable
|
|
39
33
|
else
|
|
40
|
-
|
|
34
|
+
____temp_2 = valueExists
|
|
41
35
|
end
|
|
42
|
-
local
|
|
36
|
+
local ____temp_3
|
|
43
37
|
if desc.value ~= nil then
|
|
44
|
-
|
|
38
|
+
____temp_3 = desc.value
|
|
45
39
|
else
|
|
46
|
-
|
|
40
|
+
____temp_3 = value
|
|
47
41
|
end
|
|
48
42
|
descriptor = {
|
|
49
|
-
set =
|
|
50
|
-
get =
|
|
51
|
-
configurable =
|
|
52
|
-
enumerable =
|
|
53
|
-
writable =
|
|
54
|
-
value =
|
|
43
|
+
set = ____desc_set_4,
|
|
44
|
+
get = ____desc_get_5,
|
|
45
|
+
configurable = ____temp_0,
|
|
46
|
+
enumerable = ____temp_1,
|
|
47
|
+
writable = ____temp_2,
|
|
48
|
+
value = ____temp_3
|
|
55
49
|
}
|
|
56
50
|
end
|
|
57
51
|
__TS__SetDescriptor(target, luaKey, descriptor)
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
local function __TS__ParseFloat(numberString)
|
|
2
2
|
local infinityMatch = __TS__Match(numberString, "^%s*(-?Infinity)")
|
|
3
|
-
if infinityMatch then
|
|
4
|
-
|
|
5
|
-
if __TS__StringAccess(infinityMatch, 0) == "-" then
|
|
6
|
-
____temp_0 = -math.huge
|
|
7
|
-
else
|
|
8
|
-
____temp_0 = math.huge
|
|
9
|
-
end
|
|
10
|
-
return ____temp_0
|
|
3
|
+
if infinityMatch ~= nil then
|
|
4
|
+
return __TS__StringAccess(infinityMatch, 0) == "-" and -math.huge or math.huge
|
|
11
5
|
end
|
|
12
6
|
local number = tonumber(__TS__Match(numberString, "^%s*(-?%d+%.?%d*)"))
|
|
13
7
|
return number or 0 / 0
|
|
@@ -5,27 +5,15 @@ do
|
|
|
5
5
|
if base == nil then
|
|
6
6
|
base = 10
|
|
7
7
|
local hexMatch = __TS__Match(numberString, "^%s*-?0[xX]")
|
|
8
|
-
if hexMatch then
|
|
8
|
+
if hexMatch ~= nil then
|
|
9
9
|
base = 16
|
|
10
|
-
|
|
11
|
-
if __TS__Match(hexMatch, "-") then
|
|
12
|
-
____TS__Match_result__0_0 = "-" .. __TS__StringSubstring(numberString, #hexMatch)
|
|
13
|
-
else
|
|
14
|
-
____TS__Match_result__0_0 = __TS__StringSubstring(numberString, #hexMatch)
|
|
15
|
-
end
|
|
16
|
-
numberString = ____TS__Match_result__0_0
|
|
10
|
+
numberString = __TS__Match(hexMatch, "-") and "-" .. __TS__StringSubstring(numberString, #hexMatch) or __TS__StringSubstring(numberString, #hexMatch)
|
|
17
11
|
end
|
|
18
12
|
end
|
|
19
13
|
if base < 2 or base > 36 then
|
|
20
14
|
return 0 / 0
|
|
21
15
|
end
|
|
22
|
-
local
|
|
23
|
-
if base <= 10 then
|
|
24
|
-
____temp_1 = __TS__StringSubstring(parseIntBasePattern, 0, base)
|
|
25
|
-
else
|
|
26
|
-
____temp_1 = __TS__StringSubstring(parseIntBasePattern, 0, 10 + 2 * (base - 10))
|
|
27
|
-
end
|
|
28
|
-
local allowedDigits = ____temp_1
|
|
16
|
+
local allowedDigits = base <= 10 and __TS__StringSubstring(parseIntBasePattern, 0, base) or __TS__StringSubstring(parseIntBasePattern, 0, 10 + 2 * (base - 10))
|
|
29
17
|
local pattern = ("^%s*(-?[" .. allowedDigits) .. "]*)"
|
|
30
18
|
local number = tonumber(
|
|
31
19
|
__TS__Match(numberString, pattern),
|
|
@@ -55,13 +55,13 @@ do
|
|
|
55
55
|
self.size = self.size - 1
|
|
56
56
|
local next = self.nextKey[value]
|
|
57
57
|
local previous = self.previousKey[value]
|
|
58
|
-
if next and previous then
|
|
58
|
+
if next ~= nil and previous ~= nil then
|
|
59
59
|
self.nextKey[previous] = next
|
|
60
60
|
self.previousKey[next] = previous
|
|
61
|
-
elseif next then
|
|
61
|
+
elseif next ~= nil then
|
|
62
62
|
self.firstKey = next
|
|
63
63
|
self.previousKey[next] = nil
|
|
64
|
-
elseif previous then
|
|
64
|
+
elseif previous ~= nil then
|
|
65
65
|
self.lastKey = previous
|
|
66
66
|
self.nextKey[previous] = nil
|
|
67
67
|
else
|
|
@@ -14,7 +14,7 @@ do
|
|
|
14
14
|
local descriptors = rawget(metatable, "_descriptors")
|
|
15
15
|
if descriptors then
|
|
16
16
|
local descriptor = descriptors[key]
|
|
17
|
-
if descriptor then
|
|
17
|
+
if descriptor ~= nil then
|
|
18
18
|
if descriptor.get then
|
|
19
19
|
return descriptor.get(self)
|
|
20
20
|
end
|
|
@@ -30,7 +30,7 @@ do
|
|
|
30
30
|
local descriptors = rawget(metatable, "_descriptors")
|
|
31
31
|
if descriptors then
|
|
32
32
|
local descriptor = descriptors[key]
|
|
33
|
-
if descriptor then
|
|
33
|
+
if descriptor ~= nil then
|
|
34
34
|
if descriptor.set then
|
|
35
35
|
descriptor.set(self, value)
|
|
36
36
|
else
|