aboutsummaryrefslogtreecommitdiff
path: root/spec/outputs/destructure.lua
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2022-11-21 16:56:43 +0800
committerLi Jin <dragon-fly@qq.com>2022-11-21 16:56:43 +0800
commit58cf1a70971ad37ef9260aa93851e92fd6e4c1ce (patch)
treefbf8e3ae38b7b230122aac32e5461c5570dc88bf /spec/outputs/destructure.lua
parent8abf668c0b031c0aa81f186745eaf154aa036c8a (diff)
downloadyuescript-58cf1a70971ad37ef9260aa93851e92fd6e4c1ce.tar.gz
yuescript-58cf1a70971ad37ef9260aa93851e92fd6e4c1ce.tar.bz2
yuescript-58cf1a70971ad37ef9260aa93851e92fd6e4c1ce.zip
fix table pattern matching. confirm fixing issue #116.
Diffstat (limited to 'spec/outputs/destructure.lua')
-rw-r--r--spec/outputs/destructure.lua33
1 files changed, 22 insertions, 11 deletions
diff --git a/spec/outputs/destructure.lua b/spec/outputs/destructure.lua
index f40a658..8953a2a 100644
--- a/spec/outputs/destructure.lua
+++ b/spec/outputs/destructure.lua
@@ -472,7 +472,8 @@ do
472 end 472 end
473 do 473 do
474 local _exp_0 = tb 474 local _exp_0 = tb
475 local _tab_0 = "table" == type(_exp_0) 475 local _tab_0 = type(_exp_0)
476 _tab_0 = "table" == _tab_0 or "userdata" == _tab_0
476 if _tab_0 then 477 if _tab_0 then
477 local name, meta_field 478 local name, meta_field
478 do 479 do
@@ -531,14 +532,17 @@ do
531 end 532 end
532 do 533 do
533 local _exp_0 = tb 534 local _exp_0 = tb
534 local _tab_0 = "table" == type(_exp_0) 535 local _tab_0 = type(_exp_0)
536 _tab_0 = "table" == _tab_0 or "userdata" == _tab_0
535 if _tab_0 then 537 if _tab_0 then
536 do 538 do
537 local _obj_0 = _exp_0.a 539 local _obj_0 = _exp_0.a
538 if _obj_0 ~= nil then 540 local _type_0 = type(_obj_0)
541 if "table" == _type_0 or "userdata" == _type_0 then
539 do 542 do
540 local _obj_1 = getmetatable(_obj_0) 543 local _obj_1 = getmetatable(_obj_0)
541 if _obj_1 ~= nil then 544 local _type_1 = type(_obj_1)
545 if "table" == _type_1 or "userdata" == _type_1 then
542 add = _obj_1.__add 546 add = _obj_1.__add
543 end 547 end
544 end 548 end
@@ -546,10 +550,12 @@ do
546 end 550 end
547 do 551 do
548 local _obj_0 = _exp_0.b 552 local _obj_0 = _exp_0.b
549 if _obj_0 ~= nil then 553 local _type_0 = type(_obj_0)
554 if "table" == _type_0 or "userdata" == _type_0 then
550 do 555 do
551 local _obj_1 = getmetatable(_obj_0) 556 local _obj_1 = getmetatable(_obj_0)
552 if _obj_1 ~= nil then 557 local _type_1 = type(_obj_1)
558 if "table" == _type_1 or "userdata" == _type_1 then
553 field = _obj_1[fieldName] 559 field = _obj_1[fieldName]
554 end 560 end
555 end 561 end
@@ -566,15 +572,18 @@ do
566 end 572 end
567 do 573 do
568 local _exp_0 = tb 574 local _exp_0 = tb
569 local _tab_0 = "table" == type(_exp_0) 575 local _tab_0 = type(_exp_0)
576 _tab_0 = "table" == _tab_0 or "userdata" == _tab_0
570 if _tab_0 then 577 if _tab_0 then
571 local _obj_0 = _exp_0 578 local _obj_0 = _exp_0
572 do 579 do
573 local _obj_1 = _obj_0.c 580 local _obj_1 = _obj_0.c
574 if _obj_1 ~= nil then 581 local _type_0 = type(_obj_1)
582 if "table" == _type_0 or "userdata" == _type_0 then
575 do 583 do
576 local _obj_2 = getmetatable(_obj_1) 584 local _obj_2 = getmetatable(_obj_1)
577 if _obj_2 ~= nil then 585 local _type_1 = type(_obj_2)
586 if "table" == _type_1 or "userdata" == _type_1 then
578 meta_field = _obj_2["abc"] 587 meta_field = _obj_2["abc"]
579 end 588 end
580 end 589 end
@@ -587,13 +596,15 @@ do
587 local _obj_1 = getmetatable(_obj_0) 596 local _obj_1 = getmetatable(_obj_0)
588 do 597 do
589 local _obj_2 = _obj_1[ [[any string]]] 598 local _obj_2 = _obj_1[ [[any string]]]
590 if _obj_2 ~= nil then 599 local _type_0 = type(_obj_2)
600 if "table" == _type_0 or "userdata" == _type_0 then
591 abc = _obj_2.d 601 abc = _obj_2.d
592 end 602 end
593 end 603 end
594 do 604 do
595 local _obj_2 = _obj_1['str'] 605 local _obj_2 = _obj_1['str']
596 if _obj_2 ~= nil then 606 local _type_0 = type(_obj_2)
607 if "table" == _type_0 or "userdata" == _type_0 then
597 def = _obj_2.e 608 def = _obj_2.e
598 end 609 end
599 end 610 end