typescript-to-lua 1.8.2 → 1.10.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 +1 -0
- package/dist/LuaAST.d.ts +43 -37
- package/dist/LuaAST.js +48 -38
- package/dist/LuaLib.d.ts +12 -6
- package/dist/LuaLib.js +31 -21
- package/dist/LuaPrinter.d.ts +1 -0
- package/dist/LuaPrinter.js +10 -4
- package/dist/lualib/5.0/ArrayConcat.lua +22 -0
- package/dist/lualib/{ArrayEntries.lua → 5.0/ArrayEntries.lua} +0 -0
- package/dist/lualib/5.0/ArrayEvery.lua +8 -0
- package/dist/lualib/5.0/ArrayFilter.lua +11 -0
- package/dist/lualib/5.0/ArrayFind.lua +9 -0
- package/dist/lualib/5.0/ArrayFindIndex.lua +8 -0
- package/dist/lualib/5.0/ArrayFlat.lua +27 -0
- package/dist/lualib/5.0/ArrayFlatMap.lua +17 -0
- package/dist/lualib/5.0/ArrayForEach.lua +5 -0
- package/dist/lualib/5.0/ArrayFrom.lua +29 -0
- package/dist/lualib/5.0/ArrayIncludes.lua +19 -0
- package/dist/lualib/5.0/ArrayIndexOf.lua +24 -0
- package/dist/lualib/{ArrayIsArray.lua → 5.0/ArrayIsArray.lua} +0 -0
- package/dist/lualib/5.0/ArrayJoin.lua +10 -0
- package/dist/lualib/5.0/ArrayMap.lua +7 -0
- package/dist/lualib/5.0/ArrayPush.lua +9 -0
- package/dist/lualib/5.0/ArrayPushArray.lua +8 -0
- package/dist/lualib/5.0/ArrayReduce.lua +23 -0
- package/dist/lualib/5.0/ArrayReduceRight.lua +23 -0
- package/dist/lualib/5.0/ArrayReverse.lua +12 -0
- package/dist/lualib/5.0/ArraySetLength.lua +12 -0
- package/dist/lualib/5.0/ArraySlice.lua +43 -0
- package/dist/lualib/5.0/ArraySome.lua +8 -0
- package/dist/lualib/{ArraySort.lua → 5.0/ArraySort.lua} +0 -0
- package/dist/lualib/5.0/ArraySplice.lua +77 -0
- package/dist/lualib/5.0/ArrayToObject.lua +7 -0
- package/dist/lualib/5.0/ArrayUnshift.lua +14 -0
- package/dist/lualib/{Await.lua → 5.0/Await.lua} +0 -0
- package/dist/lualib/{Class.lua → 5.0/Class.lua} +0 -0
- package/dist/lualib/{ClassExtends.lua → 5.0/ClassExtends.lua} +0 -0
- package/dist/lualib/{CloneDescriptor.lua → 5.0/CloneDescriptor.lua} +0 -0
- package/dist/lualib/5.0/CountVarargs.lua +4 -0
- package/dist/lualib/5.0/Decorate.lua +36 -0
- package/dist/lualib/{DecorateParam.lua → 5.0/DecorateParam.lua} +0 -0
- package/dist/lualib/5.0/DelegatedYield.lua +34 -0
- package/dist/lualib/{Delete.lua → 5.0/Delete.lua} +0 -0
- package/dist/lualib/5.0/Error.lua +85 -0
- package/dist/lualib/5.0/FunctionBind.lua +11 -0
- package/dist/lualib/5.0/Generator.lua +34 -0
- package/dist/lualib/{InstanceOf.lua → 5.0/InstanceOf.lua} +0 -0
- package/dist/lualib/{InstanceOfObject.lua → 5.0/InstanceOfObject.lua} +0 -0
- package/dist/lualib/5.0/Iterator.lua +40 -0
- package/dist/lualib/5.0/LuaIteratorSpread.lua +9 -0
- package/dist/lualib/{Map.lua → 5.0/Map.lua} +0 -0
- package/dist/lualib/5.0/Match.lua +13 -0
- package/dist/lualib/{MathAtan2.lua → 5.0/MathAtan2.lua} +0 -0
- package/dist/lualib/5.0/MathModf.lua +10 -0
- package/dist/lualib/{MathSign.lua → 5.0/MathSign.lua} +0 -0
- package/dist/lualib/5.0/Modulo50.lua +3 -0
- package/dist/lualib/5.0/New.lua +5 -0
- package/dist/lualib/5.0/Number.lua +26 -0
- package/dist/lualib/5.0/NumberIsFinite.lua +3 -0
- package/dist/lualib/{NumberIsNaN.lua → 5.0/NumberIsNaN.lua} +0 -0
- package/dist/lualib/5.0/NumberToString.lua +47 -0
- package/dist/lualib/5.0/ObjectAssign.lua +10 -0
- package/dist/lualib/{ObjectDefineProperty.lua → 5.0/ObjectDefineProperty.lua} +0 -0
- package/dist/lualib/{ObjectEntries.lua → 5.0/ObjectEntries.lua} +0 -0
- package/dist/lualib/{ObjectFromEntries.lua → 5.0/ObjectFromEntries.lua} +0 -0
- package/dist/lualib/{ObjectGetOwnPropertyDescriptor.lua → 5.0/ObjectGetOwnPropertyDescriptor.lua} +0 -0
- package/dist/lualib/{ObjectGetOwnPropertyDescriptors.lua → 5.0/ObjectGetOwnPropertyDescriptors.lua} +0 -0
- package/dist/lualib/{ObjectKeys.lua → 5.0/ObjectKeys.lua} +0 -0
- package/dist/lualib/{ObjectRest.lua → 5.0/ObjectRest.lua} +0 -0
- package/dist/lualib/{ObjectValues.lua → 5.0/ObjectValues.lua} +0 -0
- package/dist/lualib/5.0/ParseFloat.lua +18 -0
- package/dist/lualib/5.0/ParseInt.lua +49 -0
- package/dist/lualib/5.0/Promise.lua +176 -0
- package/dist/lualib/{PromiseAll.lua → 5.0/PromiseAll.lua} +0 -0
- package/dist/lualib/{PromiseAllSettled.lua → 5.0/PromiseAllSettled.lua} +0 -0
- package/dist/lualib/5.0/PromiseAny.lua +41 -0
- package/dist/lualib/5.0/PromiseRace.lua +28 -0
- package/dist/lualib/{Set.lua → 5.0/Set.lua} +0 -0
- package/dist/lualib/{SetDescriptor.lua → 5.0/SetDescriptor.lua} +0 -0
- package/dist/lualib/5.0/SourceMapTraceBack.lua +56 -0
- package/dist/lualib/5.0/SparseArrayNew.lua +5 -0
- package/dist/lualib/5.0/SparseArrayPush.lua +9 -0
- package/dist/lualib/5.0/SparseArraySpread.lua +3 -0
- package/dist/lualib/5.0/Spread.lua +15 -0
- package/dist/lualib/5.0/StringAccess.lua +5 -0
- package/dist/lualib/{StringCharAt.lua → 5.0/StringCharAt.lua} +0 -0
- package/dist/lualib/{StringCharCodeAt.lua → 5.0/StringCharCodeAt.lua} +0 -0
- package/dist/lualib/5.0/StringEndsWith.lua +10 -0
- package/dist/lualib/{StringIncludes.lua → 5.0/StringIncludes.lua} +0 -0
- package/dist/lualib/5.0/StringPadEnd.lua +26 -0
- package/dist/lualib/5.0/StringPadStart.lua +26 -0
- package/dist/lualib/{StringReplace.lua → 5.0/StringReplace.lua} +0 -0
- package/dist/lualib/5.0/StringReplaceAll.lua +42 -0
- package/dist/lualib/{StringSlice.lua → 5.0/StringSlice.lua} +0 -0
- package/dist/lualib/5.0/StringSplit.lua +36 -0
- package/dist/lualib/5.0/StringStartsWith.lua +10 -0
- package/dist/lualib/{StringSubstr.lua → 5.0/StringSubstr.lua} +0 -0
- package/dist/lualib/{StringSubstring.lua → 5.0/StringSubstring.lua} +0 -0
- package/dist/lualib/{StringTrim.lua → 5.0/StringTrim.lua} +0 -0
- package/dist/lualib/{StringTrimEnd.lua → 5.0/StringTrimEnd.lua} +0 -0
- package/dist/lualib/{StringTrimStart.lua → 5.0/StringTrimStart.lua} +0 -0
- package/dist/lualib/{Symbol.lua → 5.0/Symbol.lua} +0 -0
- package/dist/lualib/{SymbolRegistry.lua → 5.0/SymbolRegistry.lua} +0 -0
- package/dist/lualib/{TypeOf.lua → 5.0/TypeOf.lua} +0 -0
- package/dist/lualib/5.0/Unpack.lua +1 -0
- package/dist/lualib/{WeakMap.lua → 5.0/WeakMap.lua} +0 -0
- package/dist/lualib/{WeakSet.lua → 5.0/WeakSet.lua} +0 -0
- package/dist/lualib/5.0/lualib_bundle.lua +2574 -0
- package/dist/lualib/5.0/lualib_module_info.json +672 -0
- package/dist/lualib/{ArrayConcat.lua → universal/ArrayConcat.lua} +0 -0
- package/dist/lualib/universal/ArrayEntries.lua +13 -0
- package/dist/lualib/{ArrayEvery.lua → universal/ArrayEvery.lua} +0 -0
- package/dist/lualib/{ArrayFilter.lua → universal/ArrayFilter.lua} +0 -0
- package/dist/lualib/{ArrayFind.lua → universal/ArrayFind.lua} +0 -0
- package/dist/lualib/{ArrayFindIndex.lua → universal/ArrayFindIndex.lua} +0 -0
- package/dist/lualib/{ArrayFlat.lua → universal/ArrayFlat.lua} +0 -0
- package/dist/lualib/{ArrayFlatMap.lua → universal/ArrayFlatMap.lua} +0 -0
- package/dist/lualib/{ArrayForEach.lua → universal/ArrayForEach.lua} +0 -0
- package/dist/lualib/{ArrayFrom.lua → universal/ArrayFrom.lua} +0 -0
- package/dist/lualib/{ArrayIncludes.lua → universal/ArrayIncludes.lua} +0 -0
- package/dist/lualib/{ArrayIndexOf.lua → universal/ArrayIndexOf.lua} +0 -0
- package/dist/lualib/universal/ArrayIsArray.lua +3 -0
- package/dist/lualib/{ArrayJoin.lua → universal/ArrayJoin.lua} +0 -0
- package/dist/lualib/{ArrayMap.lua → universal/ArrayMap.lua} +0 -0
- package/dist/lualib/{ArrayPush.lua → universal/ArrayPush.lua} +0 -0
- package/dist/lualib/{ArrayPushArray.lua → universal/ArrayPushArray.lua} +0 -0
- package/dist/lualib/{ArrayReduce.lua → universal/ArrayReduce.lua} +1 -1
- package/dist/lualib/{ArrayReduceRight.lua → universal/ArrayReduceRight.lua} +1 -1
- package/dist/lualib/{ArrayReverse.lua → universal/ArrayReverse.lua} +0 -0
- package/dist/lualib/{ArraySetLength.lua → universal/ArraySetLength.lua} +0 -0
- package/dist/lualib/{ArraySlice.lua → universal/ArraySlice.lua} +0 -0
- package/dist/lualib/{ArraySome.lua → universal/ArraySome.lua} +0 -0
- package/dist/lualib/universal/ArraySort.lua +11 -0
- package/dist/lualib/{ArraySplice.lua → universal/ArraySplice.lua} +1 -1
- package/dist/lualib/{ArrayToObject.lua → universal/ArrayToObject.lua} +0 -0
- package/dist/lualib/{ArrayUnshift.lua → universal/ArrayUnshift.lua} +0 -0
- package/dist/lualib/universal/Await.lua +54 -0
- package/dist/lualib/universal/Class.lua +6 -0
- package/dist/lualib/universal/ClassExtends.lua +24 -0
- package/dist/lualib/universal/CloneDescriptor.lua +28 -0
- package/dist/lualib/universal/CountVarargs.lua +3 -0
- package/dist/lualib/{Decorate.lua → universal/Decorate.lua} +0 -0
- package/dist/lualib/universal/DecorateParam.lua +3 -0
- package/dist/lualib/{DelegatedYield.lua → universal/DelegatedYield.lua} +0 -0
- package/dist/lualib/universal/Delete.lua +19 -0
- package/dist/lualib/{Error.lua → universal/Error.lua} +7 -2
- package/dist/lualib/{FunctionBind.lua → universal/FunctionBind.lua} +0 -0
- package/dist/lualib/{Generator.lua → universal/Generator.lua} +2 -9
- package/dist/lualib/universal/InstanceOf.lua +18 -0
- package/dist/lualib/universal/InstanceOfObject.lua +4 -0
- package/dist/lualib/{Iterator.lua → universal/Iterator.lua} +0 -0
- package/dist/lualib/{LuaIteratorSpread.lua → universal/LuaIteratorSpread.lua} +0 -0
- package/dist/lualib/universal/Map.lua +140 -0
- package/dist/lualib/universal/Match.lua +1 -0
- package/dist/lualib/universal/MathAtan2.lua +1 -0
- package/dist/lualib/universal/MathModf.lua +1 -0
- package/dist/lualib/universal/MathSign.lua +8 -0
- package/dist/lualib/universal/Modulo50.lua +3 -0
- package/dist/lualib/{New.lua → universal/New.lua} +0 -0
- package/dist/lualib/{Number.lua → universal/Number.lua} +0 -0
- package/dist/lualib/{NumberIsFinite.lua → universal/NumberIsFinite.lua} +0 -0
- package/dist/lualib/universal/NumberIsNaN.lua +3 -0
- package/dist/lualib/{NumberToString.lua → universal/NumberToString.lua} +1 -1
- package/dist/lualib/{ObjectAssign.lua → universal/ObjectAssign.lua} +0 -0
- package/dist/lualib/universal/ObjectDefineProperty.lua +59 -0
- package/dist/lualib/universal/ObjectEntries.lua +9 -0
- package/dist/lualib/universal/ObjectFromEntries.lua +20 -0
- package/dist/lualib/universal/ObjectGetOwnPropertyDescriptor.lua +10 -0
- package/dist/lualib/universal/ObjectGetOwnPropertyDescriptors.lua +7 -0
- package/dist/lualib/universal/ObjectKeys.lua +9 -0
- package/dist/lualib/universal/ObjectRest.lua +9 -0
- package/dist/lualib/universal/ObjectValues.lua +9 -0
- package/dist/lualib/{ParseFloat.lua → universal/ParseFloat.lua} +2 -2
- package/dist/lualib/{ParseInt.lua → universal/ParseInt.lua} +7 -7
- package/dist/lualib/{Promise.lua → universal/Promise.lua} +0 -0
- package/dist/lualib/universal/PromiseAll.lua +44 -0
- package/dist/lualib/universal/PromiseAllSettled.lua +48 -0
- package/dist/lualib/{PromiseAny.lua → universal/PromiseAny.lua} +0 -0
- package/dist/lualib/{PromiseRace.lua → universal/PromiseRace.lua} +0 -0
- package/dist/lualib/universal/Set.lua +130 -0
- package/dist/lualib/universal/SetDescriptor.lua +79 -0
- package/dist/lualib/{SourceMapTraceBack.lua → universal/SourceMapTraceBack.lua} +3 -1
- package/dist/lualib/{SparseArrayNew.lua → universal/SparseArrayNew.lua} +1 -1
- package/dist/lualib/{SparseArrayPush.lua → universal/SparseArrayPush.lua} +1 -1
- package/dist/lualib/{SparseArraySpread.lua → universal/SparseArraySpread.lua} +0 -0
- package/dist/lualib/{Spread.lua → universal/Spread.lua} +0 -0
- package/dist/lualib/{StringAccess.lua → universal/StringAccess.lua} +0 -0
- package/dist/lualib/universal/StringCharAt.lua +9 -0
- package/dist/lualib/universal/StringCharCodeAt.lua +13 -0
- package/dist/lualib/{StringEndsWith.lua → universal/StringEndsWith.lua} +0 -0
- package/dist/lualib/universal/StringIncludes.lua +9 -0
- package/dist/lualib/{StringPadEnd.lua → universal/StringPadEnd.lua} +0 -0
- package/dist/lualib/{StringPadStart.lua → universal/StringPadStart.lua} +0 -0
- package/dist/lualib/universal/StringReplace.lua +20 -0
- package/dist/lualib/{StringReplaceAll.lua → universal/StringReplaceAll.lua} +0 -0
- package/dist/lualib/universal/StringSlice.lua +15 -0
- package/dist/lualib/{StringSplit.lua → universal/StringSplit.lua} +0 -0
- package/dist/lualib/{StringStartsWith.lua → universal/StringStartsWith.lua} +0 -0
- package/dist/lualib/universal/StringSubstr.lua +15 -0
- package/dist/lualib/universal/StringSubstring.lua +17 -0
- package/dist/lualib/universal/StringTrim.lua +4 -0
- package/dist/lualib/universal/StringTrimEnd.lua +4 -0
- package/dist/lualib/universal/StringTrimStart.lua +4 -0
- package/dist/lualib/universal/Symbol.lua +15 -0
- package/dist/lualib/universal/SymbolRegistry.lua +17 -0
- package/dist/lualib/universal/TypeOf.lua +10 -0
- package/dist/lualib/{Unpack.lua → universal/Unpack.lua} +0 -0
- package/dist/lualib/universal/WeakMap.lua +45 -0
- package/dist/lualib/universal/WeakSet.lua +41 -0
- package/dist/lualib/{lualib_bundle.lua → universal/lualib_bundle.lua} +53 -37
- package/dist/lualib/{lualib_module_info.json → universal/lualib_module_info.json} +49 -4
- package/dist/lualib-build/plugin.js +12 -2
- package/dist/transformation/builtins/array.d.ts +1 -1
- package/dist/transformation/builtins/array.js +12 -2
- package/dist/transformation/builtins/function.js +4 -2
- package/dist/transformation/builtins/index.js +11 -3
- package/dist/transformation/builtins/string.d.ts +1 -1
- package/dist/transformation/builtins/string.js +8 -1
- package/dist/transformation/utils/diagnostics.d.ts +5 -4
- package/dist/transformation/utils/diagnostics.js +2 -1
- package/dist/transformation/utils/lua-ast.js +3 -1
- package/dist/transformation/utils/typescript/index.js +2 -2
- package/dist/transformation/visitors/access.js +11 -0
- package/dist/transformation/visitors/binary-expression/bit.js +4 -2
- package/dist/transformation/visitors/binary-expression/index.js +4 -0
- package/dist/transformation/visitors/break-continue.js +4 -2
- package/dist/transformation/visitors/class/index.js +9 -4
- package/dist/transformation/visitors/class/members/fields.js +6 -2
- package/dist/transformation/visitors/class/members/method.js +4 -2
- package/dist/transformation/visitors/conditional.d.ts +1 -0
- package/dist/transformation/visitors/conditional.js +12 -1
- package/dist/transformation/visitors/errors.js +4 -2
- package/dist/transformation/visitors/function.js +2 -1
- package/dist/transformation/visitors/identifier.js +4 -1
- package/dist/transformation/visitors/language-extensions/operators.js +2 -1
- package/dist/transformation/visitors/literal.js +12 -4
- package/dist/transformation/visitors/loops/do-while.js +5 -0
- package/dist/transformation/visitors/modules/export.js +1 -1
- package/dist/transformation/visitors/spread.js +4 -1
- package/dist/transformation/visitors/typescript.js +1 -0
- package/dist/transpilation/bundle.js +15 -6
- package/dist/transpilation/resolve.js +3 -3
- package/dist/transpilation/transpiler.js +3 -1
- package/package.json +18 -18
- package/language-extensions/index.d.ts +0 -676
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
local function __TS__AsyncAwaiter(generator)
|
|
2
|
+
return __TS__New(
|
|
3
|
+
__TS__Promise,
|
|
4
|
+
function(____, resolve, reject)
|
|
5
|
+
local adopt, fulfilled, step, resolved, asyncCoroutine
|
|
6
|
+
function adopt(self, value)
|
|
7
|
+
local ____temp_0
|
|
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
|
|
14
|
+
end
|
|
15
|
+
function fulfilled(self, value)
|
|
16
|
+
local success, resultOrError = coroutine.resume(asyncCoroutine, value)
|
|
17
|
+
if success then
|
|
18
|
+
step(nil, resultOrError)
|
|
19
|
+
else
|
|
20
|
+
reject(nil, resultOrError)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
function step(self, result)
|
|
24
|
+
if resolved then
|
|
25
|
+
return
|
|
26
|
+
end
|
|
27
|
+
if coroutine.status(asyncCoroutine) == "dead" then
|
|
28
|
+
resolve(nil, result)
|
|
29
|
+
else
|
|
30
|
+
local ____self_1 = adopt(nil, result)
|
|
31
|
+
____self_1["then"](____self_1, fulfilled, reject)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
resolved = false
|
|
35
|
+
asyncCoroutine = coroutine.create(generator)
|
|
36
|
+
local success, resultOrError = coroutine.resume(
|
|
37
|
+
asyncCoroutine,
|
|
38
|
+
function(____, v)
|
|
39
|
+
resolved = true
|
|
40
|
+
local ____self_2 = adopt(nil, v)
|
|
41
|
+
____self_2["then"](____self_2, resolve, reject)
|
|
42
|
+
end
|
|
43
|
+
)
|
|
44
|
+
if success then
|
|
45
|
+
step(nil, resultOrError)
|
|
46
|
+
else
|
|
47
|
+
reject(nil, resultOrError)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
)
|
|
51
|
+
end
|
|
52
|
+
local function __TS__Await(thing)
|
|
53
|
+
return coroutine.yield(thing)
|
|
54
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
local function __TS__ClassExtends(target, base)
|
|
2
|
+
target.____super = base
|
|
3
|
+
local staticMetatable = setmetatable({__index = base}, base)
|
|
4
|
+
setmetatable(target, staticMetatable)
|
|
5
|
+
local baseMetatable = getmetatable(base)
|
|
6
|
+
if baseMetatable then
|
|
7
|
+
if type(baseMetatable.__index) == "function" then
|
|
8
|
+
staticMetatable.__index = baseMetatable.__index
|
|
9
|
+
end
|
|
10
|
+
if type(baseMetatable.__newindex) == "function" then
|
|
11
|
+
staticMetatable.__newindex = baseMetatable.__newindex
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
setmetatable(target.prototype, base.prototype)
|
|
15
|
+
if type(base.prototype.__index) == "function" then
|
|
16
|
+
target.prototype.__index = base.prototype.__index
|
|
17
|
+
end
|
|
18
|
+
if type(base.prototype.__newindex) == "function" then
|
|
19
|
+
target.prototype.__newindex = base.prototype.__newindex
|
|
20
|
+
end
|
|
21
|
+
if type(base.prototype.__tostring) == "function" then
|
|
22
|
+
target.prototype.__tostring = base.prototype.__tostring
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
local function __TS__CloneDescriptor(____bindingPattern0)
|
|
2
|
+
local value
|
|
3
|
+
local writable
|
|
4
|
+
local set
|
|
5
|
+
local get
|
|
6
|
+
local configurable
|
|
7
|
+
local enumerable
|
|
8
|
+
enumerable = ____bindingPattern0.enumerable
|
|
9
|
+
configurable = ____bindingPattern0.configurable
|
|
10
|
+
get = ____bindingPattern0.get
|
|
11
|
+
set = ____bindingPattern0.set
|
|
12
|
+
writable = ____bindingPattern0.writable
|
|
13
|
+
value = ____bindingPattern0.value
|
|
14
|
+
local descriptor = {enumerable = enumerable == true, configurable = configurable == true}
|
|
15
|
+
local hasGetterOrSetter = get ~= nil or set ~= nil
|
|
16
|
+
local hasValueOrWritableAttribute = writable ~= nil or value ~= nil
|
|
17
|
+
if hasGetterOrSetter and hasValueOrWritableAttribute then
|
|
18
|
+
error("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute.", 0)
|
|
19
|
+
end
|
|
20
|
+
if get or set then
|
|
21
|
+
descriptor.get = get
|
|
22
|
+
descriptor.set = set
|
|
23
|
+
else
|
|
24
|
+
descriptor.value = value
|
|
25
|
+
descriptor.writable = writable == true
|
|
26
|
+
end
|
|
27
|
+
return descriptor
|
|
28
|
+
end
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
local function __TS__Delete(target, key)
|
|
2
|
+
local descriptors = __TS__ObjectGetOwnPropertyDescriptors(target)
|
|
3
|
+
local descriptor = descriptors[key]
|
|
4
|
+
if descriptor then
|
|
5
|
+
if not descriptor.configurable then
|
|
6
|
+
error(
|
|
7
|
+
__TS__New(
|
|
8
|
+
TypeError,
|
|
9
|
+
((("Cannot delete property " .. tostring(key)) .. " of ") .. tostring(target)) .. "."
|
|
10
|
+
),
|
|
11
|
+
0
|
|
12
|
+
)
|
|
13
|
+
end
|
|
14
|
+
descriptors[key] = nil
|
|
15
|
+
return true
|
|
16
|
+
end
|
|
17
|
+
target[key] = nil
|
|
18
|
+
return true
|
|
19
|
+
end
|
|
@@ -12,13 +12,18 @@ do
|
|
|
12
12
|
break
|
|
13
13
|
end
|
|
14
14
|
end
|
|
15
|
-
|
|
15
|
+
if __TS__StringIncludes(_VERSION, "Lua 5.0") then
|
|
16
|
+
return debug.traceback(("[Level " .. tostring(level)) .. "]")
|
|
17
|
+
else
|
|
18
|
+
return debug.traceback(nil, level)
|
|
19
|
+
end
|
|
16
20
|
end
|
|
17
21
|
local function wrapErrorToString(self, getDescription)
|
|
18
22
|
return function(self)
|
|
19
23
|
local description = getDescription(self)
|
|
20
24
|
local caller = debug.getinfo(3, "f")
|
|
21
|
-
|
|
25
|
+
local isClassicLua = __TS__StringIncludes(_VERSION, "Lua 5.0") or _VERSION == "Lua 5.1"
|
|
26
|
+
if isClassicLua or caller and caller.func ~= error then
|
|
22
27
|
return description
|
|
23
28
|
else
|
|
24
29
|
return (tostring(description) .. "\n") .. self.stack
|
|
File without changes
|
|
@@ -20,16 +20,9 @@ do
|
|
|
20
20
|
function __TS__Generator(fn)
|
|
21
21
|
return function(...)
|
|
22
22
|
local args = {...}
|
|
23
|
-
local argsLength =
|
|
23
|
+
local argsLength = __TS__CountVarargs(...)
|
|
24
24
|
return {
|
|
25
|
-
____coroutine = coroutine.create(function()
|
|
26
|
-
local ____fn_1 = fn
|
|
27
|
-
local ____unpack_0 = unpack
|
|
28
|
-
if ____unpack_0 == nil then
|
|
29
|
-
____unpack_0 = table.unpack
|
|
30
|
-
end
|
|
31
|
-
return ____fn_1(____unpack_0(args, 1, argsLength))
|
|
32
|
-
end),
|
|
25
|
+
____coroutine = coroutine.create(function() return fn(__TS__Unpack(args, 1, argsLength)) end),
|
|
33
26
|
[Symbol.iterator] = generatorIterator,
|
|
34
27
|
next = generatorNext
|
|
35
28
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
local function __TS__InstanceOf(obj, classTbl)
|
|
2
|
+
if type(classTbl) ~= "table" then
|
|
3
|
+
error("Right-hand side of 'instanceof' is not an object", 0)
|
|
4
|
+
end
|
|
5
|
+
if classTbl[Symbol.hasInstance] ~= nil then
|
|
6
|
+
return not not classTbl[Symbol.hasInstance](classTbl, obj)
|
|
7
|
+
end
|
|
8
|
+
if type(obj) == "table" then
|
|
9
|
+
local luaClass = obj.constructor
|
|
10
|
+
while luaClass ~= nil do
|
|
11
|
+
if luaClass == classTbl then
|
|
12
|
+
return true
|
|
13
|
+
end
|
|
14
|
+
luaClass = luaClass.____super
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
return false
|
|
18
|
+
end
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
local Map
|
|
2
|
+
do
|
|
3
|
+
Map = __TS__Class()
|
|
4
|
+
Map.name = "Map"
|
|
5
|
+
function Map.prototype.____constructor(self, entries)
|
|
6
|
+
self[Symbol.toStringTag] = "Map"
|
|
7
|
+
self.items = {}
|
|
8
|
+
self.size = 0
|
|
9
|
+
self.nextKey = {}
|
|
10
|
+
self.previousKey = {}
|
|
11
|
+
if entries == nil then
|
|
12
|
+
return
|
|
13
|
+
end
|
|
14
|
+
local iterable = entries
|
|
15
|
+
if iterable[Symbol.iterator] then
|
|
16
|
+
local iterator = iterable[Symbol.iterator](iterable)
|
|
17
|
+
while true do
|
|
18
|
+
local result = iterator:next()
|
|
19
|
+
if result.done then
|
|
20
|
+
break
|
|
21
|
+
end
|
|
22
|
+
local value = result.value
|
|
23
|
+
self:set(value[1], value[2])
|
|
24
|
+
end
|
|
25
|
+
else
|
|
26
|
+
local array = entries
|
|
27
|
+
for ____, kvp in ipairs(array) do
|
|
28
|
+
self:set(kvp[1], kvp[2])
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
function Map.prototype.clear(self)
|
|
33
|
+
self.items = {}
|
|
34
|
+
self.nextKey = {}
|
|
35
|
+
self.previousKey = {}
|
|
36
|
+
self.firstKey = nil
|
|
37
|
+
self.lastKey = nil
|
|
38
|
+
self.size = 0
|
|
39
|
+
end
|
|
40
|
+
function Map.prototype.delete(self, key)
|
|
41
|
+
local contains = self:has(key)
|
|
42
|
+
if contains then
|
|
43
|
+
self.size = self.size - 1
|
|
44
|
+
local next = self.nextKey[key]
|
|
45
|
+
local previous = self.previousKey[key]
|
|
46
|
+
if next and previous then
|
|
47
|
+
self.nextKey[previous] = next
|
|
48
|
+
self.previousKey[next] = previous
|
|
49
|
+
elseif next then
|
|
50
|
+
self.firstKey = next
|
|
51
|
+
self.previousKey[next] = nil
|
|
52
|
+
elseif previous then
|
|
53
|
+
self.lastKey = previous
|
|
54
|
+
self.nextKey[previous] = nil
|
|
55
|
+
else
|
|
56
|
+
self.firstKey = nil
|
|
57
|
+
self.lastKey = nil
|
|
58
|
+
end
|
|
59
|
+
self.nextKey[key] = nil
|
|
60
|
+
self.previousKey[key] = nil
|
|
61
|
+
end
|
|
62
|
+
self.items[key] = nil
|
|
63
|
+
return contains
|
|
64
|
+
end
|
|
65
|
+
function Map.prototype.forEach(self, callback)
|
|
66
|
+
for ____, key in __TS__Iterator(self:keys()) do
|
|
67
|
+
callback(nil, self.items[key], key, self)
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
function Map.prototype.get(self, key)
|
|
71
|
+
return self.items[key]
|
|
72
|
+
end
|
|
73
|
+
function Map.prototype.has(self, key)
|
|
74
|
+
return self.nextKey[key] ~= nil or self.lastKey == key
|
|
75
|
+
end
|
|
76
|
+
function Map.prototype.set(self, key, value)
|
|
77
|
+
local isNewValue = not self:has(key)
|
|
78
|
+
if isNewValue then
|
|
79
|
+
self.size = self.size + 1
|
|
80
|
+
end
|
|
81
|
+
self.items[key] = value
|
|
82
|
+
if self.firstKey == nil then
|
|
83
|
+
self.firstKey = key
|
|
84
|
+
self.lastKey = key
|
|
85
|
+
elseif isNewValue then
|
|
86
|
+
self.nextKey[self.lastKey] = key
|
|
87
|
+
self.previousKey[key] = self.lastKey
|
|
88
|
+
self.lastKey = key
|
|
89
|
+
end
|
|
90
|
+
return self
|
|
91
|
+
end
|
|
92
|
+
Map.prototype[Symbol.iterator] = function(self)
|
|
93
|
+
return self:entries()
|
|
94
|
+
end
|
|
95
|
+
function Map.prototype.entries(self)
|
|
96
|
+
local items = self.items
|
|
97
|
+
local nextKey = self.nextKey
|
|
98
|
+
local key = self.firstKey
|
|
99
|
+
return {
|
|
100
|
+
[Symbol.iterator] = function(self)
|
|
101
|
+
return self
|
|
102
|
+
end,
|
|
103
|
+
next = function(self)
|
|
104
|
+
local result = {done = not key, value = {key, items[key]}}
|
|
105
|
+
key = nextKey[key]
|
|
106
|
+
return result
|
|
107
|
+
end
|
|
108
|
+
}
|
|
109
|
+
end
|
|
110
|
+
function Map.prototype.keys(self)
|
|
111
|
+
local nextKey = self.nextKey
|
|
112
|
+
local key = self.firstKey
|
|
113
|
+
return {
|
|
114
|
+
[Symbol.iterator] = function(self)
|
|
115
|
+
return self
|
|
116
|
+
end,
|
|
117
|
+
next = function(self)
|
|
118
|
+
local result = {done = not key, value = key}
|
|
119
|
+
key = nextKey[key]
|
|
120
|
+
return result
|
|
121
|
+
end
|
|
122
|
+
}
|
|
123
|
+
end
|
|
124
|
+
function Map.prototype.values(self)
|
|
125
|
+
local items = self.items
|
|
126
|
+
local nextKey = self.nextKey
|
|
127
|
+
local key = self.firstKey
|
|
128
|
+
return {
|
|
129
|
+
[Symbol.iterator] = function(self)
|
|
130
|
+
return self
|
|
131
|
+
end,
|
|
132
|
+
next = function(self)
|
|
133
|
+
local result = {done = not key, value = items[key]}
|
|
134
|
+
key = nextKey[key]
|
|
135
|
+
return result
|
|
136
|
+
end
|
|
137
|
+
}
|
|
138
|
+
end
|
|
139
|
+
Map[Symbol.species] = Map
|
|
140
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
local __TS__Match = string.match
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
local __TS__MathAtan2 = math.atan2 or math.atan
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
local __TS__MathModf = math.modf
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -9,7 +9,7 @@ do
|
|
|
9
9
|
if radix < 2 or radix > 36 then
|
|
10
10
|
error("toString() radix argument must be between 2 and 36", 0)
|
|
11
11
|
end
|
|
12
|
-
local integer, fraction =
|
|
12
|
+
local integer, fraction = __TS__MathModf(math.abs(self))
|
|
13
13
|
local result = ""
|
|
14
14
|
if radix == 8 then
|
|
15
15
|
result = string.format("%o", integer)
|
|
File without changes
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
local function __TS__ObjectDefineProperty(target, key, desc)
|
|
2
|
+
local ____temp_0
|
|
3
|
+
if type(key) == "number" then
|
|
4
|
+
____temp_0 = key + 1
|
|
5
|
+
else
|
|
6
|
+
____temp_0 = key
|
|
7
|
+
end
|
|
8
|
+
local luaKey = ____temp_0
|
|
9
|
+
local value = rawget(target, luaKey)
|
|
10
|
+
local hasGetterOrSetter = desc.get ~= nil or desc.set ~= nil
|
|
11
|
+
local descriptor
|
|
12
|
+
if hasGetterOrSetter then
|
|
13
|
+
if value ~= nil then
|
|
14
|
+
error(
|
|
15
|
+
"Cannot redefine property: " .. tostring(key),
|
|
16
|
+
0
|
|
17
|
+
)
|
|
18
|
+
end
|
|
19
|
+
descriptor = desc
|
|
20
|
+
else
|
|
21
|
+
local valueExists = value ~= nil
|
|
22
|
+
local ____desc_set_5 = desc.set
|
|
23
|
+
local ____desc_get_6 = desc.get
|
|
24
|
+
local ____temp_1
|
|
25
|
+
if desc.configurable ~= nil then
|
|
26
|
+
____temp_1 = desc.configurable
|
|
27
|
+
else
|
|
28
|
+
____temp_1 = valueExists
|
|
29
|
+
end
|
|
30
|
+
local ____temp_2
|
|
31
|
+
if desc.enumerable ~= nil then
|
|
32
|
+
____temp_2 = desc.enumerable
|
|
33
|
+
else
|
|
34
|
+
____temp_2 = valueExists
|
|
35
|
+
end
|
|
36
|
+
local ____temp_3
|
|
37
|
+
if desc.writable ~= nil then
|
|
38
|
+
____temp_3 = desc.writable
|
|
39
|
+
else
|
|
40
|
+
____temp_3 = valueExists
|
|
41
|
+
end
|
|
42
|
+
local ____temp_4
|
|
43
|
+
if desc.value ~= nil then
|
|
44
|
+
____temp_4 = desc.value
|
|
45
|
+
else
|
|
46
|
+
____temp_4 = value
|
|
47
|
+
end
|
|
48
|
+
descriptor = {
|
|
49
|
+
set = ____desc_set_5,
|
|
50
|
+
get = ____desc_get_6,
|
|
51
|
+
configurable = ____temp_1,
|
|
52
|
+
enumerable = ____temp_2,
|
|
53
|
+
writable = ____temp_3,
|
|
54
|
+
value = ____temp_4
|
|
55
|
+
}
|
|
56
|
+
end
|
|
57
|
+
__TS__SetDescriptor(target, luaKey, descriptor)
|
|
58
|
+
return target
|
|
59
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
local function __TS__ObjectFromEntries(entries)
|
|
2
|
+
local obj = {}
|
|
3
|
+
local iterable = entries
|
|
4
|
+
if iterable[Symbol.iterator] then
|
|
5
|
+
local iterator = iterable[Symbol.iterator](iterable)
|
|
6
|
+
while true do
|
|
7
|
+
local result = iterator:next()
|
|
8
|
+
if result.done then
|
|
9
|
+
break
|
|
10
|
+
end
|
|
11
|
+
local value = result.value
|
|
12
|
+
obj[value[1]] = value[2]
|
|
13
|
+
end
|
|
14
|
+
else
|
|
15
|
+
for ____, entry in ipairs(entries) do
|
|
16
|
+
obj[entry[1]] = entry[2]
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
return obj
|
|
20
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
local function __TS__ObjectGetOwnPropertyDescriptor(object, key)
|
|
2
|
+
local metatable = getmetatable(object)
|
|
3
|
+
if not metatable then
|
|
4
|
+
return
|
|
5
|
+
end
|
|
6
|
+
if not rawget(metatable, "_descriptors") then
|
|
7
|
+
return
|
|
8
|
+
end
|
|
9
|
+
return rawget(metatable, "_descriptors")[key]
|
|
10
|
+
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
local function __TS__ParseFloat(numberString)
|
|
2
|
-
local infinityMatch =
|
|
2
|
+
local infinityMatch = __TS__Match(numberString, "^%s*(-?Infinity)")
|
|
3
3
|
if infinityMatch then
|
|
4
4
|
local ____temp_0
|
|
5
5
|
if __TS__StringAccess(infinityMatch, 0) == "-" then
|
|
@@ -9,7 +9,7 @@ local function __TS__ParseFloat(numberString)
|
|
|
9
9
|
end
|
|
10
10
|
return ____temp_0
|
|
11
11
|
end
|
|
12
|
-
local number = tonumber(
|
|
12
|
+
local number = tonumber(__TS__Match(numberString, "^%s*(-?%d+%.?%d*)"))
|
|
13
13
|
local ____number_1 = number
|
|
14
14
|
if ____number_1 == nil then
|
|
15
15
|
____number_1 = 0 / 0
|