isaacscript-common 1.0.511 → 1.0.515
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/callbacks/itemPickup.lua +6 -2
- package/dist/callbacks/postBombInitLate.lua +5 -1
- package/dist/callbacks/postCursedTeleport.lua +10 -8
- package/dist/callbacks/postEffectInitLate.lua +5 -1
- package/dist/callbacks/postEsauJr.lua +4 -2
- package/dist/callbacks/postFamiliarInitLate.lua +5 -1
- package/dist/callbacks/postFlip.lua +4 -2
- package/dist/callbacks/postGridEntity.lua +18 -8
- package/dist/callbacks/postKnifeInitLate.lua +5 -1
- package/dist/callbacks/postLaserInitLate.lua +5 -1
- package/dist/callbacks/postNPCInitLate.lua +5 -1
- package/dist/callbacks/postPickupCollect.lua +5 -1
- package/dist/callbacks/postPickupInitLate.lua +5 -1
- package/dist/callbacks/postPlayerChangeHealth.lua +13 -9
- package/dist/callbacks/postPlayerChangeType.lua +5 -1
- package/dist/callbacks/postPlayerFatalDamage.lua +2 -2
- package/dist/callbacks/postPlayerInitLate.lua +5 -1
- package/dist/callbacks/postPlayerReordered.lua +1 -1
- package/dist/callbacks/postProjectileInitLate.lua +5 -1
- package/dist/callbacks/postPurchase.lua +15 -17
- package/dist/callbacks/postSacrifice.lua +3 -3
- package/dist/callbacks/postSlotInitUpdate.lua +11 -3
- package/dist/callbacks/postSlotRenderBroken.lua +8 -2
- package/dist/callbacks/postTearInitLate.lua +5 -1
- package/dist/callbacks/postTransformation.lua +5 -1
- package/dist/callbacks/reorderedCallbacks.lua +4 -4
- package/dist/callbacks/subscriptions/postBombInitLate.lua +3 -3
- package/dist/callbacks/subscriptions/postCursedTeleport.lua +1 -1
- package/dist/callbacks/subscriptions/postCustomRevive.lua +3 -3
- package/dist/callbacks/subscriptions/postEffectInitLate.lua +3 -3
- package/dist/callbacks/subscriptions/postEsauJr.lua +1 -1
- package/dist/callbacks/subscriptions/postFamiliarInitLate.lua +3 -3
- package/dist/callbacks/subscriptions/postFirstEsauJr.lua +1 -1
- package/dist/callbacks/subscriptions/postFirstFlip.lua +1 -1
- package/dist/callbacks/subscriptions/postFlip.lua +1 -1
- package/dist/callbacks/subscriptions/postGameStartedReordered.lua +1 -1
- package/dist/callbacks/subscriptions/postGridEntityInit.lua +3 -3
- package/dist/callbacks/subscriptions/postGridEntityRemove.lua +3 -3
- package/dist/callbacks/subscriptions/postGridEntityUpdate.lua +3 -3
- package/dist/callbacks/subscriptions/postItemPickup.lua +5 -5
- package/dist/callbacks/subscriptions/postKnifeInitLate.lua +3 -3
- package/dist/callbacks/subscriptions/postLaserInitLate.lua +3 -3
- package/dist/callbacks/subscriptions/postNPCInitLate.lua +3 -3
- package/dist/callbacks/subscriptions/postNewLevelReordered.lua +1 -1
- package/dist/callbacks/subscriptions/postNewRoomEarly.lua +1 -1
- package/dist/callbacks/subscriptions/postNewRoomReordered.lua +1 -1
- package/dist/callbacks/subscriptions/postPickupCollect.lua +3 -3
- package/dist/callbacks/subscriptions/postPickupInitLate.lua +3 -3
- package/dist/callbacks/subscriptions/postPlayerChangeHealth.lua +3 -3
- package/dist/callbacks/subscriptions/postPlayerChangeType.lua +1 -1
- package/dist/callbacks/subscriptions/postPlayerFatalDamage.lua +3 -3
- package/dist/callbacks/subscriptions/postPlayerInitLate.lua +3 -3
- package/dist/callbacks/subscriptions/postPlayerInitReordered.lua +3 -3
- package/dist/callbacks/subscriptions/postPlayerRenderReordered.lua +3 -3
- package/dist/callbacks/subscriptions/postPlayerUpdateReordered.lua +3 -3
- package/dist/callbacks/subscriptions/postProjectileInitLate.lua +3 -3
- package/dist/callbacks/subscriptions/postPurchase.lua +2 -8
- package/dist/callbacks/subscriptions/postSacrifice.lua +1 -1
- package/dist/callbacks/subscriptions/postSlotDestroyed.lua +3 -3
- package/dist/callbacks/subscriptions/postSlotInit.lua +3 -3
- package/dist/callbacks/subscriptions/postSlotRender.lua +3 -3
- package/dist/callbacks/subscriptions/postSlotUpdate.lua +3 -3
- package/dist/callbacks/subscriptions/postTearInitLate.lua +3 -3
- package/dist/callbacks/subscriptions/postTransformation.lua +3 -3
- package/dist/callbacks/subscriptions/preCustomRevive.lua +1 -1
- package/dist/callbacks/subscriptions/preItemPickup.lua +5 -5
- package/dist/constants.lua +5 -47
- package/dist/features/deployJSONRoom.lua +61 -90
- package/dist/features/disableInputs.lua +3 -9
- package/dist/features/forgottenSwitch.lua +1 -1
- package/dist/features/getCollectibleItemPoolType.lua +10 -4
- package/dist/features/preventCollectibleRotate.lua +9 -3
- package/dist/features/saveDataManager/load.lua +6 -2
- package/dist/features/saveDataManager/main.lua +1 -1
- package/dist/features/saveDataManager/merge.lua +4 -2
- package/dist/features/sirenHelpers.lua +5 -5
- package/dist/functions/array.lua +7 -5
- package/dist/functions/bitwise.lua +1 -1
- package/dist/functions/charge.lua +12 -10
- package/dist/functions/collectibles.lua +23 -18
- package/dist/functions/color.lua +1 -9
- package/dist/functions/deepCopy.lua +22 -42
- package/dist/functions/deepCopyTests.lua +20 -12
- package/dist/functions/doors.lua +19 -7
- package/dist/functions/entity.lua +2 -8
- package/dist/functions/flag.lua +1 -1
- package/dist/functions/gridEntity.lua +9 -14
- package/dist/functions/input.lua +18 -14
- package/dist/functions/jsonRoom.lua +9 -3
- package/dist/functions/language.lua +1 -9
- package/dist/functions/log.lua +46 -18
- package/dist/functions/math.lua +17 -15
- package/dist/functions/npc.lua +17 -15
- package/dist/functions/pickups.lua +1 -14
- package/dist/functions/player.lua +47 -25
- package/dist/functions/playerHealth.lua +9 -19
- package/dist/functions/pocketItems.lua +4 -4
- package/dist/functions/random.lua +2 -2
- package/dist/functions/revive.lua +4 -4
- package/dist/functions/rooms.d.ts +14 -1
- package/dist/functions/rooms.lua +77 -17
- package/dist/functions/spawnCollectible.lua +2 -10
- package/dist/functions/sprite.lua +2 -2
- package/dist/functions/stage.lua +6 -6
- package/dist/functions/tears.lua +1 -1
- package/dist/functions/transformations.lua +10 -4
- package/dist/functions/trinketGive.lua +2 -2
- package/dist/functions/trinkets.lua +5 -3
- package/dist/functions/ui.lua +3 -3
- package/dist/functions/util.lua +8 -4
- package/dist/functions/vector.lua +8 -8
- package/dist/lualib_bundle.lua +555 -603
- package/dist/maps/cardDescriptionMap.lua +1 -99
- package/dist/maps/cardNameMap.lua +1 -99
- package/dist/maps/collectibleDescriptionMap.lua +1 -722
- package/dist/maps/collectibleNameMap.lua +1 -722
- package/dist/maps/gridEntityXMLMap.lua +1 -36
- package/dist/maps/pillEffectNameMap.lua +1 -52
- package/dist/maps/roomShapeToTopLeftWallGridIndexMap.lua +1 -7
- package/dist/maps/transformationMap.lua +12 -19
- package/dist/maps/trinketDescriptionMap.lua +1 -190
- package/dist/maps/trinketNameMap.lua +1 -190
- package/dist/sets/cards.lua +2 -98
- package/dist/types/ModUpgraded.lua +50 -44
- package/package.json +2 -2
package/dist/lualib_bundle.lua
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function __TS__ArrayIsArray(value)
|
|
2
|
-
return type(value) == "table" and (value[1] ~= nil or next(value, nil) == nil)
|
|
2
|
+
return (type(value) == "table") and ((value[1] ~= nil) or (next(value, nil) == nil))
|
|
3
3
|
end
|
|
4
4
|
|
|
5
5
|
function __TS__ArrayConcat(arr1, ...)
|
|
@@ -199,13 +199,7 @@ function __TS__ArrayReduce(arr, callbackFn, ...)
|
|
|
199
199
|
error("Reduce of empty array with no initial value", 0)
|
|
200
200
|
end
|
|
201
201
|
for i = k, len - 1 do
|
|
202
|
-
accumulator = callbackFn(
|
|
203
|
-
_G,
|
|
204
|
-
accumulator,
|
|
205
|
-
arr[i + 1],
|
|
206
|
-
i,
|
|
207
|
-
arr
|
|
208
|
-
)
|
|
202
|
+
accumulator = callbackFn(_G, accumulator, arr[i + 1], i, arr)
|
|
209
203
|
end
|
|
210
204
|
return accumulator
|
|
211
205
|
end
|
|
@@ -223,13 +217,7 @@ function __TS__ArrayReduceRight(arr, callbackFn, ...)
|
|
|
223
217
|
error("Reduce of empty array with no initial value", 0)
|
|
224
218
|
end
|
|
225
219
|
for i = k, 0, -1 do
|
|
226
|
-
accumulator = callbackFn(
|
|
227
|
-
_G,
|
|
228
|
-
accumulator,
|
|
229
|
-
arr[i + 1],
|
|
230
|
-
i,
|
|
231
|
-
arr
|
|
232
|
-
)
|
|
220
|
+
accumulator = callbackFn(_G, accumulator, arr[i + 1], i, arr)
|
|
233
221
|
end
|
|
234
222
|
return accumulator
|
|
235
223
|
end
|
|
@@ -354,7 +342,7 @@ function __TS__ArraySplice(list, ...)
|
|
|
354
342
|
if itemCount < actualDeleteCount then
|
|
355
343
|
do
|
|
356
344
|
local k = actualStart
|
|
357
|
-
while k < len - actualDeleteCount do
|
|
345
|
+
while k < (len - actualDeleteCount) do
|
|
358
346
|
local from = k + actualDeleteCount
|
|
359
347
|
local to = k + itemCount
|
|
360
348
|
if list[from + 1] then
|
|
@@ -367,7 +355,7 @@ function __TS__ArraySplice(list, ...)
|
|
|
367
355
|
end
|
|
368
356
|
do
|
|
369
357
|
local k = len
|
|
370
|
-
while k > len - actualDeleteCount + itemCount do
|
|
358
|
+
while k > ((len - actualDeleteCount) + itemCount) do
|
|
371
359
|
list[k] = nil
|
|
372
360
|
k = k - 1
|
|
373
361
|
end
|
|
@@ -376,8 +364,8 @@ function __TS__ArraySplice(list, ...)
|
|
|
376
364
|
do
|
|
377
365
|
local k = len - actualDeleteCount
|
|
378
366
|
while k > actualStart do
|
|
379
|
-
local from = k + actualDeleteCount - 1
|
|
380
|
-
local to = k + itemCount - 1
|
|
367
|
+
local from = (k + actualDeleteCount) - 1
|
|
368
|
+
local to = (k + itemCount) - 1
|
|
381
369
|
if list[from + 1] then
|
|
382
370
|
list[to + 1] = list[from + 1]
|
|
383
371
|
else
|
|
@@ -394,7 +382,7 @@ function __TS__ArraySplice(list, ...)
|
|
|
394
382
|
end
|
|
395
383
|
do
|
|
396
384
|
local k = #list - 1
|
|
397
|
-
while k >= len - actualDeleteCount + itemCount do
|
|
385
|
+
while k >= ((len - actualDeleteCount) + itemCount) do
|
|
398
386
|
list[k + 1] = nil
|
|
399
387
|
k = k - 1
|
|
400
388
|
end
|
|
@@ -420,7 +408,7 @@ function __TS__ArrayFlat(array, depth)
|
|
|
420
408
|
end
|
|
421
409
|
local result = {}
|
|
422
410
|
for ____, value in ipairs(array) do
|
|
423
|
-
if depth > 0 and __TS__ArrayIsArray(value) then
|
|
411
|
+
if (depth > 0) and __TS__ArrayIsArray(value) then
|
|
424
412
|
result = __TS__ArrayConcat(
|
|
425
413
|
result,
|
|
426
414
|
__TS__ArrayFlat(value, depth - 1)
|
|
@@ -438,7 +426,7 @@ function __TS__ArrayFlatMap(array, callback)
|
|
|
438
426
|
local i = 0
|
|
439
427
|
while i < #array do
|
|
440
428
|
local value = callback(_G, array[i + 1], i, array)
|
|
441
|
-
if type(value) == "table" and __TS__ArrayIsArray(value) then
|
|
429
|
+
if (type(value) == "table") and __TS__ArrayIsArray(value) then
|
|
442
430
|
result = __TS__ArrayConcat(result, value)
|
|
443
431
|
else
|
|
444
432
|
result[#result + 1] = value
|
|
@@ -450,7 +438,7 @@ function __TS__ArrayFlatMap(array, callback)
|
|
|
450
438
|
end
|
|
451
439
|
|
|
452
440
|
function __TS__ArraySetLength(arr, length)
|
|
453
|
-
if length < 0 or length ~= length or length == math.huge or math.floor(length) ~= length then
|
|
441
|
+
if (((length < 0) or (length ~= length)) or (length == math.huge)) or (math.floor(length) ~= length) then
|
|
454
442
|
error(
|
|
455
443
|
"invalid array length: " .. tostring(length),
|
|
456
444
|
0
|
|
@@ -466,9 +454,11 @@ function __TS__ArraySetLength(arr, length)
|
|
|
466
454
|
return length
|
|
467
455
|
end
|
|
468
456
|
|
|
469
|
-
____symbolMetatable = {
|
|
470
|
-
|
|
471
|
-
|
|
457
|
+
____symbolMetatable = {
|
|
458
|
+
__tostring = function(self)
|
|
459
|
+
return ("Symbol(" .. (self.description or "")) .. ")"
|
|
460
|
+
end
|
|
461
|
+
}
|
|
472
462
|
function __TS__Symbol(description)
|
|
473
463
|
return setmetatable({description = description}, ____symbolMetatable)
|
|
474
464
|
end
|
|
@@ -484,7 +474,7 @@ function __TS__InstanceOf(obj, classTbl)
|
|
|
484
474
|
error("Right-hand side of 'instanceof' is not an object", 0)
|
|
485
475
|
end
|
|
486
476
|
if classTbl[Symbol.hasInstance] ~= nil then
|
|
487
|
-
return not not classTbl[Symbol.hasInstance](classTbl, obj)
|
|
477
|
+
return not (not classTbl[Symbol.hasInstance](classTbl, obj))
|
|
488
478
|
end
|
|
489
479
|
if type(obj) == "table" then
|
|
490
480
|
local luaClass = obj.constructor
|
|
@@ -510,20 +500,14 @@ function __TS__AsyncAwaiter(generator)
|
|
|
510
500
|
function(____, resolve, reject)
|
|
511
501
|
local adopt, fulfilled, rejected, step, asyncCoroutine
|
|
512
502
|
function adopt(self, value)
|
|
513
|
-
|
|
514
|
-
if __TS__InstanceOf(value, __TS__Promise) then
|
|
515
|
-
____temp_0 = value
|
|
516
|
-
else
|
|
517
|
-
____temp_0 = __TS__Promise.resolve(value)
|
|
518
|
-
end
|
|
519
|
-
return ____temp_0
|
|
503
|
+
return ((__TS__InstanceOf(value, __TS__Promise) and (function() return value end)) or (function() return __TS__Promise.resolve(value) end))()
|
|
520
504
|
end
|
|
521
505
|
function fulfilled(self, value)
|
|
522
506
|
local success, errorOrErrorHandler, resultOrError = coroutine.resume(asyncCoroutine, value)
|
|
523
507
|
if success then
|
|
524
508
|
step(_G, resultOrError, errorOrErrorHandler)
|
|
525
509
|
else
|
|
526
|
-
reject(_G,
|
|
510
|
+
reject(_G, resultOrError)
|
|
527
511
|
end
|
|
528
512
|
end
|
|
529
513
|
function rejected(self, handler)
|
|
@@ -546,12 +530,14 @@ function __TS__AsyncAwaiter(generator)
|
|
|
546
530
|
if coroutine.status(asyncCoroutine) == "dead" then
|
|
547
531
|
resolve(_G, result)
|
|
548
532
|
else
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
533
|
+
(function()
|
|
534
|
+
local ____self = adopt(_G, result)
|
|
535
|
+
return ____self["then"](
|
|
536
|
+
____self,
|
|
537
|
+
fulfilled,
|
|
538
|
+
rejected(_G, errorHandler)
|
|
539
|
+
)
|
|
540
|
+
end)()
|
|
555
541
|
end
|
|
556
542
|
end
|
|
557
543
|
asyncCoroutine = coroutine.create(generator)
|
|
@@ -600,22 +586,22 @@ function __TS__ClassExtends(target, base)
|
|
|
600
586
|
end
|
|
601
587
|
end
|
|
602
588
|
|
|
603
|
-
local value
|
|
604
|
-
local writable
|
|
605
|
-
local set
|
|
606
|
-
local get
|
|
607
|
-
local configurable
|
|
608
|
-
local enumerable
|
|
609
589
|
function __TS__CloneDescriptor(____bindingPattern0)
|
|
590
|
+
local enumerable
|
|
610
591
|
enumerable = ____bindingPattern0.enumerable
|
|
592
|
+
local configurable
|
|
611
593
|
configurable = ____bindingPattern0.configurable
|
|
594
|
+
local get
|
|
612
595
|
get = ____bindingPattern0.get
|
|
596
|
+
local set
|
|
613
597
|
set = ____bindingPattern0.set
|
|
598
|
+
local writable
|
|
614
599
|
writable = ____bindingPattern0.writable
|
|
600
|
+
local value
|
|
615
601
|
value = ____bindingPattern0.value
|
|
616
602
|
local descriptor = {enumerable = enumerable == true, configurable = configurable == true}
|
|
617
|
-
local hasGetterOrSetter = get ~= nil or set ~= nil
|
|
618
|
-
local hasValueOrWritableAttribute = writable ~= nil or value ~= nil
|
|
603
|
+
local hasGetterOrSetter = (get ~= nil) or (set ~= nil)
|
|
604
|
+
local hasValueOrWritableAttribute = (writable ~= nil) or (value ~= nil)
|
|
619
605
|
if hasGetterOrSetter and hasValueOrWritableAttribute then
|
|
620
606
|
error("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute.", 0)
|
|
621
607
|
end
|
|
@@ -693,13 +679,7 @@ function __TS__SetDescriptor(target, key, desc, isPrototype)
|
|
|
693
679
|
if isPrototype == nil then
|
|
694
680
|
isPrototype = false
|
|
695
681
|
end
|
|
696
|
-
local
|
|
697
|
-
if isPrototype then
|
|
698
|
-
____isPrototype_0 = target
|
|
699
|
-
else
|
|
700
|
-
____isPrototype_0 = getmetatable(target)
|
|
701
|
-
end
|
|
702
|
-
local metatable = ____isPrototype_0
|
|
682
|
+
local metatable = ((isPrototype and (function() return target end)) or (function() return getmetatable(target) end))()
|
|
703
683
|
if not metatable then
|
|
704
684
|
metatable = {}
|
|
705
685
|
setmetatable(target, metatable)
|
|
@@ -744,7 +724,7 @@ function __TS__Decorate(decorators, target, key, desc)
|
|
|
744
724
|
local value = rawget(target, key)
|
|
745
725
|
local descriptor = __TS__ObjectGetOwnPropertyDescriptor(target, key) or ({configurable = true, writable = true, value = value})
|
|
746
726
|
local desc = decorator(_G, target, key, descriptor) or descriptor
|
|
747
|
-
local isSimpleValue = desc.configurable == true and desc.writable == true and not desc.get and not desc.set
|
|
727
|
+
local isSimpleValue = (((desc.configurable == true) and (desc.writable == true)) and (not desc.get)) and (not desc.set)
|
|
748
728
|
if isSimpleValue then
|
|
749
729
|
rawset(target, key, desc.value)
|
|
750
730
|
else
|
|
@@ -779,107 +759,28 @@ function __TS__ObjectGetOwnPropertyDescriptors(object)
|
|
|
779
759
|
return rawget(metatable, "_descriptors") or ({})
|
|
780
760
|
end
|
|
781
761
|
|
|
782
|
-
function __TS__GetErrorStack(self, constructor)
|
|
783
|
-
local level = 1
|
|
784
|
-
while true do
|
|
785
|
-
local info = debug.getinfo(level, "f")
|
|
786
|
-
level = level + 1
|
|
787
|
-
if not info then
|
|
788
|
-
level = 1
|
|
789
|
-
break
|
|
790
|
-
elseif info.func == constructor then
|
|
791
|
-
break
|
|
792
|
-
end
|
|
793
|
-
end
|
|
794
|
-
return debug.traceback(nil, level)
|
|
795
|
-
end
|
|
796
|
-
function __TS__WrapErrorToString(self, getDescription)
|
|
797
|
-
return function(self)
|
|
798
|
-
local description = getDescription(self)
|
|
799
|
-
local caller = debug.getinfo(3, "f")
|
|
800
|
-
if _VERSION == "Lua 5.1" or caller and caller.func ~= error then
|
|
801
|
-
return description
|
|
802
|
-
else
|
|
803
|
-
return (tostring(description) .. "\n") .. self.stack
|
|
804
|
-
end
|
|
805
|
-
end
|
|
806
|
-
end
|
|
807
|
-
function __TS__InitErrorClass(self, Type, name)
|
|
808
|
-
Type.name = name
|
|
809
|
-
return setmetatable(
|
|
810
|
-
Type,
|
|
811
|
-
{__call = function(____, _self, message) return __TS__New(Type, message) end}
|
|
812
|
-
)
|
|
813
|
-
end
|
|
814
|
-
local ____TS__InitErrorClass_3 = __TS__InitErrorClass
|
|
815
|
-
local ____G_2 = _G
|
|
816
|
-
____class_0 = __TS__Class()
|
|
817
|
-
____class_0.name = ""
|
|
818
|
-
function ____class_0.prototype.____constructor(self, message)
|
|
819
|
-
if message == nil then
|
|
820
|
-
message = ""
|
|
821
|
-
end
|
|
822
|
-
self.message = message
|
|
823
|
-
self.name = "Error"
|
|
824
|
-
self.stack = __TS__GetErrorStack(_G, self.constructor.new)
|
|
825
|
-
local metatable = getmetatable(self)
|
|
826
|
-
if not metatable.__errorToStringPatched then
|
|
827
|
-
metatable.__errorToStringPatched = true
|
|
828
|
-
metatable.__tostring = __TS__WrapErrorToString(_G, metatable.__tostring)
|
|
829
|
-
end
|
|
830
|
-
end
|
|
831
|
-
function ____class_0.prototype.__tostring(self)
|
|
832
|
-
local ____temp_1
|
|
833
|
-
if self.message ~= "" then
|
|
834
|
-
____temp_1 = (self.name .. ": ") .. self.message
|
|
835
|
-
else
|
|
836
|
-
____temp_1 = self.name
|
|
837
|
-
end
|
|
838
|
-
return ____temp_1
|
|
839
|
-
end
|
|
840
|
-
Error = ____TS__InitErrorClass_3(____G_2, ____class_0, "Error")
|
|
841
|
-
for ____, errorName in ipairs({
|
|
842
|
-
"RangeError",
|
|
843
|
-
"ReferenceError",
|
|
844
|
-
"SyntaxError",
|
|
845
|
-
"TypeError",
|
|
846
|
-
"URIError"
|
|
847
|
-
}) do
|
|
848
|
-
local ____G_7 = _G
|
|
849
|
-
local ____TS__InitErrorClass_6 = __TS__InitErrorClass
|
|
850
|
-
local ____G_5 = _G
|
|
851
|
-
local ____class_4 = __TS__Class()
|
|
852
|
-
____class_4.name = ____class_4.name
|
|
853
|
-
__TS__ClassExtends(____class_4, Error)
|
|
854
|
-
function ____class_4.prototype.____constructor(self, ...)
|
|
855
|
-
Error.prototype.____constructor(self, ...)
|
|
856
|
-
self.name = errorName
|
|
857
|
-
end
|
|
858
|
-
____G_7[errorName] = ____TS__InitErrorClass_6(____G_5, ____class_4, errorName)
|
|
859
|
-
end
|
|
860
|
-
|
|
861
762
|
function __TS__Delete(target, key)
|
|
862
763
|
local descriptors = __TS__ObjectGetOwnPropertyDescriptors(target)
|
|
863
764
|
local descriptor = descriptors[key]
|
|
864
765
|
if descriptor then
|
|
865
766
|
if not descriptor.configurable then
|
|
866
767
|
error(
|
|
867
|
-
|
|
868
|
-
TypeError,
|
|
869
|
-
((("Cannot delete property " .. tostring(key)) .. " of ") .. tostring(target)) .. "."
|
|
870
|
-
),
|
|
768
|
+
((("Cannot delete property " .. tostring(key)) .. " of ") .. tostring(target)) .. ".",
|
|
871
769
|
0
|
|
872
770
|
)
|
|
873
771
|
end
|
|
874
772
|
descriptors[key] = nil
|
|
875
773
|
return true
|
|
876
774
|
end
|
|
877
|
-
target[key]
|
|
878
|
-
|
|
775
|
+
if target[key] ~= nil then
|
|
776
|
+
target[key] = nil
|
|
777
|
+
return true
|
|
778
|
+
end
|
|
779
|
+
return false
|
|
879
780
|
end
|
|
880
781
|
|
|
881
782
|
function __TS__StringAccess(self, index)
|
|
882
|
-
if index >= 0 and index < #self then
|
|
783
|
+
if (index >= 0) and (index < #self) then
|
|
883
784
|
return string.sub(self, index + 1, index + 1)
|
|
884
785
|
end
|
|
885
786
|
end
|
|
@@ -887,7 +788,9 @@ end
|
|
|
887
788
|
function __TS__DelegatedYield(iterable)
|
|
888
789
|
if type(iterable) == "string" then
|
|
889
790
|
for index = 0, #iterable - 1 do
|
|
890
|
-
coroutine.yield(
|
|
791
|
+
coroutine.yield(
|
|
792
|
+
__TS__StringAccess(iterable, index)
|
|
793
|
+
)
|
|
891
794
|
end
|
|
892
795
|
elseif iterable.____coroutine ~= nil then
|
|
893
796
|
local co = iterable.____coroutine
|
|
@@ -919,6 +822,82 @@ function __TS__DelegatedYield(iterable)
|
|
|
919
822
|
end
|
|
920
823
|
end
|
|
921
824
|
|
|
825
|
+
function __TS__GetErrorStack(self, constructor)
|
|
826
|
+
local level = 1
|
|
827
|
+
while true do
|
|
828
|
+
local info = debug.getinfo(level, "f")
|
|
829
|
+
level = level + 1
|
|
830
|
+
if not info then
|
|
831
|
+
level = 1
|
|
832
|
+
break
|
|
833
|
+
elseif info.func == constructor then
|
|
834
|
+
break
|
|
835
|
+
end
|
|
836
|
+
end
|
|
837
|
+
return debug.traceback(nil, level)
|
|
838
|
+
end
|
|
839
|
+
function __TS__WrapErrorToString(self, getDescription)
|
|
840
|
+
return function(self)
|
|
841
|
+
local description = getDescription(self)
|
|
842
|
+
local caller = debug.getinfo(3, "f")
|
|
843
|
+
if (_VERSION == "Lua 5.1") or (caller and (caller.func ~= error)) then
|
|
844
|
+
return description
|
|
845
|
+
else
|
|
846
|
+
return (tostring(description) .. "\n") .. self.stack
|
|
847
|
+
end
|
|
848
|
+
end
|
|
849
|
+
end
|
|
850
|
+
function __TS__InitErrorClass(self, Type, name)
|
|
851
|
+
Type.name = name
|
|
852
|
+
return setmetatable(
|
|
853
|
+
Type,
|
|
854
|
+
{
|
|
855
|
+
__call = function(____, _self, message) return __TS__New(Type, message) end
|
|
856
|
+
}
|
|
857
|
+
)
|
|
858
|
+
end
|
|
859
|
+
Error = __TS__InitErrorClass(
|
|
860
|
+
_G,
|
|
861
|
+
(function()
|
|
862
|
+
local ____ = __TS__Class()
|
|
863
|
+
____.name = ""
|
|
864
|
+
function ____.prototype.____constructor(self, message)
|
|
865
|
+
if message == nil then
|
|
866
|
+
message = ""
|
|
867
|
+
end
|
|
868
|
+
self.message = message
|
|
869
|
+
self.name = "Error"
|
|
870
|
+
self.stack = __TS__GetErrorStack(_G, self.constructor.new)
|
|
871
|
+
local metatable = getmetatable(self)
|
|
872
|
+
if not metatable.__errorToStringPatched then
|
|
873
|
+
metatable.__errorToStringPatched = true
|
|
874
|
+
metatable.__tostring = __TS__WrapErrorToString(_G, metatable.__tostring)
|
|
875
|
+
end
|
|
876
|
+
end
|
|
877
|
+
function ____.prototype.__tostring(self)
|
|
878
|
+
return (((self.message ~= "") and (function() return (self.name .. ": ") .. self.message end)) or (function() return self.name end))()
|
|
879
|
+
end
|
|
880
|
+
return ____
|
|
881
|
+
end)(),
|
|
882
|
+
"Error"
|
|
883
|
+
)
|
|
884
|
+
for ____, errorName in ipairs({"RangeError", "ReferenceError", "SyntaxError", "TypeError", "URIError"}) do
|
|
885
|
+
_G[errorName] = __TS__InitErrorClass(
|
|
886
|
+
_G,
|
|
887
|
+
(function()
|
|
888
|
+
local ____ = __TS__Class()
|
|
889
|
+
____.name = ____.name
|
|
890
|
+
__TS__ClassExtends(____, Error)
|
|
891
|
+
function ____.prototype.____constructor(self, ...)
|
|
892
|
+
Error.prototype.____constructor(self, ...)
|
|
893
|
+
self.name = errorName
|
|
894
|
+
end
|
|
895
|
+
return ____
|
|
896
|
+
end)(),
|
|
897
|
+
errorName
|
|
898
|
+
)
|
|
899
|
+
end
|
|
900
|
+
|
|
922
901
|
__TS__Unpack = table.unpack or unpack
|
|
923
902
|
|
|
924
903
|
function __TS__FunctionBind(fn, thisArg, ...)
|
|
@@ -961,7 +940,11 @@ function __TS__Generator(fn)
|
|
|
961
940
|
local args = {...}
|
|
962
941
|
local argsLength = select("#", ...)
|
|
963
942
|
return {
|
|
964
|
-
____coroutine = coroutine.create(
|
|
943
|
+
____coroutine = coroutine.create(
|
|
944
|
+
function() return fn(
|
|
945
|
+
(unpack or table.unpack)(args, 1, argsLength)
|
|
946
|
+
) end
|
|
947
|
+
),
|
|
965
948
|
[Symbol.iterator] = __TS__GeneratorIterator,
|
|
966
949
|
next = __TS__GeneratorNext
|
|
967
950
|
}
|
|
@@ -970,7 +953,7 @@ end
|
|
|
970
953
|
|
|
971
954
|
function __TS__InstanceOfObject(value)
|
|
972
955
|
local valueType = type(value)
|
|
973
|
-
return valueType == "table" or valueType == "function"
|
|
956
|
+
return (valueType == "table") or (valueType == "function")
|
|
974
957
|
end
|
|
975
958
|
|
|
976
959
|
function __TS__IteratorGeneratorStep(self)
|
|
@@ -1011,146 +994,150 @@ function __TS__Iterator(iterable)
|
|
|
1011
994
|
end
|
|
1012
995
|
end
|
|
1013
996
|
|
|
1014
|
-
Map =
|
|
1015
|
-
Map
|
|
1016
|
-
|
|
1017
|
-
self
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
997
|
+
Map = (function()
|
|
998
|
+
local Map = __TS__Class()
|
|
999
|
+
Map.name = "Map"
|
|
1000
|
+
function Map.prototype.____constructor(self, entries)
|
|
1001
|
+
self[Symbol.toStringTag] = "Map"
|
|
1002
|
+
self.items = {}
|
|
1003
|
+
self.size = 0
|
|
1004
|
+
self.nextKey = {}
|
|
1005
|
+
self.previousKey = {}
|
|
1006
|
+
if entries == nil then
|
|
1007
|
+
return
|
|
1008
|
+
end
|
|
1009
|
+
local iterable = entries
|
|
1010
|
+
if iterable[Symbol.iterator] then
|
|
1011
|
+
local iterator = iterable[Symbol.iterator](iterable)
|
|
1012
|
+
while true do
|
|
1013
|
+
local result = iterator:next()
|
|
1014
|
+
if result.done then
|
|
1015
|
+
break
|
|
1016
|
+
end
|
|
1017
|
+
local value = result.value
|
|
1018
|
+
self:set(value[1], value[2])
|
|
1032
1019
|
end
|
|
1033
|
-
local value = result.value
|
|
1034
|
-
self:set(value[1], value[2])
|
|
1035
|
-
end
|
|
1036
|
-
else
|
|
1037
|
-
local array = entries
|
|
1038
|
-
for ____, kvp in ipairs(array) do
|
|
1039
|
-
self:set(kvp[1], kvp[2])
|
|
1040
|
-
end
|
|
1041
|
-
end
|
|
1042
|
-
end
|
|
1043
|
-
function Map.prototype.clear(self)
|
|
1044
|
-
self.items = {}
|
|
1045
|
-
self.nextKey = {}
|
|
1046
|
-
self.previousKey = {}
|
|
1047
|
-
self.firstKey = nil
|
|
1048
|
-
self.lastKey = nil
|
|
1049
|
-
self.size = 0
|
|
1050
|
-
end
|
|
1051
|
-
function Map.prototype.delete(self, key)
|
|
1052
|
-
local contains = self:has(key)
|
|
1053
|
-
if contains then
|
|
1054
|
-
self.size = self.size - 1
|
|
1055
|
-
local next = self.nextKey[key]
|
|
1056
|
-
local previous = self.previousKey[key]
|
|
1057
|
-
if next and previous then
|
|
1058
|
-
self.nextKey[previous] = next
|
|
1059
|
-
self.previousKey[next] = previous
|
|
1060
|
-
elseif next then
|
|
1061
|
-
self.firstKey = next
|
|
1062
|
-
self.previousKey[next] = nil
|
|
1063
|
-
elseif previous then
|
|
1064
|
-
self.lastKey = previous
|
|
1065
|
-
self.nextKey[previous] = nil
|
|
1066
1020
|
else
|
|
1067
|
-
|
|
1068
|
-
|
|
1021
|
+
local array = entries
|
|
1022
|
+
for ____, kvp in ipairs(array) do
|
|
1023
|
+
self:set(kvp[1], kvp[2])
|
|
1024
|
+
end
|
|
1069
1025
|
end
|
|
1070
|
-
self.nextKey[key] = nil
|
|
1071
|
-
self.previousKey[key] = nil
|
|
1072
1026
|
end
|
|
1073
|
-
self
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1027
|
+
function Map.prototype.clear(self)
|
|
1028
|
+
self.items = {}
|
|
1029
|
+
self.nextKey = {}
|
|
1030
|
+
self.previousKey = {}
|
|
1031
|
+
self.firstKey = nil
|
|
1032
|
+
self.lastKey = nil
|
|
1033
|
+
self.size = 0
|
|
1034
|
+
end
|
|
1035
|
+
function Map.prototype.delete(self, key)
|
|
1036
|
+
local contains = self:has(key)
|
|
1037
|
+
if contains then
|
|
1038
|
+
self.size = self.size - 1
|
|
1039
|
+
local next = self.nextKey[key]
|
|
1040
|
+
local previous = self.previousKey[key]
|
|
1041
|
+
if next and previous then
|
|
1042
|
+
self.nextKey[previous] = next
|
|
1043
|
+
self.previousKey[next] = previous
|
|
1044
|
+
elseif next then
|
|
1045
|
+
self.firstKey = next
|
|
1046
|
+
self.previousKey[next] = nil
|
|
1047
|
+
elseif previous then
|
|
1048
|
+
self.lastKey = previous
|
|
1049
|
+
self.nextKey[previous] = nil
|
|
1050
|
+
else
|
|
1051
|
+
self.firstKey = nil
|
|
1052
|
+
self.lastKey = nil
|
|
1053
|
+
end
|
|
1054
|
+
self.nextKey[key] = nil
|
|
1055
|
+
self.previousKey[key] = nil
|
|
1056
|
+
end
|
|
1057
|
+
self.items[key] = nil
|
|
1058
|
+
return contains
|
|
1079
1059
|
end
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
end
|
|
1087
|
-
function Map.prototype.set(self, key, value)
|
|
1088
|
-
local isNewValue = not self:has(key)
|
|
1089
|
-
if isNewValue then
|
|
1090
|
-
self.size = self.size + 1
|
|
1060
|
+
function Map.prototype.forEach(self, callback)
|
|
1061
|
+
for ____, key in __TS__Iterator(
|
|
1062
|
+
self:keys()
|
|
1063
|
+
) do
|
|
1064
|
+
callback(_G, self.items[key], key, self)
|
|
1065
|
+
end
|
|
1091
1066
|
end
|
|
1092
|
-
self
|
|
1093
|
-
|
|
1094
|
-
self.firstKey = key
|
|
1095
|
-
self.lastKey = key
|
|
1096
|
-
elseif isNewValue then
|
|
1097
|
-
self.nextKey[self.lastKey] = key
|
|
1098
|
-
self.previousKey[key] = self.lastKey
|
|
1099
|
-
self.lastKey = key
|
|
1067
|
+
function Map.prototype.get(self, key)
|
|
1068
|
+
return self.items[key]
|
|
1100
1069
|
end
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
local items = ____temp_0.items
|
|
1109
|
-
local nextKey = ____temp_0.nextKey
|
|
1110
|
-
local key = self.firstKey
|
|
1111
|
-
return {
|
|
1112
|
-
[Symbol.iterator] = function(self)
|
|
1113
|
-
return self
|
|
1114
|
-
end,
|
|
1115
|
-
next = function(self)
|
|
1116
|
-
local result = {done = not key, value = {key, items[key]}}
|
|
1117
|
-
key = nextKey[key]
|
|
1118
|
-
return result
|
|
1119
|
-
end
|
|
1120
|
-
}
|
|
1121
|
-
end
|
|
1122
|
-
function Map.prototype.keys(self)
|
|
1123
|
-
local nextKey = self.nextKey
|
|
1124
|
-
local key = self.firstKey
|
|
1125
|
-
return {
|
|
1126
|
-
[Symbol.iterator] = function(self)
|
|
1127
|
-
return self
|
|
1128
|
-
end,
|
|
1129
|
-
next = function(self)
|
|
1130
|
-
local result = {done = not key, value = key}
|
|
1131
|
-
key = nextKey[key]
|
|
1132
|
-
return result
|
|
1070
|
+
function Map.prototype.has(self, key)
|
|
1071
|
+
return (self.nextKey[key] ~= nil) or (self.lastKey == key)
|
|
1072
|
+
end
|
|
1073
|
+
function Map.prototype.set(self, key, value)
|
|
1074
|
+
local isNewValue = not self:has(key)
|
|
1075
|
+
if isNewValue then
|
|
1076
|
+
self.size = self.size + 1
|
|
1133
1077
|
end
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
[Symbol.iterator] = function(self)
|
|
1143
|
-
return self
|
|
1144
|
-
end,
|
|
1145
|
-
next = function(self)
|
|
1146
|
-
local result = {done = not key, value = items[key]}
|
|
1147
|
-
key = nextKey[key]
|
|
1148
|
-
return result
|
|
1078
|
+
self.items[key] = value
|
|
1079
|
+
if self.firstKey == nil then
|
|
1080
|
+
self.firstKey = key
|
|
1081
|
+
self.lastKey = key
|
|
1082
|
+
elseif isNewValue then
|
|
1083
|
+
self.nextKey[self.lastKey] = key
|
|
1084
|
+
self.previousKey[key] = self.lastKey
|
|
1085
|
+
self.lastKey = key
|
|
1149
1086
|
end
|
|
1150
|
-
|
|
1151
|
-
end
|
|
1152
|
-
Map[Symbol.
|
|
1153
|
-
|
|
1087
|
+
return self
|
|
1088
|
+
end
|
|
1089
|
+
Map.prototype[Symbol.iterator] = function(self)
|
|
1090
|
+
return self:entries()
|
|
1091
|
+
end
|
|
1092
|
+
function Map.prototype.entries(self)
|
|
1093
|
+
local ____ = self
|
|
1094
|
+
local items = ____.items
|
|
1095
|
+
local nextKey = ____.nextKey
|
|
1096
|
+
local key = self.firstKey
|
|
1097
|
+
return {
|
|
1098
|
+
[Symbol.iterator] = function(self)
|
|
1099
|
+
return self
|
|
1100
|
+
end,
|
|
1101
|
+
next = function(self)
|
|
1102
|
+
local result = {done = not key, value = {key, items[key]}}
|
|
1103
|
+
key = nextKey[key]
|
|
1104
|
+
return result
|
|
1105
|
+
end
|
|
1106
|
+
}
|
|
1107
|
+
end
|
|
1108
|
+
function Map.prototype.keys(self)
|
|
1109
|
+
local nextKey = self.nextKey
|
|
1110
|
+
local key = self.firstKey
|
|
1111
|
+
return {
|
|
1112
|
+
[Symbol.iterator] = function(self)
|
|
1113
|
+
return self
|
|
1114
|
+
end,
|
|
1115
|
+
next = function(self)
|
|
1116
|
+
local result = {done = not key, value = key}
|
|
1117
|
+
key = nextKey[key]
|
|
1118
|
+
return result
|
|
1119
|
+
end
|
|
1120
|
+
}
|
|
1121
|
+
end
|
|
1122
|
+
function Map.prototype.values(self)
|
|
1123
|
+
local ____ = self
|
|
1124
|
+
local items = ____.items
|
|
1125
|
+
local nextKey = ____.nextKey
|
|
1126
|
+
local key = self.firstKey
|
|
1127
|
+
return {
|
|
1128
|
+
[Symbol.iterator] = function(self)
|
|
1129
|
+
return self
|
|
1130
|
+
end,
|
|
1131
|
+
next = function(self)
|
|
1132
|
+
local result = {done = not key, value = items[key]}
|
|
1133
|
+
key = nextKey[key]
|
|
1134
|
+
return result
|
|
1135
|
+
end
|
|
1136
|
+
}
|
|
1137
|
+
end
|
|
1138
|
+
Map[Symbol.species] = Map
|
|
1139
|
+
return Map
|
|
1140
|
+
end)()
|
|
1154
1141
|
|
|
1155
1142
|
__TS__MathAtan2 = math.atan2 or math.atan
|
|
1156
1143
|
|
|
@@ -1175,14 +1162,14 @@ function __TS__Number(value)
|
|
|
1175
1162
|
end
|
|
1176
1163
|
return 0 / 0
|
|
1177
1164
|
elseif valueType == "boolean" then
|
|
1178
|
-
return value and 1 or 0
|
|
1165
|
+
return (value and 1) or 0
|
|
1179
1166
|
else
|
|
1180
1167
|
return 0 / 0
|
|
1181
1168
|
end
|
|
1182
1169
|
end
|
|
1183
1170
|
|
|
1184
1171
|
function __TS__NumberIsFinite(value)
|
|
1185
|
-
return type(value) == "number" and value == value and value ~= math.huge and value ~= -math.huge
|
|
1172
|
+
return (((type(value) == "number") and (value == value)) and (value ~= math.huge)) and (value ~= -math.huge)
|
|
1186
1173
|
end
|
|
1187
1174
|
|
|
1188
1175
|
function __TS__NumberIsNaN(value)
|
|
@@ -1191,14 +1178,16 @@ end
|
|
|
1191
1178
|
|
|
1192
1179
|
____radixChars = "0123456789abcdefghijklmnopqrstuvwxyz"
|
|
1193
1180
|
function __TS__NumberToString(self, radix)
|
|
1194
|
-
if radix == nil or radix == 10 or self == math.huge or self == -math.huge or self ~= self then
|
|
1181
|
+
if ((((radix == nil) or (radix == 10)) or (self == math.huge)) or (self == -math.huge)) or (self ~= self) then
|
|
1195
1182
|
return tostring(self)
|
|
1196
1183
|
end
|
|
1197
1184
|
radix = math.floor(radix)
|
|
1198
|
-
if radix < 2 or radix > 36 then
|
|
1185
|
+
if (radix < 2) or (radix > 36) then
|
|
1199
1186
|
error("toString() radix argument must be between 2 and 36", 0)
|
|
1200
1187
|
end
|
|
1201
|
-
local integer, fraction = math.modf(
|
|
1188
|
+
local integer, fraction = math.modf(
|
|
1189
|
+
math.abs(self)
|
|
1190
|
+
)
|
|
1202
1191
|
local result = ""
|
|
1203
1192
|
if radix == 8 then
|
|
1204
1193
|
result = string.format("%o", integer)
|
|
@@ -1232,15 +1221,9 @@ function __TS__NumberToString(self, radix)
|
|
|
1232
1221
|
end
|
|
1233
1222
|
|
|
1234
1223
|
function __TS__ObjectDefineProperty(target, key, desc)
|
|
1235
|
-
local
|
|
1236
|
-
if type(key) == "number" then
|
|
1237
|
-
____temp_0 = key + 1
|
|
1238
|
-
else
|
|
1239
|
-
____temp_0 = key
|
|
1240
|
-
end
|
|
1241
|
-
local luaKey = ____temp_0
|
|
1224
|
+
local luaKey = (((type(key) == "number") and (function() return key + 1 end)) or (function() return key end))()
|
|
1242
1225
|
local value = rawget(target, luaKey)
|
|
1243
|
-
local hasGetterOrSetter = desc.get ~= nil or desc.set ~= nil
|
|
1226
|
+
local hasGetterOrSetter = (desc.get ~= nil) or (desc.set ~= nil)
|
|
1244
1227
|
local descriptor
|
|
1245
1228
|
if hasGetterOrSetter then
|
|
1246
1229
|
if value ~= nil then
|
|
@@ -1252,39 +1235,13 @@ function __TS__ObjectDefineProperty(target, key, desc)
|
|
|
1252
1235
|
descriptor = desc
|
|
1253
1236
|
else
|
|
1254
1237
|
local valueExists = value ~= nil
|
|
1255
|
-
local ____desc_set_5 = desc.set
|
|
1256
|
-
local ____desc_get_6 = desc.get
|
|
1257
|
-
local ____temp_1
|
|
1258
|
-
if desc.configurable ~= nil then
|
|
1259
|
-
____temp_1 = desc.configurable
|
|
1260
|
-
else
|
|
1261
|
-
____temp_1 = valueExists
|
|
1262
|
-
end
|
|
1263
|
-
local ____temp_2
|
|
1264
|
-
if desc.enumerable ~= nil then
|
|
1265
|
-
____temp_2 = desc.enumerable
|
|
1266
|
-
else
|
|
1267
|
-
____temp_2 = valueExists
|
|
1268
|
-
end
|
|
1269
|
-
local ____temp_3
|
|
1270
|
-
if desc.writable ~= nil then
|
|
1271
|
-
____temp_3 = desc.writable
|
|
1272
|
-
else
|
|
1273
|
-
____temp_3 = valueExists
|
|
1274
|
-
end
|
|
1275
|
-
local ____temp_4
|
|
1276
|
-
if desc.value ~= nil then
|
|
1277
|
-
____temp_4 = desc.value
|
|
1278
|
-
else
|
|
1279
|
-
____temp_4 = value
|
|
1280
|
-
end
|
|
1281
1238
|
descriptor = {
|
|
1282
|
-
set =
|
|
1283
|
-
get =
|
|
1284
|
-
configurable =
|
|
1285
|
-
enumerable =
|
|
1286
|
-
writable =
|
|
1287
|
-
value =
|
|
1239
|
+
set = desc.set,
|
|
1240
|
+
get = desc.get,
|
|
1241
|
+
configurable = (((desc.configurable ~= nil) and (function() return desc.configurable end)) or (function() return valueExists end))(),
|
|
1242
|
+
enumerable = (((desc.enumerable ~= nil) and (function() return desc.enumerable end)) or (function() return valueExists end))(),
|
|
1243
|
+
writable = (((desc.writable ~= nil) and (function() return desc.writable end)) or (function() return valueExists end))(),
|
|
1244
|
+
value = (((desc.value ~= nil) and (function() return desc.value end)) or (function() return value end))()
|
|
1288
1245
|
}
|
|
1289
1246
|
end
|
|
1290
1247
|
__TS__SetDescriptor(target, luaKey, descriptor)
|
|
@@ -1346,19 +1303,41 @@ function __TS__ObjectValues(obj)
|
|
|
1346
1303
|
return result
|
|
1347
1304
|
end
|
|
1348
1305
|
|
|
1306
|
+
function __TS__OptionalChainAccess(____table, key)
|
|
1307
|
+
if ____table then
|
|
1308
|
+
return ____table[key]
|
|
1309
|
+
end
|
|
1310
|
+
return nil
|
|
1311
|
+
end
|
|
1312
|
+
|
|
1313
|
+
function __TS__OptionalFunctionCall(f, ...)
|
|
1314
|
+
if f then
|
|
1315
|
+
return f(...)
|
|
1316
|
+
end
|
|
1317
|
+
return nil
|
|
1318
|
+
end
|
|
1319
|
+
|
|
1320
|
+
function __TS__OptionalMethodCall(____table, methodName, isMethodOptional, ...)
|
|
1321
|
+
if ____table then
|
|
1322
|
+
local method = ____table[methodName]
|
|
1323
|
+
if method then
|
|
1324
|
+
return method(____table, ...)
|
|
1325
|
+
elseif not isMethodOptional then
|
|
1326
|
+
error(methodName .. " is not a function", 0)
|
|
1327
|
+
end
|
|
1328
|
+
end
|
|
1329
|
+
return nil
|
|
1330
|
+
end
|
|
1331
|
+
|
|
1349
1332
|
function __TS__ParseFloat(numberString)
|
|
1350
1333
|
local infinityMatch = string.match(numberString, "^%s*(-?Infinity)")
|
|
1351
1334
|
if infinityMatch then
|
|
1352
|
-
|
|
1353
|
-
if __TS__StringAccess(infinityMatch, 0) == "-" then
|
|
1354
|
-
____temp_0 = -math.huge
|
|
1355
|
-
else
|
|
1356
|
-
____temp_0 = math.huge
|
|
1357
|
-
end
|
|
1358
|
-
return ____temp_0
|
|
1335
|
+
return (((__TS__StringAccess(infinityMatch, 0) == "-") and (function() return -math.huge end)) or (function() return math.huge end))()
|
|
1359
1336
|
end
|
|
1360
|
-
local number = tonumber(
|
|
1361
|
-
|
|
1337
|
+
local number = tonumber(
|
|
1338
|
+
string.match(numberString, "^%s*(-?%d+%.?%d*)")
|
|
1339
|
+
)
|
|
1340
|
+
return number or (0 / 0)
|
|
1362
1341
|
end
|
|
1363
1342
|
|
|
1364
1343
|
function __TS__StringSubstr(self, from, length)
|
|
@@ -1366,7 +1345,7 @@ function __TS__StringSubstr(self, from, length)
|
|
|
1366
1345
|
from = 0
|
|
1367
1346
|
end
|
|
1368
1347
|
if length ~= nil then
|
|
1369
|
-
if length ~= length or length <= 0 then
|
|
1348
|
+
if (length ~= length) or (length <= 0) then
|
|
1370
1349
|
return ""
|
|
1371
1350
|
end
|
|
1372
1351
|
length = length + from
|
|
@@ -1381,7 +1360,7 @@ function __TS__StringSubstring(self, start, ____end)
|
|
|
1381
1360
|
if ____end ~= ____end then
|
|
1382
1361
|
____end = 0
|
|
1383
1362
|
end
|
|
1384
|
-
if ____end ~= nil and start > ____end then
|
|
1363
|
+
if (____end ~= nil) and (start > ____end) then
|
|
1385
1364
|
start, ____end = ____end, start
|
|
1386
1365
|
end
|
|
1387
1366
|
if start >= 0 then
|
|
@@ -1389,7 +1368,7 @@ function __TS__StringSubstring(self, start, ____end)
|
|
|
1389
1368
|
else
|
|
1390
1369
|
start = 1
|
|
1391
1370
|
end
|
|
1392
|
-
if ____end ~= nil and ____end < 0 then
|
|
1371
|
+
if (____end ~= nil) and (____end < 0) then
|
|
1393
1372
|
____end = 0
|
|
1394
1373
|
end
|
|
1395
1374
|
return string.sub(self, start, ____end)
|
|
@@ -1402,25 +1381,13 @@ function __TS__ParseInt(numberString, base)
|
|
|
1402
1381
|
local hexMatch = string.match(numberString, "^%s*-?0[xX]")
|
|
1403
1382
|
if hexMatch then
|
|
1404
1383
|
base = 16
|
|
1405
|
-
|
|
1406
|
-
if string.match(hexMatch, "-") then
|
|
1407
|
-
____string_match_result__0_0 = "-" .. __TS__StringSubstr(numberString, #hexMatch)
|
|
1408
|
-
else
|
|
1409
|
-
____string_match_result__0_0 = __TS__StringSubstr(numberString, #hexMatch)
|
|
1410
|
-
end
|
|
1411
|
-
numberString = ____string_match_result__0_0
|
|
1384
|
+
numberString = ((string.match(hexMatch, "-") and (function() return "-" .. __TS__StringSubstr(numberString, #hexMatch) end)) or (function() return __TS__StringSubstr(numberString, #hexMatch) end))()
|
|
1412
1385
|
end
|
|
1413
1386
|
end
|
|
1414
|
-
if base < 2 or base > 36 then
|
|
1387
|
+
if (base < 2) or (base > 36) then
|
|
1415
1388
|
return 0 / 0
|
|
1416
1389
|
end
|
|
1417
|
-
local
|
|
1418
|
-
if base <= 10 then
|
|
1419
|
-
____temp_1 = __TS__StringSubstring(__TS__parseInt_base_pattern, 0, base)
|
|
1420
|
-
else
|
|
1421
|
-
____temp_1 = __TS__StringSubstr(__TS__parseInt_base_pattern, 0, 10 + 2 * (base - 10))
|
|
1422
|
-
end
|
|
1423
|
-
local allowedDigits = ____temp_1
|
|
1390
|
+
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))()
|
|
1424
1391
|
local pattern = ("^%s*(-?[" .. allowedDigits) .. "]*)"
|
|
1425
1392
|
local number = tonumber(
|
|
1426
1393
|
string.match(numberString, pattern),
|
|
@@ -1469,13 +1436,15 @@ function __TS__Promise.prototype.____constructor(self, executor)
|
|
|
1469
1436
|
local function ____catch(e)
|
|
1470
1437
|
self:reject(e)
|
|
1471
1438
|
end
|
|
1472
|
-
local ____try, ____hasReturned = pcall(
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1439
|
+
local ____try, ____hasReturned = pcall(
|
|
1440
|
+
function()
|
|
1441
|
+
executor(
|
|
1442
|
+
_G,
|
|
1443
|
+
__TS__FunctionBind(self.resolve, self),
|
|
1444
|
+
__TS__FunctionBind(self.reject, self)
|
|
1445
|
+
)
|
|
1446
|
+
end
|
|
1447
|
+
)
|
|
1479
1448
|
if not ____try then
|
|
1480
1449
|
____hasReturned, ____returnValue = ____catch(____hasReturned)
|
|
1481
1450
|
end
|
|
@@ -1502,10 +1471,10 @@ function __TS__Promise.reject(reason)
|
|
|
1502
1471
|
return promise
|
|
1503
1472
|
end
|
|
1504
1473
|
__TS__Promise.prototype["then"] = function(self, onFulfilled, onRejected)
|
|
1505
|
-
local
|
|
1506
|
-
local promise =
|
|
1507
|
-
local resolve =
|
|
1508
|
-
local reject =
|
|
1474
|
+
local ____ = __TS__PromiseDeferred(_G)
|
|
1475
|
+
local promise = ____.promise
|
|
1476
|
+
local resolve = ____.resolve
|
|
1477
|
+
local reject = ____.reject
|
|
1509
1478
|
local isFulfilled = self.state == __TS__PromiseState.Fulfilled
|
|
1510
1479
|
local isRejected = self.state == __TS__PromiseState.Rejected
|
|
1511
1480
|
if onFulfilled then
|
|
@@ -1577,13 +1546,15 @@ function __TS__Promise.prototype.createPromiseResolvingCallback(self, f, resolve
|
|
|
1577
1546
|
local function ____catch(e)
|
|
1578
1547
|
reject(_G, e)
|
|
1579
1548
|
end
|
|
1580
|
-
local ____try, ____hasReturned = pcall(
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1549
|
+
local ____try, ____hasReturned = pcall(
|
|
1550
|
+
function()
|
|
1551
|
+
self:handleCallbackData(
|
|
1552
|
+
f(_G, value),
|
|
1553
|
+
resolve,
|
|
1554
|
+
reject
|
|
1555
|
+
)
|
|
1556
|
+
end
|
|
1557
|
+
)
|
|
1587
1558
|
if not ____try then
|
|
1588
1559
|
____hasReturned, ____returnValue = ____catch(____hasReturned)
|
|
1589
1560
|
end
|
|
@@ -1770,239 +1741,226 @@ function __TS__PromiseRace(iterable)
|
|
|
1770
1741
|
)
|
|
1771
1742
|
end
|
|
1772
1743
|
|
|
1773
|
-
Set =
|
|
1774
|
-
Set
|
|
1775
|
-
|
|
1776
|
-
self
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1744
|
+
Set = (function()
|
|
1745
|
+
local Set = __TS__Class()
|
|
1746
|
+
Set.name = "Set"
|
|
1747
|
+
function Set.prototype.____constructor(self, values)
|
|
1748
|
+
self[Symbol.toStringTag] = "Set"
|
|
1749
|
+
self.size = 0
|
|
1750
|
+
self.nextKey = {}
|
|
1751
|
+
self.previousKey = {}
|
|
1752
|
+
if values == nil then
|
|
1753
|
+
return
|
|
1754
|
+
end
|
|
1755
|
+
local iterable = values
|
|
1756
|
+
if iterable[Symbol.iterator] then
|
|
1757
|
+
local iterator = iterable[Symbol.iterator](iterable)
|
|
1758
|
+
while true do
|
|
1759
|
+
local result = iterator:next()
|
|
1760
|
+
if result.done then
|
|
1761
|
+
break
|
|
1762
|
+
end
|
|
1763
|
+
self:add(result.value)
|
|
1764
|
+
end
|
|
1765
|
+
else
|
|
1766
|
+
local array = values
|
|
1767
|
+
for ____, value in ipairs(array) do
|
|
1768
|
+
self:add(value)
|
|
1769
|
+
end
|
|
1770
|
+
end
|
|
1782
1771
|
end
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1772
|
+
function Set.prototype.add(self, value)
|
|
1773
|
+
local isNewValue = not self:has(value)
|
|
1774
|
+
if isNewValue then
|
|
1775
|
+
self.size = self.size + 1
|
|
1776
|
+
end
|
|
1777
|
+
if self.firstKey == nil then
|
|
1778
|
+
self.firstKey = value
|
|
1779
|
+
self.lastKey = value
|
|
1780
|
+
elseif isNewValue then
|
|
1781
|
+
self.nextKey[self.lastKey] = value
|
|
1782
|
+
self.previousKey[value] = self.lastKey
|
|
1783
|
+
self.lastKey = value
|
|
1784
|
+
end
|
|
1785
|
+
return self
|
|
1786
|
+
end
|
|
1787
|
+
function Set.prototype.clear(self)
|
|
1788
|
+
self.nextKey = {}
|
|
1789
|
+
self.previousKey = {}
|
|
1790
|
+
self.firstKey = nil
|
|
1791
|
+
self.lastKey = nil
|
|
1792
|
+
self.size = 0
|
|
1793
|
+
end
|
|
1794
|
+
function Set.prototype.delete(self, value)
|
|
1795
|
+
local contains = self:has(value)
|
|
1796
|
+
if contains then
|
|
1797
|
+
self.size = self.size - 1
|
|
1798
|
+
local next = self.nextKey[value]
|
|
1799
|
+
local previous = self.previousKey[value]
|
|
1800
|
+
if next and previous then
|
|
1801
|
+
self.nextKey[previous] = next
|
|
1802
|
+
self.previousKey[next] = previous
|
|
1803
|
+
elseif next then
|
|
1804
|
+
self.firstKey = next
|
|
1805
|
+
self.previousKey[next] = nil
|
|
1806
|
+
elseif previous then
|
|
1807
|
+
self.lastKey = previous
|
|
1808
|
+
self.nextKey[previous] = nil
|
|
1809
|
+
else
|
|
1810
|
+
self.firstKey = nil
|
|
1811
|
+
self.lastKey = nil
|
|
1790
1812
|
end
|
|
1791
|
-
self
|
|
1813
|
+
self.nextKey[value] = nil
|
|
1814
|
+
self.previousKey[value] = nil
|
|
1792
1815
|
end
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1816
|
+
return contains
|
|
1817
|
+
end
|
|
1818
|
+
function Set.prototype.forEach(self, callback)
|
|
1819
|
+
for ____, key in __TS__Iterator(
|
|
1820
|
+
self:keys()
|
|
1821
|
+
) do
|
|
1822
|
+
callback(_G, key, key, self)
|
|
1797
1823
|
end
|
|
1798
1824
|
end
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
local isNewValue = not self:has(value)
|
|
1802
|
-
if isNewValue then
|
|
1803
|
-
self.size = self.size + 1
|
|
1825
|
+
function Set.prototype.has(self, value)
|
|
1826
|
+
return (self.nextKey[value] ~= nil) or (self.lastKey == value)
|
|
1804
1827
|
end
|
|
1805
|
-
|
|
1806
|
-
self
|
|
1807
|
-
self.lastKey = value
|
|
1808
|
-
elseif isNewValue then
|
|
1809
|
-
self.nextKey[self.lastKey] = value
|
|
1810
|
-
self.previousKey[value] = self.lastKey
|
|
1811
|
-
self.lastKey = value
|
|
1828
|
+
Set.prototype[Symbol.iterator] = function(self)
|
|
1829
|
+
return self:values()
|
|
1812
1830
|
end
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1831
|
+
function Set.prototype.entries(self)
|
|
1832
|
+
local nextKey = self.nextKey
|
|
1833
|
+
local key = self.firstKey
|
|
1834
|
+
return {
|
|
1835
|
+
[Symbol.iterator] = function(self)
|
|
1836
|
+
return self
|
|
1837
|
+
end,
|
|
1838
|
+
next = function(self)
|
|
1839
|
+
local result = {done = not key, value = {key, key}}
|
|
1840
|
+
key = nextKey[key]
|
|
1841
|
+
return result
|
|
1842
|
+
end
|
|
1843
|
+
}
|
|
1844
|
+
end
|
|
1845
|
+
function Set.prototype.keys(self)
|
|
1846
|
+
local nextKey = self.nextKey
|
|
1847
|
+
local key = self.firstKey
|
|
1848
|
+
return {
|
|
1849
|
+
[Symbol.iterator] = function(self)
|
|
1850
|
+
return self
|
|
1851
|
+
end,
|
|
1852
|
+
next = function(self)
|
|
1853
|
+
local result = {done = not key, value = key}
|
|
1854
|
+
key = nextKey[key]
|
|
1855
|
+
return result
|
|
1856
|
+
end
|
|
1857
|
+
}
|
|
1858
|
+
end
|
|
1859
|
+
function Set.prototype.values(self)
|
|
1860
|
+
local nextKey = self.nextKey
|
|
1861
|
+
local key = self.firstKey
|
|
1862
|
+
return {
|
|
1863
|
+
[Symbol.iterator] = function(self)
|
|
1864
|
+
return self
|
|
1865
|
+
end,
|
|
1866
|
+
next = function(self)
|
|
1867
|
+
local result = {done = not key, value = key}
|
|
1868
|
+
key = nextKey[key]
|
|
1869
|
+
return result
|
|
1870
|
+
end
|
|
1871
|
+
}
|
|
1872
|
+
end
|
|
1873
|
+
Set[Symbol.species] = Set
|
|
1874
|
+
return Set
|
|
1875
|
+
end)()
|
|
1876
|
+
|
|
1877
|
+
WeakMap = (function()
|
|
1878
|
+
local WeakMap = __TS__Class()
|
|
1879
|
+
WeakMap.name = "WeakMap"
|
|
1880
|
+
function WeakMap.prototype.____constructor(self, entries)
|
|
1881
|
+
self[Symbol.toStringTag] = "WeakMap"
|
|
1882
|
+
self.items = {}
|
|
1883
|
+
setmetatable(self.items, {__mode = "k"})
|
|
1884
|
+
if entries == nil then
|
|
1885
|
+
return
|
|
1886
|
+
end
|
|
1887
|
+
local iterable = entries
|
|
1888
|
+
if iterable[Symbol.iterator] then
|
|
1889
|
+
local iterator = iterable[Symbol.iterator](iterable)
|
|
1890
|
+
while true do
|
|
1891
|
+
local result = iterator:next()
|
|
1892
|
+
if result.done then
|
|
1893
|
+
break
|
|
1894
|
+
end
|
|
1895
|
+
local value = result.value
|
|
1896
|
+
self.items[value[1]] = value[2]
|
|
1897
|
+
end
|
|
1837
1898
|
else
|
|
1838
|
-
|
|
1839
|
-
|
|
1899
|
+
for ____, kvp in ipairs(entries) do
|
|
1900
|
+
self.items[kvp[1]] = kvp[2]
|
|
1901
|
+
end
|
|
1840
1902
|
end
|
|
1841
|
-
self.nextKey[value] = nil
|
|
1842
|
-
self.previousKey[value] = nil
|
|
1843
1903
|
end
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
callback(_G, key, key, self)
|
|
1904
|
+
function WeakMap.prototype.delete(self, key)
|
|
1905
|
+
local contains = self:has(key)
|
|
1906
|
+
self.items[key] = nil
|
|
1907
|
+
return contains
|
|
1849
1908
|
end
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
return self.nextKey[value] ~= nil or self.lastKey == value
|
|
1853
|
-
end
|
|
1854
|
-
Set.prototype[Symbol.iterator] = function(self)
|
|
1855
|
-
return self:values()
|
|
1856
|
-
end
|
|
1857
|
-
function Set.prototype.entries(self)
|
|
1858
|
-
local nextKey = self.nextKey
|
|
1859
|
-
local key = self.firstKey
|
|
1860
|
-
return {
|
|
1861
|
-
[Symbol.iterator] = function(self)
|
|
1862
|
-
return self
|
|
1863
|
-
end,
|
|
1864
|
-
next = function(self)
|
|
1865
|
-
local result = {done = not key, value = {key, key}}
|
|
1866
|
-
key = nextKey[key]
|
|
1867
|
-
return result
|
|
1868
|
-
end
|
|
1869
|
-
}
|
|
1870
|
-
end
|
|
1871
|
-
function Set.prototype.keys(self)
|
|
1872
|
-
local nextKey = self.nextKey
|
|
1873
|
-
local key = self.firstKey
|
|
1874
|
-
return {
|
|
1875
|
-
[Symbol.iterator] = function(self)
|
|
1876
|
-
return self
|
|
1877
|
-
end,
|
|
1878
|
-
next = function(self)
|
|
1879
|
-
local result = {done = not key, value = key}
|
|
1880
|
-
key = nextKey[key]
|
|
1881
|
-
return result
|
|
1882
|
-
end
|
|
1883
|
-
}
|
|
1884
|
-
end
|
|
1885
|
-
function Set.prototype.values(self)
|
|
1886
|
-
local nextKey = self.nextKey
|
|
1887
|
-
local key = self.firstKey
|
|
1888
|
-
return {
|
|
1889
|
-
[Symbol.iterator] = function(self)
|
|
1890
|
-
return self
|
|
1891
|
-
end,
|
|
1892
|
-
next = function(self)
|
|
1893
|
-
local result = {done = not key, value = key}
|
|
1894
|
-
key = nextKey[key]
|
|
1895
|
-
return result
|
|
1896
|
-
end
|
|
1897
|
-
}
|
|
1898
|
-
end
|
|
1899
|
-
Set[Symbol.species] = Set
|
|
1900
|
-
Set = Set
|
|
1901
|
-
|
|
1902
|
-
function __TS__SparseArrayNew(...)
|
|
1903
|
-
local sparseArray = {...}
|
|
1904
|
-
sparseArray.sparseLength = select("#", ...)
|
|
1905
|
-
return sparseArray
|
|
1906
|
-
end
|
|
1907
|
-
|
|
1908
|
-
function __TS__SparseArrayPush(sparseArray, ...)
|
|
1909
|
-
local args = {...}
|
|
1910
|
-
local argsLen = select("#", ...)
|
|
1911
|
-
local listLen = sparseArray.sparseLength
|
|
1912
|
-
for i = 1, argsLen do
|
|
1913
|
-
sparseArray[listLen + i] = args[i]
|
|
1909
|
+
function WeakMap.prototype.get(self, key)
|
|
1910
|
+
return self.items[key]
|
|
1914
1911
|
end
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
function __TS__SparseArraySpread(sparseArray)
|
|
1919
|
-
local _unpack = unpack or table.unpack
|
|
1920
|
-
return _unpack(sparseArray, 1, sparseArray.sparseLength)
|
|
1921
|
-
end
|
|
1922
|
-
|
|
1923
|
-
WeakMap = __TS__Class()
|
|
1924
|
-
WeakMap.name = "WeakMap"
|
|
1925
|
-
function WeakMap.prototype.____constructor(self, entries)
|
|
1926
|
-
self[Symbol.toStringTag] = "WeakMap"
|
|
1927
|
-
self.items = {}
|
|
1928
|
-
setmetatable(self.items, {__mode = "k"})
|
|
1929
|
-
if entries == nil then
|
|
1930
|
-
return
|
|
1912
|
+
function WeakMap.prototype.has(self, key)
|
|
1913
|
+
return self.items[key] ~= nil
|
|
1931
1914
|
end
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1915
|
+
function WeakMap.prototype.set(self, key, value)
|
|
1916
|
+
self.items[key] = value
|
|
1917
|
+
return self
|
|
1918
|
+
end
|
|
1919
|
+
WeakMap[Symbol.species] = WeakMap
|
|
1920
|
+
return WeakMap
|
|
1921
|
+
end)()
|
|
1922
|
+
|
|
1923
|
+
WeakSet = (function()
|
|
1924
|
+
local WeakSet = __TS__Class()
|
|
1925
|
+
WeakSet.name = "WeakSet"
|
|
1926
|
+
function WeakSet.prototype.____constructor(self, values)
|
|
1927
|
+
self[Symbol.toStringTag] = "WeakSet"
|
|
1928
|
+
self.items = {}
|
|
1929
|
+
setmetatable(self.items, {__mode = "k"})
|
|
1930
|
+
if values == nil then
|
|
1931
|
+
return
|
|
1932
|
+
end
|
|
1933
|
+
local iterable = values
|
|
1934
|
+
if iterable[Symbol.iterator] then
|
|
1935
|
+
local iterator = iterable[Symbol.iterator](iterable)
|
|
1936
|
+
while true do
|
|
1937
|
+
local result = iterator:next()
|
|
1938
|
+
if result.done then
|
|
1939
|
+
break
|
|
1940
|
+
end
|
|
1941
|
+
self.items[result.value] = true
|
|
1942
|
+
end
|
|
1943
|
+
else
|
|
1944
|
+
for ____, value in ipairs(values) do
|
|
1945
|
+
self.items[value] = true
|
|
1939
1946
|
end
|
|
1940
|
-
local value = result.value
|
|
1941
|
-
self.items[value[1]] = value[2]
|
|
1942
|
-
end
|
|
1943
|
-
else
|
|
1944
|
-
for ____, kvp in ipairs(entries) do
|
|
1945
|
-
self.items[kvp[1]] = kvp[2]
|
|
1946
1947
|
end
|
|
1947
1948
|
end
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
self.items[key] = nil
|
|
1952
|
-
return contains
|
|
1953
|
-
end
|
|
1954
|
-
function WeakMap.prototype.get(self, key)
|
|
1955
|
-
return self.items[key]
|
|
1956
|
-
end
|
|
1957
|
-
function WeakMap.prototype.has(self, key)
|
|
1958
|
-
return self.items[key] ~= nil
|
|
1959
|
-
end
|
|
1960
|
-
function WeakMap.prototype.set(self, key, value)
|
|
1961
|
-
self.items[key] = value
|
|
1962
|
-
return self
|
|
1963
|
-
end
|
|
1964
|
-
WeakMap[Symbol.species] = WeakMap
|
|
1965
|
-
WeakMap = WeakMap
|
|
1966
|
-
|
|
1967
|
-
WeakSet = __TS__Class()
|
|
1968
|
-
WeakSet.name = "WeakSet"
|
|
1969
|
-
function WeakSet.prototype.____constructor(self, values)
|
|
1970
|
-
self[Symbol.toStringTag] = "WeakSet"
|
|
1971
|
-
self.items = {}
|
|
1972
|
-
setmetatable(self.items, {__mode = "k"})
|
|
1973
|
-
if values == nil then
|
|
1974
|
-
return
|
|
1949
|
+
function WeakSet.prototype.add(self, value)
|
|
1950
|
+
self.items[value] = true
|
|
1951
|
+
return self
|
|
1975
1952
|
end
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
local result = iterator:next()
|
|
1981
|
-
if result.done then
|
|
1982
|
-
break
|
|
1983
|
-
end
|
|
1984
|
-
self.items[result.value] = true
|
|
1985
|
-
end
|
|
1986
|
-
else
|
|
1987
|
-
for ____, value in ipairs(values) do
|
|
1988
|
-
self.items[value] = true
|
|
1989
|
-
end
|
|
1953
|
+
function WeakSet.prototype.delete(self, value)
|
|
1954
|
+
local contains = self:has(value)
|
|
1955
|
+
self.items[value] = nil
|
|
1956
|
+
return contains
|
|
1990
1957
|
end
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
local contains = self:has(value)
|
|
1998
|
-
self.items[value] = nil
|
|
1999
|
-
return contains
|
|
2000
|
-
end
|
|
2001
|
-
function WeakSet.prototype.has(self, value)
|
|
2002
|
-
return self.items[value] == true
|
|
2003
|
-
end
|
|
2004
|
-
WeakSet[Symbol.species] = WeakSet
|
|
2005
|
-
WeakSet = WeakSet
|
|
1958
|
+
function WeakSet.prototype.has(self, value)
|
|
1959
|
+
return self.items[value] == true
|
|
1960
|
+
end
|
|
1961
|
+
WeakSet[Symbol.species] = WeakSet
|
|
1962
|
+
return WeakSet
|
|
1963
|
+
end)()
|
|
2006
1964
|
|
|
2007
1965
|
function __TS__SourceMapTraceBack(fileName, sourceMap)
|
|
2008
1966
|
_G.__TS__sourcemap = _G.__TS__sourcemap or ({})
|
|
@@ -2011,7 +1969,7 @@ function __TS__SourceMapTraceBack(fileName, sourceMap)
|
|
|
2011
1969
|
_G.__TS__originalTraceback = debug.traceback
|
|
2012
1970
|
debug.traceback = function(thread, message, level)
|
|
2013
1971
|
local trace
|
|
2014
|
-
if thread == nil and message == nil and level == nil then
|
|
1972
|
+
if ((thread == nil) and (message == nil)) and (level == nil) then
|
|
2015
1973
|
trace = _G.__TS__originalTraceback()
|
|
2016
1974
|
else
|
|
2017
1975
|
trace = _G.__TS__originalTraceback(thread, message, level)
|
|
@@ -2080,7 +2038,7 @@ function __TS__StringCharCodeAt(self, index)
|
|
|
2080
2038
|
if index < 0 then
|
|
2081
2039
|
return 0 / 0
|
|
2082
2040
|
end
|
|
2083
|
-
return string.byte(self, index + 1) or 0 / 0
|
|
2041
|
+
return string.byte(self, index + 1) or (0 / 0)
|
|
2084
2042
|
end
|
|
2085
2043
|
|
|
2086
2044
|
function __TS__StringConcat(str1, ...)
|
|
@@ -2093,10 +2051,10 @@ function __TS__StringConcat(str1, ...)
|
|
|
2093
2051
|
end
|
|
2094
2052
|
|
|
2095
2053
|
function __TS__StringEndsWith(self, searchString, endPosition)
|
|
2096
|
-
if endPosition == nil or endPosition > #self then
|
|
2054
|
+
if (endPosition == nil) or (endPosition > #self) then
|
|
2097
2055
|
endPosition = #self
|
|
2098
2056
|
end
|
|
2099
|
-
return string.sub(self, endPosition - #searchString + 1, endPosition) == searchString
|
|
2057
|
+
return string.sub(self, (endPosition - #searchString) + 1, endPosition) == searchString
|
|
2100
2058
|
end
|
|
2101
2059
|
|
|
2102
2060
|
function __TS__StringIncludes(self, searchString, position)
|
|
@@ -2116,10 +2074,10 @@ function __TS__StringPadEnd(self, maxLength, fillString)
|
|
|
2116
2074
|
if maxLength ~= maxLength then
|
|
2117
2075
|
maxLength = 0
|
|
2118
2076
|
end
|
|
2119
|
-
if maxLength == -math.huge or maxLength == math.huge then
|
|
2077
|
+
if (maxLength == -math.huge) or (maxLength == math.huge) then
|
|
2120
2078
|
error("Invalid string length", 0)
|
|
2121
2079
|
end
|
|
2122
|
-
if #self >= maxLength or #fillString == 0 then
|
|
2080
|
+
if (#self >= maxLength) or (#fillString == 0) then
|
|
2123
2081
|
return self
|
|
2124
2082
|
end
|
|
2125
2083
|
maxLength = maxLength - #self
|
|
@@ -2143,10 +2101,10 @@ function __TS__StringPadStart(self, maxLength, fillString)
|
|
|
2143
2101
|
if maxLength ~= maxLength then
|
|
2144
2102
|
maxLength = 0
|
|
2145
2103
|
end
|
|
2146
|
-
if maxLength == -math.huge or maxLength == math.huge then
|
|
2104
|
+
if (maxLength == -math.huge) or (maxLength == math.huge) then
|
|
2147
2105
|
error("Invalid string length", 0)
|
|
2148
2106
|
end
|
|
2149
|
-
if #self >= maxLength or #fillString == 0 then
|
|
2107
|
+
if (#self >= maxLength) or (#fillString == 0) then
|
|
2150
2108
|
return self
|
|
2151
2109
|
end
|
|
2152
2110
|
maxLength = maxLength - #self
|
|
@@ -2170,13 +2128,7 @@ function __TS__StringReplace(source, searchValue, replaceValue)
|
|
|
2170
2128
|
end
|
|
2171
2129
|
local sub = string.sub
|
|
2172
2130
|
local before = sub(source, 1, startPos - 1)
|
|
2173
|
-
local
|
|
2174
|
-
if type(replaceValue) == "string" then
|
|
2175
|
-
____temp_0 = replaceValue
|
|
2176
|
-
else
|
|
2177
|
-
____temp_0 = replaceValue(_G, searchValue, startPos - 1, source)
|
|
2178
|
-
end
|
|
2179
|
-
local replacement = ____temp_0
|
|
2131
|
+
local replacement = (((type(replaceValue) == "string") and (function() return replaceValue end)) or (function() return replaceValue(_G, searchValue, startPos - 1, source) end))()
|
|
2180
2132
|
local after = sub(source, endPos + 1)
|
|
2181
2133
|
return (before .. replacement) .. after
|
|
2182
2134
|
end
|
|
@@ -2218,7 +2170,7 @@ function __TS__StringReplaceAll(source, searchValue, replaceValue)
|
|
|
2218
2170
|
end
|
|
2219
2171
|
|
|
2220
2172
|
function __TS__StringSlice(self, start, ____end)
|
|
2221
|
-
if start == nil or start ~= start then
|
|
2173
|
+
if (start == nil) or (start ~= start) then
|
|
2222
2174
|
start = 0
|
|
2223
2175
|
end
|
|
2224
2176
|
if ____end ~= ____end then
|
|
@@ -2227,7 +2179,7 @@ function __TS__StringSlice(self, start, ____end)
|
|
|
2227
2179
|
if start >= 0 then
|
|
2228
2180
|
start = start + 1
|
|
2229
2181
|
end
|
|
2230
|
-
if ____end ~= nil and ____end < 0 then
|
|
2182
|
+
if (____end ~= nil) and (____end < 0) then
|
|
2231
2183
|
____end = ____end - 1
|
|
2232
2184
|
end
|
|
2233
2185
|
return string.sub(self, start, ____end)
|
|
@@ -2243,8 +2195,8 @@ function __TS__StringSplit(source, separator, limit)
|
|
|
2243
2195
|
local out = {}
|
|
2244
2196
|
local index = 0
|
|
2245
2197
|
local count = 0
|
|
2246
|
-
if separator == nil or separator == "" then
|
|
2247
|
-
while index < #source - 1 and count < limit do
|
|
2198
|
+
if (separator == nil) or (separator == "") then
|
|
2199
|
+
while (index < (#source - 1)) and (count < limit) do
|
|
2248
2200
|
out[count + 1] = __TS__StringAccess(source, index)
|
|
2249
2201
|
count = count + 1
|
|
2250
2202
|
index = index + 1
|
|
@@ -2252,7 +2204,7 @@ function __TS__StringSplit(source, separator, limit)
|
|
|
2252
2204
|
else
|
|
2253
2205
|
local separatorLength = #separator
|
|
2254
2206
|
local nextIndex = (string.find(source, separator, nil, true) or 0) - 1
|
|
2255
|
-
while nextIndex >= 0 and count < limit do
|
|
2207
|
+
while (nextIndex >= 0) and (count < limit) do
|
|
2256
2208
|
out[count + 1] = __TS__StringSubstring(source, index, nextIndex)
|
|
2257
2209
|
count = count + 1
|
|
2258
2210
|
index = nextIndex + separatorLength
|
|
@@ -2271,7 +2223,7 @@ function __TS__StringSplit(source, separator, limit)
|
|
|
2271
2223
|
end
|
|
2272
2224
|
|
|
2273
2225
|
function __TS__StringStartsWith(self, searchString, position)
|
|
2274
|
-
if position == nil or position < 0 then
|
|
2226
|
+
if (position == nil) or (position < 0) then
|
|
2275
2227
|
position = 0
|
|
2276
2228
|
end
|
|
2277
2229
|
return string.sub(self, position + 1, #searchString + position) == searchString
|