diff options
| author | Li Jin <dragon-fly@qq.com> | 2024-03-21 09:14:34 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2024-03-21 09:14:34 +0800 |
| commit | 4a3cc26c6dfd74e61c8b6480038d6a292ea86e47 (patch) | |
| tree | 9554b94cfc15e4acee0c2e60b63af16f1b828207 /spec/outputs/unicode/destructure.lua | |
| parent | 80b65520da432843f0c63431a1867bd2620bc4ac (diff) | |
| download | yuescript-4a3cc26c6dfd74e61c8b6480038d6a292ea86e47.tar.gz yuescript-4a3cc26c6dfd74e61c8b6480038d6a292ea86e47.tar.bz2 yuescript-4a3cc26c6dfd74e61c8b6480038d6a292ea86e47.zip | |
remove redundant 'do' blocks in code generation.
Diffstat (limited to 'spec/outputs/unicode/destructure.lua')
| -rw-r--r-- | spec/outputs/unicode/destructure.lua | 136 |
1 files changed, 62 insertions, 74 deletions
diff --git a/spec/outputs/unicode/destructure.lua b/spec/outputs/unicode/destructure.lua index 002c4b0..7263d49 100644 --- a/spec/outputs/unicode/destructure.lua +++ b/spec/outputs/unicode/destructure.lua | |||
| @@ -127,11 +127,9 @@ do | |||
| 127 | end | 127 | end |
| 128 | end | 128 | end |
| 129 | do | 129 | do |
| 130 | do | 130 | local _with_0 = _u4e1c_u897f |
| 131 | local _with_0 = _u4e1c_u897f | 131 | local _u5143_u7d20a, _u5143_u7d20b = _with_0[1], _with_0[2] |
| 132 | local _u5143_u7d20a, _u5143_u7d20b = _with_0[1], _with_0[2] | 132 | _u6253_u5370(_u5143_u7d20a, _u5143_u7d20b) |
| 133 | _u6253_u5370(_u5143_u7d20a, _u5143_u7d20b) | ||
| 134 | end | ||
| 135 | end | 133 | end |
| 136 | do | 134 | do |
| 137 | local _u4e1c_u897f = nil | 135 | local _u4e1c_u897f = nil |
| @@ -320,11 +318,9 @@ do | |||
| 320 | _tmp_0 = _obj_0["函数"] | 318 | _tmp_0 = _obj_0["函数"] |
| 321 | end | 319 | end |
| 322 | if _tmp_0 == nil then | 320 | if _tmp_0 == nil then |
| 323 | do | 321 | local _obj_0 = _u9879_u76ee |
| 324 | local _obj_0 = _u9879_u76ee | 322 | if _obj_0 ~= nil then |
| 325 | if _obj_0 ~= nil then | 323 | _tmp_0 = _obj_0["默认值"] |
| 326 | _tmp_0 = _obj_0["默认值"] | ||
| 327 | end | ||
| 328 | end | 324 | end |
| 329 | end | 325 | end |
| 330 | a_u5bf9_u8c61["b字段"](function() | 326 | a_u5bf9_u8c61["b字段"](function() |
| @@ -436,11 +432,9 @@ do | |||
| 436 | end | 432 | end |
| 437 | local _u53d8_u91cfy1, _u53d8_u91cfy4 | 433 | local _u53d8_u91cfy1, _u53d8_u91cfy4 |
| 438 | local _u5b57_u6bb5y2, _u5b57_u6bb5y3 | 434 | local _u5b57_u6bb5y2, _u5b57_u6bb5y3 |
| 439 | do | 435 | local _obj_0, _obj_1 = _u51fd_u65702() |
| 440 | local _obj_0, _obj_1 = _u51fd_u65702() | 436 | _u53d8_u91cfy1, _u53d8_u91cfy4 = _u51fd_u65701(), _obj_1 |
| 441 | _u53d8_u91cfy1, _u53d8_u91cfy4 = _u51fd_u65701(), _obj_1 | 437 | _u5b57_u6bb5y2, _u5b57_u6bb5y3 = _obj_0["字段y2"], _obj_0["字段y3"] |
| 442 | _u5b57_u6bb5y2, _u5b57_u6bb5y3 = _obj_0["字段y2"], _obj_0["字段y3"] | ||
| 443 | end | ||
| 444 | end | 438 | end |
| 445 | do | 439 | do |
| 446 | local _u53d8_u91cfv1, _u53d8_u91cfv2, _u53d8_u91cfv3, _u53d8_u91cfv4 | 440 | local _u53d8_u91cfv1, _u53d8_u91cfv2, _u53d8_u91cfv3, _u53d8_u91cfv4 |
| @@ -470,11 +464,9 @@ do | |||
| 470 | end | 464 | end |
| 471 | do | 465 | do |
| 472 | local _u503c, _u5143_u503c | 466 | local _u503c, _u5143_u503c |
| 473 | do | 467 | local _obj_0 = _u5bf9_u8c61tb |
| 474 | local _obj_0 = _u5bf9_u8c61tb | 468 | _u503c = _obj_0[_u540d_u79f0] |
| 475 | _u503c = _obj_0[_u540d_u79f0] | 469 | _u5143_u503c = getmetatable(_obj_0)[_u540d_u79f0] |
| 476 | _u5143_u503c = getmetatable(_obj_0)[_u540d_u79f0] | ||
| 477 | end | ||
| 478 | end | 470 | end |
| 479 | do | 471 | do |
| 480 | local tostring, add | 472 | local tostring, add |
| @@ -487,24 +479,22 @@ do | |||
| 487 | end) | 479 | end) |
| 488 | end | 480 | end |
| 489 | end | 481 | end |
| 490 | do | 482 | local _exp_0 = _u5bf9_u8c61tb |
| 491 | local _exp_0 = _u5bf9_u8c61tb | 483 | local _type_0 = type(_exp_0) |
| 492 | local _type_0 = type(_exp_0) | 484 | local _tab_0 = "table" == _type_0 or "userdata" == _type_0 |
| 493 | local _tab_0 = "table" == _type_0 or "userdata" == _type_0 | 485 | if _tab_0 then |
| 494 | if _tab_0 then | 486 | local name, _u5143_u5b57_u6bb5 |
| 495 | local name, _u5143_u5b57_u6bb5 | 487 | do |
| 496 | do | 488 | local _obj_0 = getmetatable(_exp_0) |
| 497 | local _obj_0 = getmetatable(_exp_0) | 489 | name = _obj_0.__name |
| 498 | name = _obj_0.__name | 490 | _u5143_u5b57_u6bb5 = _obj_0["123"] |
| 499 | _u5143_u5b57_u6bb5 = _obj_0["123"] | 491 | if name == nil then |
| 500 | if name == nil then | 492 | name = "项目" |
| 501 | name = "项目" | ||
| 502 | end | ||
| 503 | end | ||
| 504 | if _u5143_u5b57_u6bb5 ~= nil then | ||
| 505 | _u6253_u5370(name, _u5143_u5b57_u6bb5) | ||
| 506 | end | 493 | end |
| 507 | end | 494 | end |
| 495 | if _u5143_u5b57_u6bb5 ~= nil then | ||
| 496 | _u6253_u5370(name, _u5143_u5b57_u6bb5) | ||
| 497 | end | ||
| 508 | end | 498 | end |
| 509 | end | 499 | end |
| 510 | do | 500 | do |
| @@ -586,52 +576,50 @@ do | |||
| 586 | _u6253_u5370(add, _u5b57_u6bb5) | 576 | _u6253_u5370(add, _u5b57_u6bb5) |
| 587 | end | 577 | end |
| 588 | end | 578 | end |
| 589 | do | 579 | local _exp_0 = tb |
| 590 | local _exp_0 = tb | 580 | local _type_0 = type(_exp_0) |
| 591 | local _type_0 = type(_exp_0) | 581 | local _tab_0 = "table" == _type_0 or "userdata" == _type_0 |
| 592 | local _tab_0 = "table" == _type_0 or "userdata" == _type_0 | 582 | if _tab_0 then |
| 593 | if _tab_0 then | 583 | do |
| 594 | do | 584 | local _obj_0 = _exp_0["字段c"] |
| 595 | local _obj_0 = _exp_0["字段c"] | 585 | local _type_1 = type(_obj_0) |
| 596 | local _type_1 = type(_obj_0) | 586 | if "table" == _type_1 or "userdata" == _type_1 then |
| 597 | if "table" == _type_1 or "userdata" == _type_1 then | 587 | do |
| 598 | do | 588 | local _obj_1 = getmetatable(_obj_0) |
| 599 | local _obj_1 = getmetatable(_obj_0) | 589 | local _type_2 = type(_obj_1) |
| 600 | local _type_2 = type(_obj_1) | 590 | if "table" == _type_2 or "userdata" == _type_2 then |
| 601 | if "table" == _type_2 or "userdata" == _type_2 then | 591 | _u5143_u5b57_u6bb5 = _obj_1["字段abc"] |
| 602 | _u5143_u5b57_u6bb5 = _obj_1["字段abc"] | ||
| 603 | end | ||
| 604 | end | 592 | end |
| 605 | end | 593 | end |
| 606 | end | 594 | end |
| 607 | if _u5143_u5b57_u6bb5 == nil then | 595 | end |
| 608 | _u5143_u5b57_u6bb5 = "默认值" | 596 | if _u5143_u5b57_u6bb5 == nil then |
| 609 | end | 597 | _u5143_u5b57_u6bb5 = "默认值" |
| 598 | end | ||
| 599 | do | ||
| 600 | local _obj_0 = getmetatable(_exp_0) | ||
| 610 | do | 601 | do |
| 611 | local _obj_0 = getmetatable(_exp_0) | 602 | local _obj_1 = _obj_0[ [[any string]]] |
| 612 | do | 603 | local _type_1 = type(_obj_1) |
| 613 | local _obj_1 = _obj_0[ [[any string]]] | 604 | if "table" == _type_1 or "userdata" == _type_1 then |
| 614 | local _type_1 = type(_obj_1) | 605 | _u53d8_u91cfabc = _obj_1["字段d"] |
| 615 | if "table" == _type_1 or "userdata" == _type_1 then | ||
| 616 | _u53d8_u91cfabc = _obj_1["字段d"] | ||
| 617 | end | ||
| 618 | end | ||
| 619 | do | ||
| 620 | local _obj_1 = _obj_0['字符串'] | ||
| 621 | local _type_1 = type(_obj_1) | ||
| 622 | if "table" == _type_1 or "userdata" == _type_1 then | ||
| 623 | _u6709_u9ed8_u8ba4_u503c = _obj_1["字段e"] | ||
| 624 | end | ||
| 625 | end | ||
| 626 | if _u53d8_u91cfabc == nil then | ||
| 627 | _u53d8_u91cfabc = 123 | ||
| 628 | end | 606 | end |
| 629 | if _u6709_u9ed8_u8ba4_u503c == nil then | 607 | end |
| 630 | _u6709_u9ed8_u8ba4_u503c = { } | 608 | do |
| 609 | local _obj_1 = _obj_0['字符串'] | ||
| 610 | local _type_1 = type(_obj_1) | ||
| 611 | if "table" == _type_1 or "userdata" == _type_1 then | ||
| 612 | _u6709_u9ed8_u8ba4_u503c = _obj_1["字段e"] | ||
| 631 | end | 613 | end |
| 632 | end | 614 | end |
| 633 | _u6253_u5370(_u5143_u5b57_u6bb5, _u53d8_u91cfabc, _u6709_u9ed8_u8ba4_u503c) | 615 | if _u53d8_u91cfabc == nil then |
| 616 | _u53d8_u91cfabc = 123 | ||
| 617 | end | ||
| 618 | if _u6709_u9ed8_u8ba4_u503c == nil then | ||
| 619 | _u6709_u9ed8_u8ba4_u503c = { } | ||
| 620 | end | ||
| 634 | end | 621 | end |
| 622 | _u6253_u5370(_u5143_u5b57_u6bb5, _u53d8_u91cfabc, _u6709_u9ed8_u8ba4_u503c) | ||
| 635 | end | 623 | end |
| 636 | end | 624 | end |
| 637 | return nil | 625 | return nil |
