typescript-to-lua 1.10.0-beta.0 → 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.
Files changed (105) hide show
  1. package/dist/transpilation/resolve.js +3 -3
  2. package/package.json +2 -2
  3. package/dist/lualib/ArrayConcat.lua +0 -22
  4. package/dist/lualib/ArrayEntries.lua +0 -13
  5. package/dist/lualib/ArrayEvery.lua +0 -8
  6. package/dist/lualib/ArrayFilter.lua +0 -11
  7. package/dist/lualib/ArrayFind.lua +0 -9
  8. package/dist/lualib/ArrayFindIndex.lua +0 -8
  9. package/dist/lualib/ArrayFlat.lua +0 -27
  10. package/dist/lualib/ArrayFlatMap.lua +0 -17
  11. package/dist/lualib/ArrayForEach.lua +0 -5
  12. package/dist/lualib/ArrayFrom.lua +0 -29
  13. package/dist/lualib/ArrayIncludes.lua +0 -19
  14. package/dist/lualib/ArrayIndexOf.lua +0 -24
  15. package/dist/lualib/ArrayIsArray.lua +0 -3
  16. package/dist/lualib/ArrayJoin.lua +0 -10
  17. package/dist/lualib/ArrayMap.lua +0 -7
  18. package/dist/lualib/ArrayPush.lua +0 -9
  19. package/dist/lualib/ArrayPushArray.lua +0 -8
  20. package/dist/lualib/ArrayReduce.lua +0 -23
  21. package/dist/lualib/ArrayReduceRight.lua +0 -23
  22. package/dist/lualib/ArrayReverse.lua +0 -12
  23. package/dist/lualib/ArraySetLength.lua +0 -12
  24. package/dist/lualib/ArraySlice.lua +0 -43
  25. package/dist/lualib/ArraySome.lua +0 -8
  26. package/dist/lualib/ArraySort.lua +0 -11
  27. package/dist/lualib/ArraySplice.lua +0 -77
  28. package/dist/lualib/ArrayToObject.lua +0 -7
  29. package/dist/lualib/ArrayUnshift.lua +0 -14
  30. package/dist/lualib/Await.lua +0 -54
  31. package/dist/lualib/Class.lua +0 -6
  32. package/dist/lualib/ClassExtends.lua +0 -24
  33. package/dist/lualib/CloneDescriptor.lua +0 -28
  34. package/dist/lualib/Decorate.lua +0 -36
  35. package/dist/lualib/DecorateParam.lua +0 -3
  36. package/dist/lualib/DelegatedYield.lua +0 -34
  37. package/dist/lualib/Delete.lua +0 -19
  38. package/dist/lualib/Error.lua +0 -77
  39. package/dist/lualib/FunctionBind.lua +0 -11
  40. package/dist/lualib/Generator.lua +0 -38
  41. package/dist/lualib/InstanceOf.lua +0 -18
  42. package/dist/lualib/InstanceOfObject.lua +0 -4
  43. package/dist/lualib/Iterator.lua +0 -40
  44. package/dist/lualib/LuaIteratorSpread.lua +0 -9
  45. package/dist/lualib/Map.lua +0 -140
  46. package/dist/lualib/MathAtan2.lua +0 -1
  47. package/dist/lualib/MathSign.lua +0 -8
  48. package/dist/lualib/New.lua +0 -5
  49. package/dist/lualib/Number.lua +0 -26
  50. package/dist/lualib/NumberIsFinite.lua +0 -3
  51. package/dist/lualib/NumberIsNaN.lua +0 -3
  52. package/dist/lualib/NumberToString.lua +0 -44
  53. package/dist/lualib/ObjectAssign.lua +0 -10
  54. package/dist/lualib/ObjectDefineProperty.lua +0 -59
  55. package/dist/lualib/ObjectEntries.lua +0 -9
  56. package/dist/lualib/ObjectFromEntries.lua +0 -20
  57. package/dist/lualib/ObjectGetOwnPropertyDescriptor.lua +0 -10
  58. package/dist/lualib/ObjectGetOwnPropertyDescriptors.lua +0 -7
  59. package/dist/lualib/ObjectKeys.lua +0 -9
  60. package/dist/lualib/ObjectRest.lua +0 -9
  61. package/dist/lualib/ObjectValues.lua +0 -9
  62. package/dist/lualib/ParseFloat.lua +0 -18
  63. package/dist/lualib/ParseInt.lua +0 -43
  64. package/dist/lualib/Promise.lua +0 -176
  65. package/dist/lualib/PromiseAll.lua +0 -44
  66. package/dist/lualib/PromiseAllSettled.lua +0 -48
  67. package/dist/lualib/PromiseAny.lua +0 -41
  68. package/dist/lualib/PromiseRace.lua +0 -28
  69. package/dist/lualib/Set.lua +0 -130
  70. package/dist/lualib/SetDescriptor.lua +0 -79
  71. package/dist/lualib/SourceMapTraceBack.lua +0 -54
  72. package/dist/lualib/SparseArrayNew.lua +0 -5
  73. package/dist/lualib/SparseArrayPush.lua +0 -9
  74. package/dist/lualib/SparseArraySpread.lua +0 -8
  75. package/dist/lualib/Spread.lua +0 -15
  76. package/dist/lualib/StringAccess.lua +0 -5
  77. package/dist/lualib/StringCharAt.lua +0 -9
  78. package/dist/lualib/StringCharCodeAt.lua +0 -13
  79. package/dist/lualib/StringEndsWith.lua +0 -6
  80. package/dist/lualib/StringIncludes.lua +0 -9
  81. package/dist/lualib/StringPadEnd.lua +0 -26
  82. package/dist/lualib/StringPadStart.lua +0 -26
  83. package/dist/lualib/StringReplace.lua +0 -20
  84. package/dist/lualib/StringReplaceAll.lua +0 -42
  85. package/dist/lualib/StringSlice.lua +0 -15
  86. package/dist/lualib/StringSplit.lua +0 -36
  87. package/dist/lualib/StringStartsWith.lua +0 -6
  88. package/dist/lualib/StringSubstr.lua +0 -15
  89. package/dist/lualib/StringSubstring.lua +0 -17
  90. package/dist/lualib/StringTrim.lua +0 -4
  91. package/dist/lualib/StringTrimEnd.lua +0 -4
  92. package/dist/lualib/StringTrimStart.lua +0 -4
  93. package/dist/lualib/Symbol.lua +0 -15
  94. package/dist/lualib/SymbolRegistry.lua +0 -17
  95. package/dist/lualib/TypeOf.lua +0 -10
  96. package/dist/lualib/Unpack.lua +0 -1
  97. package/dist/lualib/WeakMap.lua +0 -45
  98. package/dist/lualib/WeakSet.lua +0 -41
  99. package/dist/lualib/lualib_bundle.lua +0 -2518
  100. package/dist/lualib/lualib_module_info.json +0 -626
  101. package/dist/lualib/universal/universal/CountVarargs.lua +0 -3
  102. package/dist/lualib/universal/universal/Match.lua +0 -1
  103. package/dist/lualib/universal/universal/MathModf.lua +0 -1
  104. package/dist/lualib/universal/universal/SparseArraySpread.lua +0 -8
  105. package/dist/lualib/universal/universal/Unpack.lua +0 -1
@@ -1,36 +0,0 @@
1
- local function __TS__Decorate(decorators, target, key, desc)
2
- local result = target
3
- do
4
- local i = #decorators
5
- while i >= 0 do
6
- local decorator = decorators[i + 1]
7
- if decorator then
8
- local oldResult = result
9
- if key == nil then
10
- result = decorator(nil, result)
11
- elseif desc == true then
12
- local value = rawget(target, key)
13
- local descriptor = __TS__ObjectGetOwnPropertyDescriptor(target, key) or ({configurable = true, writable = true, value = value})
14
- local desc = decorator(nil, target, key, descriptor) or descriptor
15
- local isSimpleValue = desc.configurable == true and desc.writable == true and not desc.get and not desc.set
16
- if isSimpleValue then
17
- rawset(target, key, desc.value)
18
- else
19
- __TS__SetDescriptor(
20
- target,
21
- key,
22
- __TS__ObjectAssign({}, descriptor, desc)
23
- )
24
- end
25
- elseif desc == false then
26
- result = decorator(nil, target, key, desc)
27
- else
28
- result = decorator(nil, target, key)
29
- end
30
- result = result or oldResult
31
- end
32
- i = i - 1
33
- end
34
- end
35
- return result
36
- end
@@ -1,3 +0,0 @@
1
- local function __TS__DecorateParam(paramIndex, decorator)
2
- return function(____, target, key) return decorator(nil, target, key, paramIndex) end
3
- end
@@ -1,34 +0,0 @@
1
- local function __TS__DelegatedYield(iterable)
2
- if type(iterable) == "string" then
3
- for index = 0, #iterable - 1 do
4
- coroutine.yield(__TS__StringAccess(iterable, index))
5
- end
6
- elseif iterable.____coroutine ~= nil then
7
- local co = iterable.____coroutine
8
- while true do
9
- local status, value = coroutine.resume(co)
10
- if not status then
11
- error(value, 0)
12
- end
13
- if coroutine.status(co) == "dead" then
14
- return value
15
- else
16
- coroutine.yield(value)
17
- end
18
- end
19
- elseif iterable[Symbol.iterator] then
20
- local iterator = iterable[Symbol.iterator](iterable)
21
- while true do
22
- local result = iterator:next()
23
- if result.done then
24
- return result.value
25
- else
26
- coroutine.yield(result.value)
27
- end
28
- end
29
- else
30
- for ____, value in ipairs(iterable) do
31
- coroutine.yield(value)
32
- end
33
- end
34
- end
@@ -1,19 +0,0 @@
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
@@ -1,77 +0,0 @@
1
- local Error, RangeError, ReferenceError, SyntaxError, TypeError, URIError
2
- do
3
- local function getErrorStack(self, constructor)
4
- local level = 1
5
- while true do
6
- local info = debug.getinfo(level, "f")
7
- level = level + 1
8
- if not info then
9
- level = 1
10
- break
11
- elseif info.func == constructor then
12
- break
13
- end
14
- end
15
- return debug.traceback(nil, level)
16
- end
17
- local function wrapErrorToString(self, getDescription)
18
- return function(self)
19
- local description = getDescription(self)
20
- local caller = debug.getinfo(3, "f")
21
- if _VERSION == "Lua 5.1" or caller and caller.func ~= error then
22
- return description
23
- else
24
- return (tostring(description) .. "\n") .. self.stack
25
- end
26
- end
27
- end
28
- local function initErrorClass(self, Type, name)
29
- Type.name = name
30
- return setmetatable(
31
- Type,
32
- {__call = function(____, _self, message) return __TS__New(Type, message) end}
33
- )
34
- end
35
- local ____initErrorClass_2 = initErrorClass
36
- local ____class_0 = __TS__Class()
37
- ____class_0.name = ""
38
- function ____class_0.prototype.____constructor(self, message)
39
- if message == nil then
40
- message = ""
41
- end
42
- self.message = message
43
- self.name = "Error"
44
- self.stack = getErrorStack(nil, self.constructor.new)
45
- local metatable = getmetatable(self)
46
- if not metatable.__errorToStringPatched then
47
- metatable.__errorToStringPatched = true
48
- metatable.__tostring = wrapErrorToString(nil, metatable.__tostring)
49
- end
50
- end
51
- function ____class_0.prototype.__tostring(self)
52
- local ____temp_1
53
- if self.message ~= "" then
54
- ____temp_1 = (self.name .. ": ") .. self.message
55
- else
56
- ____temp_1 = self.name
57
- end
58
- return ____temp_1
59
- end
60
- Error = ____initErrorClass_2(nil, ____class_0, "Error")
61
- local function createErrorClass(self, name)
62
- local ____initErrorClass_4 = initErrorClass
63
- local ____class_3 = __TS__Class()
64
- ____class_3.name = ____class_3.name
65
- __TS__ClassExtends(____class_3, Error)
66
- function ____class_3.prototype.____constructor(self, ...)
67
- ____class_3.____super.prototype.____constructor(self, ...)
68
- self.name = name
69
- end
70
- return ____initErrorClass_4(nil, ____class_3, name)
71
- end
72
- RangeError = createErrorClass(nil, "RangeError")
73
- ReferenceError = createErrorClass(nil, "ReferenceError")
74
- SyntaxError = createErrorClass(nil, "SyntaxError")
75
- TypeError = createErrorClass(nil, "TypeError")
76
- URIError = createErrorClass(nil, "URIError")
77
- end
@@ -1,11 +0,0 @@
1
- local function __TS__FunctionBind(fn, ...)
2
- local boundArgs = {...}
3
- return function(____, ...)
4
- local args = {...}
5
- __TS__ArrayUnshift(
6
- args,
7
- __TS__Unpack(boundArgs)
8
- )
9
- return fn(__TS__Unpack(args))
10
- end
11
- end
@@ -1,38 +0,0 @@
1
- local __TS__Generator
2
- do
3
- local function generatorIterator(self)
4
- return self
5
- end
6
- local function generatorNext(self, ...)
7
- local co = self.____coroutine
8
- if coroutine.status(co) == "dead" then
9
- return {done = true}
10
- end
11
- local status, value = coroutine.resume(co, ...)
12
- if not status then
13
- error(value, 0)
14
- end
15
- return {
16
- value = value,
17
- done = coroutine.status(co) == "dead"
18
- }
19
- end
20
- function __TS__Generator(fn)
21
- return function(...)
22
- local args = {...}
23
- local argsLength = select("#", ...)
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),
33
- [Symbol.iterator] = generatorIterator,
34
- next = generatorNext
35
- }
36
- end
37
- end
38
- end
@@ -1,18 +0,0 @@
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
@@ -1,4 +0,0 @@
1
- local function __TS__InstanceOfObject(value)
2
- local valueType = type(value)
3
- return valueType == "table" or valueType == "function"
4
- end
@@ -1,40 +0,0 @@
1
- local __TS__Iterator
2
- do
3
- local function iteratorGeneratorStep(self)
4
- local co = self.____coroutine
5
- local status, value = coroutine.resume(co)
6
- if not status then
7
- error(value, 0)
8
- end
9
- if coroutine.status(co) == "dead" then
10
- return
11
- end
12
- return true, value
13
- end
14
- local function iteratorIteratorStep(self)
15
- local result = self:next()
16
- if result.done then
17
- return
18
- end
19
- return true, result.value
20
- end
21
- local function iteratorStringStep(self, index)
22
- index = index + 1
23
- if index > #self then
24
- return
25
- end
26
- return index, string.sub(self, index, index)
27
- end
28
- function __TS__Iterator(iterable)
29
- if type(iterable) == "string" then
30
- return iteratorStringStep, iterable, 0
31
- elseif iterable.____coroutine ~= nil then
32
- return iteratorGeneratorStep, iterable
33
- elseif iterable[Symbol.iterator] then
34
- local iterator = iterable[Symbol.iterator](iterable)
35
- return iteratorIteratorStep, iterator
36
- else
37
- return ipairs(iterable)
38
- end
39
- end
40
- end
@@ -1,9 +0,0 @@
1
- local function __TS__LuaIteratorSpread(self, state, firstKey)
2
- local results = {}
3
- local key, value = self(state, firstKey)
4
- while key do
5
- results[#results + 1] = {key, value}
6
- key, value = self(state, key)
7
- end
8
- return __TS__Unpack(results)
9
- end
@@ -1,140 +0,0 @@
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
@@ -1 +0,0 @@
1
- local __TS__MathAtan2 = math.atan2 or math.atan
@@ -1,8 +0,0 @@
1
- local function __TS__MathSign(val)
2
- if val > 0 then
3
- return 1
4
- elseif val < 0 then
5
- return -1
6
- end
7
- return 0
8
- end
@@ -1,5 +0,0 @@
1
- local function __TS__New(target, ...)
2
- local instance = setmetatable({}, target.prototype)
3
- instance:____constructor(...)
4
- return instance
5
- end
@@ -1,26 +0,0 @@
1
- local function __TS__Number(value)
2
- local valueType = type(value)
3
- if valueType == "number" then
4
- return value
5
- elseif valueType == "string" then
6
- local numberValue = tonumber(value)
7
- if numberValue then
8
- return numberValue
9
- end
10
- if value == "Infinity" then
11
- return math.huge
12
- end
13
- if value == "-Infinity" then
14
- return -math.huge
15
- end
16
- local stringWithoutSpaces = string.gsub(value, "%s", "")
17
- if stringWithoutSpaces == "" then
18
- return 0
19
- end
20
- return 0 / 0
21
- elseif valueType == "boolean" then
22
- return value and 1 or 0
23
- else
24
- return 0 / 0
25
- end
26
- end
@@ -1,3 +0,0 @@
1
- local function __TS__NumberIsFinite(value)
2
- return type(value) == "number" and value == value and value ~= math.huge and value ~= -math.huge
3
- end
@@ -1,3 +0,0 @@
1
- local function __TS__NumberIsNaN(value)
2
- return value ~= value
3
- end
@@ -1,44 +0,0 @@
1
- local __TS__NumberToString
2
- do
3
- local radixChars = "0123456789abcdefghijklmnopqrstuvwxyz"
4
- function __TS__NumberToString(self, radix)
5
- if radix == nil or radix == 10 or self == math.huge or self == -math.huge or self ~= self then
6
- return tostring(self)
7
- end
8
- radix = math.floor(radix)
9
- if radix < 2 or radix > 36 then
10
- error("toString() radix argument must be between 2 and 36", 0)
11
- end
12
- local integer, fraction = math.modf(math.abs(self))
13
- local result = ""
14
- if radix == 8 then
15
- result = string.format("%o", integer)
16
- elseif radix == 16 then
17
- result = string.format("%x", integer)
18
- else
19
- repeat
20
- do
21
- result = __TS__StringAccess(radixChars, integer % radix) .. result
22
- integer = math.floor(integer / radix)
23
- end
24
- until not (integer ~= 0)
25
- end
26
- if fraction ~= 0 then
27
- result = result .. "."
28
- local delta = 1e-16
29
- repeat
30
- do
31
- fraction = fraction * radix
32
- delta = delta * radix
33
- local digit = math.floor(fraction)
34
- result = result .. __TS__StringAccess(radixChars, digit)
35
- fraction = fraction - digit
36
- end
37
- until not (fraction >= delta)
38
- end
39
- if self < 0 then
40
- result = "-" .. result
41
- end
42
- return result
43
- end
44
- end
@@ -1,10 +0,0 @@
1
- local function __TS__ObjectAssign(target, ...)
2
- local sources = {...}
3
- for i = 1, #sources do
4
- local source = sources[i]
5
- for key in pairs(source) do
6
- target[key] = source[key]
7
- end
8
- end
9
- return target
10
- end
@@ -1,59 +0,0 @@
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
@@ -1,9 +0,0 @@
1
- local function __TS__ObjectEntries(obj)
2
- local result = {}
3
- local len = 0
4
- for key in pairs(obj) do
5
- len = len + 1
6
- result[len] = {key, obj[key]}
7
- end
8
- return result
9
- end
@@ -1,20 +0,0 @@
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
@@ -1,10 +0,0 @@
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,7 +0,0 @@
1
- local function __TS__ObjectGetOwnPropertyDescriptors(object)
2
- local metatable = getmetatable(object)
3
- if not metatable then
4
- return {}
5
- end
6
- return rawget(metatable, "_descriptors") or ({})
7
- end
@@ -1,9 +0,0 @@
1
- local function __TS__ObjectKeys(obj)
2
- local result = {}
3
- local len = 0
4
- for key in pairs(obj) do
5
- len = len + 1
6
- result[len] = key
7
- end
8
- return result
9
- end