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
@@ -260,11 +260,11 @@ function isBuildModeLibrary(program) {
260
260
  function findRequiredPaths(code) {
261
261
  // Find all require("<path>") paths in a lua code string
262
262
  const paths = [];
263
- const pattern = /(^|\s|;|=|\()require\("(.+?)"\)/g;
263
+ const pattern = /(^|\s|;|=|\()require\s*\(?(["|'])(.+?)\2\)?/g;
264
264
  // eslint-disable-next-line @typescript-eslint/ban-types
265
265
  let match;
266
266
  while ((match = pattern.exec(code))) {
267
- paths.push(match[2]);
267
+ paths.push(match[3]);
268
268
  }
269
269
  return paths;
270
270
  }
@@ -272,7 +272,7 @@ function replaceRequireInCode(file, originalRequire, newRequire) {
272
272
  const requirePath = (0, utils_1.formatPathToLuaPath)(newRequire.replace(".lua", ""));
273
273
  // Escape special characters to prevent the regex from breaking...
274
274
  const escapedRequire = originalRequire.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
275
- file.code = file.code.replace(new RegExp(`(^|\\s|;|=|\\()require\\("${escapedRequire}"\\)`), `$1require("${requirePath}")`);
275
+ file.code = file.code.replace(new RegExp(`(^|\\s|;|=|\\()require\\s*\\(?["|']${escapedRequire}["|']\\)?`), `$1require("${requirePath}")`);
276
276
  }
277
277
  function replaceRequireInSourceMap(file, originalRequire, newRequire) {
278
278
  const requirePath = (0, utils_1.formatPathToLuaPath)(newRequire.replace(".lua", ""));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typescript-to-lua",
3
- "version": "1.10.0-beta.0",
3
+ "version": "1.10.0",
4
4
  "description": "A generic TypeScript to Lua transpiler. Write your code in TypeScript and publish Lua!",
5
5
  "repository": "https://github.com/TypeScriptToLua/TypeScriptToLua",
6
6
  "homepage": "https://typescripttolua.github.io/",
@@ -65,7 +65,7 @@
65
65
  "javascript-stringify": "^2.0.1",
66
66
  "jest": "^28.1.3",
67
67
  "jest-circus": "^29.0.1",
68
- "lua-types": "^2.13.0-beta.0",
68
+ "lua-types": "^2.13.0",
69
69
  "lua-wasm-bindings": "^0.3.1",
70
70
  "prettier": "^2.3.2",
71
71
  "ts-jest": "^28.0.8",
@@ -1,22 +0,0 @@
1
- local function __TS__ArrayConcat(self, ...)
2
- local items = {...}
3
- local result = {}
4
- local len = 0
5
- for i = 1, #self do
6
- len = len + 1
7
- result[len] = self[i]
8
- end
9
- for i = 1, #items do
10
- local item = items[i]
11
- if __TS__ArrayIsArray(item) then
12
- for j = 1, #item do
13
- len = len + 1
14
- result[len] = item[j]
15
- end
16
- else
17
- len = len + 1
18
- result[len] = item
19
- end
20
- end
21
- return result
22
- end
@@ -1,13 +0,0 @@
1
- local function __TS__ArrayEntries(array)
2
- local key = 0
3
- return {
4
- [Symbol.iterator] = function(self)
5
- return self
6
- end,
7
- next = function(self)
8
- local result = {done = array[key + 1] == nil, value = {key, array[key + 1]}}
9
- key = key + 1
10
- return result
11
- end
12
- }
13
- end
@@ -1,8 +0,0 @@
1
- local function __TS__ArrayEvery(self, callbackfn, thisArg)
2
- for i = 1, #self do
3
- if not callbackfn(thisArg, self[i], i - 1, self) then
4
- return false
5
- end
6
- end
7
- return true
8
- end
@@ -1,11 +0,0 @@
1
- local function __TS__ArrayFilter(self, callbackfn, thisArg)
2
- local result = {}
3
- local len = 0
4
- for i = 1, #self do
5
- if callbackfn(thisArg, self[i], i - 1, self) then
6
- len = len + 1
7
- result[len] = self[i]
8
- end
9
- end
10
- return result
11
- end
@@ -1,9 +0,0 @@
1
- local function __TS__ArrayFind(self, predicate, thisArg)
2
- for i = 1, #self do
3
- local elem = self[i]
4
- if predicate(thisArg, elem, i - 1, self) then
5
- return elem
6
- end
7
- end
8
- return nil
9
- end
@@ -1,8 +0,0 @@
1
- local function __TS__ArrayFindIndex(self, callbackFn, thisArg)
2
- for i = 1, #self do
3
- if callbackFn(thisArg, self[i], i - 1, self) then
4
- return i - 1
5
- end
6
- end
7
- return -1
8
- end
@@ -1,27 +0,0 @@
1
- local function __TS__ArrayFlat(self, depth)
2
- if depth == nil then
3
- depth = 1
4
- end
5
- local result = {}
6
- local len = 0
7
- for i = 1, #self do
8
- local value = self[i]
9
- if depth > 0 and __TS__ArrayIsArray(value) then
10
- local toAdd
11
- if depth == 1 then
12
- toAdd = value
13
- else
14
- toAdd = __TS__ArrayFlat(value, depth - 1)
15
- end
16
- for j = 1, #toAdd do
17
- local val = toAdd[j]
18
- len = len + 1
19
- result[len] = val
20
- end
21
- else
22
- len = len + 1
23
- result[len] = value
24
- end
25
- end
26
- return result
27
- end
@@ -1,17 +0,0 @@
1
- local function __TS__ArrayFlatMap(self, callback, thisArg)
2
- local result = {}
3
- local len = 0
4
- for i = 1, #self do
5
- local value = callback(thisArg, self[i], i - 1, self)
6
- if __TS__ArrayIsArray(value) then
7
- for j = 1, #value do
8
- len = len + 1
9
- result[len] = value[j]
10
- end
11
- else
12
- len = len + 1
13
- result[len] = value
14
- end
15
- end
16
- return result
17
- end
@@ -1,5 +0,0 @@
1
- local function __TS__ArrayForEach(self, callbackFn, thisArg)
2
- for i = 1, #self do
3
- callbackFn(thisArg, self[i], i - 1, self)
4
- end
5
- end
@@ -1,29 +0,0 @@
1
- local __TS__ArrayFrom
2
- do
3
- local function arrayLikeStep(self, index)
4
- index = index + 1
5
- if index > self.length then
6
- return
7
- end
8
- return index, self[index]
9
- end
10
- local function arrayLikeIterator(arr)
11
- if type(arr.length) == "number" then
12
- return arrayLikeStep, arr, 0
13
- end
14
- return __TS__Iterator(arr)
15
- end
16
- function __TS__ArrayFrom(arrayLike, mapFn, thisArg)
17
- local result = {}
18
- if mapFn == nil then
19
- for ____, v in arrayLikeIterator(arrayLike) do
20
- result[#result + 1] = v
21
- end
22
- else
23
- for i, v in arrayLikeIterator(arrayLike) do
24
- result[#result + 1] = mapFn(thisArg, v, i - 1)
25
- end
26
- end
27
- return result
28
- end
29
- end
@@ -1,19 +0,0 @@
1
- local function __TS__ArrayIncludes(self, searchElement, fromIndex)
2
- if fromIndex == nil then
3
- fromIndex = 0
4
- end
5
- local len = #self
6
- local k = fromIndex
7
- if fromIndex < 0 then
8
- k = len + fromIndex
9
- end
10
- if k < 0 then
11
- k = 0
12
- end
13
- for i = k + 1, len do
14
- if self[i] == searchElement then
15
- return true
16
- end
17
- end
18
- return false
19
- end
@@ -1,24 +0,0 @@
1
- local function __TS__ArrayIndexOf(self, searchElement, fromIndex)
2
- if fromIndex == nil then
3
- fromIndex = 0
4
- end
5
- local len = #self
6
- if len == 0 then
7
- return -1
8
- end
9
- if fromIndex >= len then
10
- return -1
11
- end
12
- if fromIndex < 0 then
13
- fromIndex = len + fromIndex
14
- if fromIndex < 0 then
15
- fromIndex = 0
16
- end
17
- end
18
- for i = fromIndex + 1, len do
19
- if self[i] == searchElement then
20
- return i - 1
21
- end
22
- end
23
- return -1
24
- end
@@ -1,3 +0,0 @@
1
- local function __TS__ArrayIsArray(value)
2
- return type(value) == "table" and (value[1] ~= nil or next(value) == nil)
3
- end
@@ -1,10 +0,0 @@
1
- local function __TS__ArrayJoin(self, separator)
2
- if separator == nil then
3
- separator = ","
4
- end
5
- local parts = {}
6
- for i = 1, #self do
7
- parts[i] = tostring(self[i])
8
- end
9
- return table.concat(parts, separator)
10
- end
@@ -1,7 +0,0 @@
1
- local function __TS__ArrayMap(self, callbackfn, thisArg)
2
- local result = {}
3
- for i = 1, #self do
4
- result[i] = callbackfn(thisArg, self[i], i - 1, self)
5
- end
6
- return result
7
- end
@@ -1,9 +0,0 @@
1
- local function __TS__ArrayPush(self, ...)
2
- local items = {...}
3
- local len = #self
4
- for i = 1, #items do
5
- len = len + 1
6
- self[len] = items[i]
7
- end
8
- return len
9
- end
@@ -1,8 +0,0 @@
1
- local function __TS__ArrayPushArray(self, items)
2
- local len = #self
3
- for i = 1, #items do
4
- len = len + 1
5
- self[len] = items[i]
6
- end
7
- return len
8
- end
@@ -1,23 +0,0 @@
1
- local function __TS__ArrayReduce(self, callbackFn, ...)
2
- local len = #self
3
- local k = 0
4
- local accumulator = nil
5
- if select("#", ...) ~= 0 then
6
- accumulator = ...
7
- elseif len > 0 then
8
- accumulator = self[1]
9
- k = 1
10
- else
11
- error("Reduce of empty array with no initial value", 0)
12
- end
13
- for i = k + 1, len do
14
- accumulator = callbackFn(
15
- nil,
16
- accumulator,
17
- self[i],
18
- i - 1,
19
- self
20
- )
21
- end
22
- return accumulator
23
- end
@@ -1,23 +0,0 @@
1
- local function __TS__ArrayReduceRight(self, callbackFn, ...)
2
- local len = #self
3
- local k = len - 1
4
- local accumulator = nil
5
- if select("#", ...) ~= 0 then
6
- accumulator = ...
7
- elseif len > 0 then
8
- accumulator = self[k + 1]
9
- k = k - 1
10
- else
11
- error("Reduce of empty array with no initial value", 0)
12
- end
13
- for i = k + 1, 1, -1 do
14
- accumulator = callbackFn(
15
- nil,
16
- accumulator,
17
- self[i],
18
- i - 1,
19
- self
20
- )
21
- end
22
- return accumulator
23
- end
@@ -1,12 +0,0 @@
1
- local function __TS__ArrayReverse(self)
2
- local i = 1
3
- local j = #self
4
- while i < j do
5
- local temp = self[j]
6
- self[j] = self[i]
7
- self[i] = temp
8
- i = i + 1
9
- j = j - 1
10
- end
11
- return self
12
- end
@@ -1,12 +0,0 @@
1
- local function __TS__ArraySetLength(self, length)
2
- if length < 0 or length ~= length or length == math.huge or math.floor(length) ~= length then
3
- error(
4
- "invalid array length: " .. tostring(length),
5
- 0
6
- )
7
- end
8
- for i = length + 1, #self do
9
- self[i] = nil
10
- end
11
- return length
12
- end
@@ -1,43 +0,0 @@
1
- local function __TS__ArraySlice(self, first, last)
2
- local len = #self
3
- local ____first_0 = first
4
- if ____first_0 == nil then
5
- ____first_0 = 0
6
- end
7
- first = ____first_0
8
- if first < 0 then
9
- first = len + first
10
- if first < 0 then
11
- first = 0
12
- end
13
- else
14
- if first > len then
15
- first = len
16
- end
17
- end
18
- local ____last_1 = last
19
- if ____last_1 == nil then
20
- ____last_1 = len
21
- end
22
- last = ____last_1
23
- if last < 0 then
24
- last = len + last
25
- if last < 0 then
26
- last = 0
27
- end
28
- else
29
- if last > len then
30
- last = len
31
- end
32
- end
33
- local out = {}
34
- first = first + 1
35
- last = last + 1
36
- local n = 1
37
- while first < last do
38
- out[n] = self[first]
39
- first = first + 1
40
- n = n + 1
41
- end
42
- return out
43
- end
@@ -1,8 +0,0 @@
1
- local function __TS__ArraySome(self, callbackfn, thisArg)
2
- for i = 1, #self do
3
- if callbackfn(thisArg, self[i], i - 1, self) then
4
- return true
5
- end
6
- end
7
- return false
8
- end
@@ -1,11 +0,0 @@
1
- local function __TS__ArraySort(self, compareFn)
2
- if compareFn ~= nil then
3
- table.sort(
4
- self,
5
- function(a, b) return compareFn(nil, a, b) < 0 end
6
- )
7
- else
8
- table.sort(self)
9
- end
10
- return self
11
- end
@@ -1,77 +0,0 @@
1
- local function __TS__ArraySplice(self, ...)
2
- local args = {...}
3
- local len = #self
4
- local actualArgumentCount = select("#", ...)
5
- local start = args[1]
6
- local deleteCount = args[2]
7
- if start < 0 then
8
- start = len + start
9
- if start < 0 then
10
- start = 0
11
- end
12
- elseif start > len then
13
- start = len
14
- end
15
- local itemCount = actualArgumentCount - 2
16
- if itemCount < 0 then
17
- itemCount = 0
18
- end
19
- local actualDeleteCount
20
- if actualArgumentCount == 0 then
21
- actualDeleteCount = 0
22
- elseif actualArgumentCount == 1 then
23
- actualDeleteCount = len - start
24
- else
25
- local ____deleteCount_0 = deleteCount
26
- if ____deleteCount_0 == nil then
27
- ____deleteCount_0 = 0
28
- end
29
- actualDeleteCount = ____deleteCount_0
30
- if actualDeleteCount < 0 then
31
- actualDeleteCount = 0
32
- end
33
- if actualDeleteCount > len - start then
34
- actualDeleteCount = len - start
35
- end
36
- end
37
- local out = {}
38
- for k = 1, actualDeleteCount do
39
- local from = start + k
40
- if self[from] ~= nil then
41
- out[k] = self[from]
42
- end
43
- end
44
- if itemCount < actualDeleteCount then
45
- for k = start + 1, len - actualDeleteCount do
46
- local from = k + actualDeleteCount
47
- local to = k + itemCount
48
- if self[from] then
49
- self[to] = self[from]
50
- else
51
- self[to] = nil
52
- end
53
- end
54
- for k = len - actualDeleteCount + itemCount + 1, len do
55
- self[k] = nil
56
- end
57
- elseif itemCount > actualDeleteCount then
58
- for k = len - actualDeleteCount, start + 1, -1 do
59
- local from = k + actualDeleteCount
60
- local to = k + itemCount
61
- if self[from] then
62
- self[to] = self[from]
63
- else
64
- self[to] = nil
65
- end
66
- end
67
- end
68
- local j = start + 1
69
- for i = 3, actualArgumentCount do
70
- self[j] = args[i]
71
- j = j + 1
72
- end
73
- for k = #self, len - actualDeleteCount + itemCount + 1, -1 do
74
- self[k] = nil
75
- end
76
- return out
77
- end
@@ -1,7 +0,0 @@
1
- local function __TS__ArrayToObject(self)
2
- local object = {}
3
- for i = 1, #self do
4
- object[i - 1] = self[i]
5
- end
6
- return object
7
- end
@@ -1,14 +0,0 @@
1
- local function __TS__ArrayUnshift(self, ...)
2
- local items = {...}
3
- local numItemsToInsert = #items
4
- if numItemsToInsert == 0 then
5
- return #self
6
- end
7
- for i = #self, 1, -1 do
8
- self[i + numItemsToInsert] = self[i]
9
- end
10
- for i = 1, numItemsToInsert do
11
- self[i] = items[i]
12
- end
13
- return #self
14
- end
@@ -1,54 +0,0 @@
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
@@ -1,6 +0,0 @@
1
- local function __TS__Class(self)
2
- local c = {prototype = {}}
3
- c.prototype.__index = c.prototype
4
- c.prototype.constructor = c
5
- return c
6
- end
@@ -1,24 +0,0 @@
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
@@ -1,28 +0,0 @@
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