typescript-to-lua 1.1.1 → 1.2.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 (113) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/LuaAST.d.ts +1 -0
  3. package/dist/LuaAST.js +10 -2
  4. package/dist/LuaLib.d.ts +3 -3
  5. package/dist/LuaLib.js +4 -4
  6. package/dist/LuaPrinter.d.ts +11 -4
  7. package/dist/LuaPrinter.js +54 -11
  8. package/dist/lualib/ArrayFlat.lua +1 -1
  9. package/dist/lualib/ArrayFlatMap.lua +1 -1
  10. package/dist/lualib/ArrayIsArray.lua +1 -1
  11. package/dist/lualib/ArrayReduce.lua +7 -1
  12. package/dist/lualib/ArrayReduceRight.lua +7 -1
  13. package/dist/lualib/ArraySetLength.lua +1 -1
  14. package/dist/lualib/ArraySplice.lua +5 -5
  15. package/dist/lualib/Await.lua +14 -10
  16. package/dist/lualib/CloneDescriptor.lua +8 -8
  17. package/dist/lualib/Decorate.lua +1 -1
  18. package/dist/lualib/DelegatedYield.lua +1 -3
  19. package/dist/lualib/Delete.lua +6 -6
  20. package/dist/lualib/Error.lua +47 -44
  21. package/dist/lualib/Generator.lua +1 -5
  22. package/dist/lualib/InstanceOf.lua +1 -1
  23. package/dist/lualib/InstanceOfObject.lua +1 -1
  24. package/dist/lualib/Map.lua +130 -134
  25. package/dist/lualib/Number.lua +1 -1
  26. package/dist/lualib/NumberIsFinite.lua +1 -1
  27. package/dist/lualib/NumberToString.lua +3 -5
  28. package/dist/lualib/ObjectDefineProperty.lua +40 -8
  29. package/dist/lualib/ParseFloat.lua +9 -5
  30. package/dist/lualib/ParseInt.lua +15 -3
  31. package/dist/lualib/Promise.lua +18 -22
  32. package/dist/lualib/Set.lua +119 -123
  33. package/dist/lualib/SetDescriptor.lua +7 -1
  34. package/dist/lualib/SourceMapTraceBack.lua +1 -1
  35. package/dist/lualib/SparseArrayNew.lua +5 -0
  36. package/dist/lualib/SparseArrayPush.lua +9 -0
  37. package/dist/lualib/SparseArraySpread.lua +4 -0
  38. package/dist/lualib/StringAccess.lua +1 -1
  39. package/dist/lualib/StringCharCodeAt.lua +1 -1
  40. package/dist/lualib/StringEndsWith.lua +2 -2
  41. package/dist/lualib/StringPadEnd.lua +2 -2
  42. package/dist/lualib/StringPadStart.lua +2 -2
  43. package/dist/lualib/StringReplace.lua +7 -1
  44. package/dist/lualib/StringSlice.lua +2 -2
  45. package/dist/lualib/StringSplit.lua +3 -3
  46. package/dist/lualib/StringStartsWith.lua +1 -1
  47. package/dist/lualib/StringSubstr.lua +1 -1
  48. package/dist/lualib/StringSubstring.lua +2 -2
  49. package/dist/lualib/Symbol.lua +3 -5
  50. package/dist/lualib/WeakMap.lua +40 -42
  51. package/dist/lualib/WeakSet.lua +36 -38
  52. package/dist/lualib/lualib_bundle.lua +603 -555
  53. package/dist/transformation/builtins/array.js +1 -2
  54. package/dist/transformation/builtins/function.js +1 -2
  55. package/dist/transformation/builtins/index.d.ts +1 -1
  56. package/dist/transformation/builtins/index.js +37 -4
  57. package/dist/transformation/builtins/object.d.ts +2 -1
  58. package/dist/transformation/builtins/object.js +1 -2
  59. package/dist/transformation/builtins/string.js +1 -2
  60. package/dist/transformation/context/context.d.ts +12 -0
  61. package/dist/transformation/context/context.js +102 -3
  62. package/dist/transformation/utils/diagnostics.d.ts +6 -0
  63. package/dist/transformation/utils/diagnostics.js +3 -1
  64. package/dist/transformation/utils/lua-ast.d.ts +0 -1
  65. package/dist/transformation/utils/lua-ast.js +13 -22
  66. package/dist/transformation/utils/preceding-statements.d.ts +3 -0
  67. package/dist/transformation/utils/preceding-statements.js +11 -0
  68. package/dist/transformation/utils/scope.d.ts +1 -0
  69. package/dist/transformation/utils/scope.js +8 -1
  70. package/dist/transformation/utils/typescript/index.d.ts +1 -0
  71. package/dist/transformation/utils/typescript/index.js +16 -1
  72. package/dist/transformation/visitors/access.d.ts +3 -0
  73. package/dist/transformation/visitors/access.js +63 -36
  74. package/dist/transformation/visitors/binary-expression/assignments.d.ts +3 -2
  75. package/dist/transformation/visitors/binary-expression/assignments.js +66 -57
  76. package/dist/transformation/visitors/binary-expression/compound.d.ts +5 -4
  77. package/dist/transformation/visitors/binary-expression/compound.js +66 -68
  78. package/dist/transformation/visitors/binary-expression/destructuring-assignments.d.ts +2 -2
  79. package/dist/transformation/visitors/binary-expression/destructuring-assignments.js +54 -25
  80. package/dist/transformation/visitors/binary-expression/index.d.ts +3 -1
  81. package/dist/transformation/visitors/binary-expression/index.js +64 -20
  82. package/dist/transformation/visitors/call.d.ts +3 -2
  83. package/dist/transformation/visitors/call.js +109 -122
  84. package/dist/transformation/visitors/class/index.js +4 -7
  85. package/dist/transformation/visitors/class/new.js +4 -6
  86. package/dist/transformation/visitors/conditional.js +28 -14
  87. package/dist/transformation/visitors/delete.js +4 -0
  88. package/dist/transformation/visitors/expression-list.d.ts +7 -0
  89. package/dist/transformation/visitors/expression-list.js +120 -0
  90. package/dist/transformation/visitors/function.js +6 -8
  91. package/dist/transformation/visitors/identifier.js +4 -0
  92. package/dist/transformation/visitors/literal.js +69 -16
  93. package/dist/transformation/visitors/loops/do-while.js +34 -8
  94. package/dist/transformation/visitors/loops/for.js +25 -5
  95. package/dist/transformation/visitors/loops/utils.d.ts +1 -0
  96. package/dist/transformation/visitors/loops/utils.js +13 -2
  97. package/dist/transformation/visitors/modules/export.js +1 -1
  98. package/dist/transformation/visitors/optional-chaining.d.ts +16 -0
  99. package/dist/transformation/visitors/optional-chaining.js +172 -0
  100. package/dist/transformation/visitors/sourceFile.js +4 -1
  101. package/dist/transformation/visitors/switch.js +29 -9
  102. package/dist/transformation/visitors/template.js +5 -2
  103. package/dist/transformation/visitors/typeof.js +3 -1
  104. package/dist/transformation/visitors/variable-declaration.js +21 -7
  105. package/dist/transformation/visitors/void.js +4 -7
  106. package/dist/transpilation/transformers.js +4 -1
  107. package/dist/transpilation/utils.js +2 -1
  108. package/package.json +5 -5
  109. package/dist/lualib/OptionalChainAccess.lua +0 -6
  110. package/dist/lualib/OptionalFunctionCall.lua +0 -6
  111. package/dist/lualib/OptionalMethodCall.lua +0 -11
  112. package/dist/transformation/utils/transform.d.ts +0 -8
  113. package/dist/transformation/utils/transform.js +0 -14
@@ -1,144 +1,140 @@
1
- Map = (function()
2
- local Map = __TS__Class()
3
- Map.name = "Map"
4
- function Map.prototype.____constructor(self, entries)
5
- self[Symbol.toStringTag] = "Map"
6
- self.items = {}
7
- self.size = 0
8
- self.nextKey = {}
9
- self.previousKey = {}
10
- if entries == nil then
11
- return
12
- end
13
- local iterable = entries
14
- if iterable[Symbol.iterator] then
15
- local iterator = iterable[Symbol.iterator](iterable)
16
- while true do
17
- local result = iterator:next()
18
- if result.done then
19
- break
20
- end
21
- local value = result.value
22
- self:set(value[1], value[2])
23
- end
24
- else
25
- local array = entries
26
- for ____, kvp in ipairs(array) do
27
- self:set(kvp[1], kvp[2])
28
- end
29
- end
1
+ Map = __TS__Class()
2
+ Map.name = "Map"
3
+ function Map.prototype.____constructor(self, entries)
4
+ self[Symbol.toStringTag] = "Map"
5
+ self.items = {}
6
+ self.size = 0
7
+ self.nextKey = {}
8
+ self.previousKey = {}
9
+ if entries == nil then
10
+ return
30
11
  end
31
- function Map.prototype.clear(self)
32
- self.items = {}
33
- self.nextKey = {}
34
- self.previousKey = {}
35
- self.firstKey = nil
36
- self.lastKey = nil
37
- self.size = 0
38
- end
39
- function Map.prototype.delete(self, key)
40
- local contains = self:has(key)
41
- if contains then
42
- self.size = self.size - 1
43
- local next = self.nextKey[key]
44
- local previous = self.previousKey[key]
45
- if next and previous then
46
- self.nextKey[previous] = next
47
- self.previousKey[next] = previous
48
- elseif next then
49
- self.firstKey = next
50
- self.previousKey[next] = nil
51
- elseif previous then
52
- self.lastKey = previous
53
- self.nextKey[previous] = nil
54
- else
55
- self.firstKey = nil
56
- self.lastKey = nil
12
+ local iterable = entries
13
+ if iterable[Symbol.iterator] then
14
+ local iterator = iterable[Symbol.iterator](iterable)
15
+ while true do
16
+ local result = iterator:next()
17
+ if result.done then
18
+ break
57
19
  end
58
- self.nextKey[key] = nil
59
- self.previousKey[key] = nil
20
+ local value = result.value
21
+ self:set(value[1], value[2])
60
22
  end
61
- self.items[key] = nil
62
- return contains
63
- end
64
- function Map.prototype.forEach(self, callback)
65
- for ____, key in __TS__Iterator(
66
- self:keys()
67
- ) do
68
- callback(_G, self.items[key], key, self)
23
+ else
24
+ local array = entries
25
+ for ____, kvp in ipairs(array) do
26
+ self:set(kvp[1], kvp[2])
69
27
  end
70
28
  end
71
- function Map.prototype.get(self, key)
72
- return self.items[key]
73
- end
74
- function Map.prototype.has(self, key)
75
- return (self.nextKey[key] ~= nil) or (self.lastKey == key)
76
- end
77
- function Map.prototype.set(self, key, value)
78
- local isNewValue = not self:has(key)
79
- if isNewValue then
80
- self.size = self.size + 1
81
- end
82
- self.items[key] = value
83
- if self.firstKey == nil then
84
- self.firstKey = key
85
- self.lastKey = key
86
- elseif isNewValue then
87
- self.nextKey[self.lastKey] = key
88
- self.previousKey[key] = self.lastKey
89
- self.lastKey = key
29
+ end
30
+ function Map.prototype.clear(self)
31
+ self.items = {}
32
+ self.nextKey = {}
33
+ self.previousKey = {}
34
+ self.firstKey = nil
35
+ self.lastKey = nil
36
+ self.size = 0
37
+ end
38
+ function Map.prototype.delete(self, key)
39
+ local contains = self:has(key)
40
+ if contains then
41
+ self.size = self.size - 1
42
+ local next = self.nextKey[key]
43
+ local previous = self.previousKey[key]
44
+ if next and previous then
45
+ self.nextKey[previous] = next
46
+ self.previousKey[next] = previous
47
+ elseif next then
48
+ self.firstKey = next
49
+ self.previousKey[next] = nil
50
+ elseif previous then
51
+ self.lastKey = previous
52
+ self.nextKey[previous] = nil
53
+ else
54
+ self.firstKey = nil
55
+ self.lastKey = nil
90
56
  end
91
- return self
57
+ self.nextKey[key] = nil
58
+ self.previousKey[key] = nil
92
59
  end
93
- Map.prototype[Symbol.iterator] = function(self)
94
- return self:entries()
60
+ self.items[key] = nil
61
+ return contains
62
+ end
63
+ function Map.prototype.forEach(self, callback)
64
+ for ____, key in __TS__Iterator(self:keys()) do
65
+ callback(_G, self.items[key], key, self)
95
66
  end
96
- function Map.prototype.entries(self)
97
- local ____ = self
98
- local items = ____.items
99
- local nextKey = ____.nextKey
100
- local key = self.firstKey
101
- return {
102
- [Symbol.iterator] = function(self)
103
- return self
104
- end,
105
- next = function(self)
106
- local result = {done = not key, value = {key, items[key]}}
107
- key = nextKey[key]
108
- return result
109
- end
110
- }
67
+ end
68
+ function Map.prototype.get(self, key)
69
+ return self.items[key]
70
+ end
71
+ function Map.prototype.has(self, key)
72
+ return self.nextKey[key] ~= nil or self.lastKey == key
73
+ end
74
+ function Map.prototype.set(self, key, value)
75
+ local isNewValue = not self:has(key)
76
+ if isNewValue then
77
+ self.size = self.size + 1
111
78
  end
112
- function Map.prototype.keys(self)
113
- local nextKey = self.nextKey
114
- local key = self.firstKey
115
- return {
116
- [Symbol.iterator] = function(self)
117
- return self
118
- end,
119
- next = function(self)
120
- local result = {done = not key, value = key}
121
- key = nextKey[key]
122
- return result
123
- end
124
- }
79
+ self.items[key] = value
80
+ if self.firstKey == nil then
81
+ self.firstKey = key
82
+ self.lastKey = key
83
+ elseif isNewValue then
84
+ self.nextKey[self.lastKey] = key
85
+ self.previousKey[key] = self.lastKey
86
+ self.lastKey = key
125
87
  end
126
- function Map.prototype.values(self)
127
- local ____ = self
128
- local items = ____.items
129
- local nextKey = ____.nextKey
130
- local key = self.firstKey
131
- return {
132
- [Symbol.iterator] = function(self)
133
- return self
134
- end,
135
- next = function(self)
136
- local result = {done = not key, value = items[key]}
137
- key = nextKey[key]
138
- return result
139
- end
140
- }
141
- end
142
- Map[Symbol.species] = Map
143
- return Map
144
- end)()
88
+ return self
89
+ end
90
+ Map.prototype[Symbol.iterator] = function(self)
91
+ return self:entries()
92
+ end
93
+ function Map.prototype.entries(self)
94
+ local ____temp_0 = self
95
+ local items = ____temp_0.items
96
+ local nextKey = ____temp_0.nextKey
97
+ local key = self.firstKey
98
+ return {
99
+ [Symbol.iterator] = function(self)
100
+ return self
101
+ end,
102
+ next = function(self)
103
+ local result = {done = not key, value = {key, items[key]}}
104
+ key = nextKey[key]
105
+ return result
106
+ end
107
+ }
108
+ end
109
+ function Map.prototype.keys(self)
110
+ local nextKey = self.nextKey
111
+ local key = self.firstKey
112
+ return {
113
+ [Symbol.iterator] = function(self)
114
+ return self
115
+ end,
116
+ next = function(self)
117
+ local result = {done = not key, value = key}
118
+ key = nextKey[key]
119
+ return result
120
+ end
121
+ }
122
+ end
123
+ function Map.prototype.values(self)
124
+ local ____temp_1 = self
125
+ local items = ____temp_1.items
126
+ local nextKey = ____temp_1.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
+ Map = Map
@@ -19,7 +19,7 @@ function __TS__Number(value)
19
19
  end
20
20
  return 0 / 0
21
21
  elseif valueType == "boolean" then
22
- return (value and 1) or 0
22
+ return value and 1 or 0
23
23
  else
24
24
  return 0 / 0
25
25
  end
@@ -1,3 +1,3 @@
1
1
  function __TS__NumberIsFinite(value)
2
- return (((type(value) == "number") and (value == value)) and (value ~= math.huge)) and (value ~= -math.huge)
2
+ return type(value) == "number" and value == value and value ~= math.huge and value ~= -math.huge
3
3
  end
@@ -1,15 +1,13 @@
1
1
  ____radixChars = "0123456789abcdefghijklmnopqrstuvwxyz"
2
2
  function __TS__NumberToString(self, radix)
3
- if ((((radix == nil) or (radix == 10)) or (self == math.huge)) or (self == -math.huge)) or (self ~= self) then
3
+ if radix == nil or radix == 10 or self == math.huge or self == -math.huge or self ~= self then
4
4
  return tostring(self)
5
5
  end
6
6
  radix = math.floor(radix)
7
- if (radix < 2) or (radix > 36) then
7
+ if radix < 2 or radix > 36 then
8
8
  error("toString() radix argument must be between 2 and 36", 0)
9
9
  end
10
- local integer, fraction = math.modf(
11
- math.abs(self)
12
- )
10
+ local integer, fraction = math.modf(math.abs(self))
13
11
  local result = ""
14
12
  if radix == 8 then
15
13
  result = string.format("%o", integer)
@@ -1,7 +1,13 @@
1
1
  function __TS__ObjectDefineProperty(target, key, desc)
2
- local luaKey = (((type(key) == "number") and (function() return key + 1 end)) or (function() return key end))()
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
3
9
  local value = rawget(target, luaKey)
4
- local hasGetterOrSetter = (desc.get ~= nil) or (desc.set ~= nil)
10
+ local hasGetterOrSetter = desc.get ~= nil or desc.set ~= nil
5
11
  local descriptor
6
12
  if hasGetterOrSetter then
7
13
  if value ~= nil then
@@ -13,13 +19,39 @@ function __TS__ObjectDefineProperty(target, key, desc)
13
19
  descriptor = desc
14
20
  else
15
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
16
48
  descriptor = {
17
- set = desc.set,
18
- get = desc.get,
19
- configurable = (((desc.configurable ~= nil) and (function() return desc.configurable end)) or (function() return valueExists end))(),
20
- enumerable = (((desc.enumerable ~= nil) and (function() return desc.enumerable end)) or (function() return valueExists end))(),
21
- writable = (((desc.writable ~= nil) and (function() return desc.writable end)) or (function() return valueExists end))(),
22
- value = (((desc.value ~= nil) and (function() return desc.value end)) or (function() return value end))()
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
23
55
  }
24
56
  end
25
57
  __TS__SetDescriptor(target, luaKey, descriptor)
@@ -1,10 +1,14 @@
1
1
  function __TS__ParseFloat(numberString)
2
2
  local infinityMatch = string.match(numberString, "^%s*(-?Infinity)")
3
3
  if infinityMatch then
4
- return (((__TS__StringAccess(infinityMatch, 0) == "-") and (function() return -math.huge end)) or (function() return math.huge end))()
4
+ local ____temp_0
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
5
11
  end
6
- local number = tonumber(
7
- string.match(numberString, "^%s*(-?%d+%.?%d*)")
8
- )
9
- return number or (0 / 0)
12
+ local number = tonumber(string.match(numberString, "^%s*(-?%d+%.?%d*)"))
13
+ return number or 0 / 0
10
14
  end
@@ -5,13 +5,25 @@ function __TS__ParseInt(numberString, base)
5
5
  local hexMatch = string.match(numberString, "^%s*-?0[xX]")
6
6
  if hexMatch then
7
7
  base = 16
8
- numberString = ((string.match(hexMatch, "-") and (function() return "-" .. __TS__StringSubstr(numberString, #hexMatch) end)) or (function() return __TS__StringSubstr(numberString, #hexMatch) end))()
8
+ local ____string_match_result__0_0
9
+ if string.match(hexMatch, "-") then
10
+ ____string_match_result__0_0 = "-" .. __TS__StringSubstr(numberString, #hexMatch)
11
+ else
12
+ ____string_match_result__0_0 = __TS__StringSubstr(numberString, #hexMatch)
13
+ end
14
+ numberString = ____string_match_result__0_0
9
15
  end
10
16
  end
11
- if (base < 2) or (base > 36) then
17
+ if base < 2 or base > 36 then
12
18
  return 0 / 0
13
19
  end
14
- local allowedDigits = (((base <= 10) and (function() return __TS__StringSubstring(__TS__parseInt_base_pattern, 0, base) end)) or (function() return __TS__StringSubstr(__TS__parseInt_base_pattern, 0, 10 + (2 * (base - 10))) end))()
20
+ local ____temp_1
21
+ if base <= 10 then
22
+ ____temp_1 = __TS__StringSubstring(__TS__parseInt_base_pattern, 0, base)
23
+ else
24
+ ____temp_1 = __TS__StringSubstr(__TS__parseInt_base_pattern, 0, 10 + 2 * (base - 10))
25
+ end
26
+ local allowedDigits = ____temp_1
15
27
  local pattern = ("^%s*(-?[" .. allowedDigits) .. "]*)"
16
28
  local number = tonumber(
17
29
  string.match(numberString, pattern),
@@ -31,15 +31,13 @@ function __TS__Promise.prototype.____constructor(self, executor)
31
31
  local function ____catch(e)
32
32
  self:reject(e)
33
33
  end
34
- local ____try, ____hasReturned = pcall(
35
- function()
36
- executor(
37
- _G,
38
- __TS__FunctionBind(self.resolve, self),
39
- __TS__FunctionBind(self.reject, self)
40
- )
41
- end
42
- )
34
+ local ____try, ____hasReturned = pcall(function()
35
+ executor(
36
+ _G,
37
+ __TS__FunctionBind(self.resolve, self),
38
+ __TS__FunctionBind(self.reject, self)
39
+ )
40
+ end)
43
41
  if not ____try then
44
42
  ____hasReturned, ____returnValue = ____catch(____hasReturned)
45
43
  end
@@ -66,10 +64,10 @@ function __TS__Promise.reject(reason)
66
64
  return promise
67
65
  end
68
66
  __TS__Promise.prototype["then"] = function(self, onFulfilled, onRejected)
69
- local ____ = __TS__PromiseDeferred(_G)
70
- local promise = ____.promise
71
- local resolve = ____.resolve
72
- local reject = ____.reject
67
+ local ____TS__PromiseDeferred_result_0 = __TS__PromiseDeferred(_G)
68
+ local promise = ____TS__PromiseDeferred_result_0.promise
69
+ local resolve = ____TS__PromiseDeferred_result_0.resolve
70
+ local reject = ____TS__PromiseDeferred_result_0.reject
73
71
  local isFulfilled = self.state == __TS__PromiseState.Fulfilled
74
72
  local isRejected = self.state == __TS__PromiseState.Rejected
75
73
  if onFulfilled then
@@ -141,15 +139,13 @@ function __TS__Promise.prototype.createPromiseResolvingCallback(self, f, resolve
141
139
  local function ____catch(e)
142
140
  reject(_G, e)
143
141
  end
144
- local ____try, ____hasReturned = pcall(
145
- function()
146
- self:handleCallbackData(
147
- f(_G, value),
148
- resolve,
149
- reject
150
- )
151
- end
152
- )
142
+ local ____try, ____hasReturned = pcall(function()
143
+ self:handleCallbackData(
144
+ f(_G, value),
145
+ resolve,
146
+ reject
147
+ )
148
+ end)
153
149
  if not ____try then
154
150
  ____hasReturned, ____returnValue = ____catch(____hasReturned)
155
151
  end