diff options
Diffstat (limited to '')
| -rw-r--r-- | spec/outputs/class.lua | 134 |
1 files changed, 100 insertions, 34 deletions
diff --git a/spec/outputs/class.lua b/spec/outputs/class.lua index 929c243..8db5a8a 100644 --- a/spec/outputs/class.lua +++ b/spec/outputs/class.lua | |||
| @@ -9,7 +9,9 @@ do | |||
| 9 | return "hello world" | 9 | return "hello world" |
| 10 | end | 10 | end |
| 11 | } | 11 | } |
| 12 | _base_0.__index = _base_0 | 12 | if _base_0.__index == nil then |
| 13 | _base_0.__index = _base_0 | ||
| 14 | end | ||
| 13 | _class_0 = setmetatable({ | 15 | _class_0 = setmetatable({ |
| 14 | __init = function(self, test, world) | 16 | __init = function(self, test, world) |
| 15 | self.test = test | 17 | self.test = test |
| @@ -40,7 +42,9 @@ do | |||
| 40 | return print("cool") | 42 | return print("cool") |
| 41 | end | 43 | end |
| 42 | } | 44 | } |
| 43 | _base_0.__index = _base_0 | 45 | if _base_0.__index == nil then |
| 46 | _base_0.__index = _base_0 | ||
| 47 | end | ||
| 44 | _class_0 = setmetatable({ | 48 | _class_0 = setmetatable({ |
| 45 | __init = function() end, | 49 | __init = function() end, |
| 46 | __base = _base_0, | 50 | __base = _base_0, |
| @@ -61,7 +65,9 @@ do | |||
| 61 | local _class_0 | 65 | local _class_0 |
| 62 | local _parent_0 = Simple | 66 | local _parent_0 = Simple |
| 63 | local _base_0 = { } | 67 | local _base_0 = { } |
| 64 | _base_0.__index = _base_0 | 68 | if _base_0.__index == nil then |
| 69 | _base_0.__index = _base_0 | ||
| 70 | end | ||
| 65 | setmetatable(_base_0, _parent_0.__base) | 71 | setmetatable(_base_0, _parent_0.__base) |
| 66 | _class_0 = setmetatable({ | 72 | _class_0 = setmetatable({ |
| 67 | __init = function(self) | 73 | __init = function(self) |
| @@ -104,7 +110,9 @@ do | |||
| 104 | return print("num", num) | 110 | return print("num", num) |
| 105 | end | 111 | end |
| 106 | } | 112 | } |
| 107 | _base_0.__index = _base_0 | 113 | if _base_0.__index == nil then |
| 114 | _base_0.__index = _base_0 | ||
| 115 | end | ||
| 108 | _class_0 = setmetatable({ | 116 | _class_0 = setmetatable({ |
| 109 | __init = function(self, arg) | 117 | __init = function(self, arg) |
| 110 | return print("init arg", arg) | 118 | return print("init arg", arg) |
| @@ -130,7 +138,9 @@ do | |||
| 130 | return _class_0.__parent.__base.cool(self, 120302) | 138 | return _class_0.__parent.__base.cool(self, 120302) |
| 131 | end | 139 | end |
| 132 | } | 140 | } |
| 133 | _base_0.__index = _base_0 | 141 | if _base_0.__index == nil then |
| 142 | _base_0.__index = _base_0 | ||
| 143 | end | ||
| 134 | setmetatable(_base_0, _parent_0.__base) | 144 | setmetatable(_base_0, _parent_0.__base) |
| 135 | _class_0 = setmetatable({ | 145 | _class_0 = setmetatable({ |
| 136 | __init = function(self) | 146 | __init = function(self) |
| @@ -172,7 +182,9 @@ do | |||
| 172 | local _base_0 = { | 182 | local _base_0 = { |
| 173 | something = 20323 | 183 | something = 20323 |
| 174 | } | 184 | } |
| 175 | _base_0.__index = _base_0 | 185 | if _base_0.__index == nil then |
| 186 | _base_0.__index = _base_0 | ||
| 187 | end | ||
| 176 | _class_0 = setmetatable({ | 188 | _class_0 = setmetatable({ |
| 177 | __init = function() end, | 189 | __init = function() end, |
| 178 | __base = _base_0, | 190 | __base = _base_0, |
| @@ -199,7 +211,9 @@ do | |||
| 199 | return assert(_class_0.__parent == Okay) | 211 | return assert(_class_0.__parent == Okay) |
| 200 | end | 212 | end |
| 201 | } | 213 | } |
| 202 | _base_0.__index = _base_0 | 214 | if _base_0.__index == nil then |
| 215 | _base_0.__index = _base_0 | ||
| 216 | end | ||
| 203 | setmetatable(_base_0, _parent_0.__base) | 217 | setmetatable(_base_0, _parent_0.__base) |
| 204 | _class_0 = setmetatable({ | 218 | _class_0 = setmetatable({ |
| 205 | __init = function(self, ...) | 219 | __init = function(self, ...) |
| @@ -240,7 +254,9 @@ do | |||
| 240 | return _class_0.__parent.something(self, 1, 2, 3, 4) | 254 | return _class_0.__parent.something(self, 1, 2, 3, 4) |
| 241 | end | 255 | end |
| 242 | } | 256 | } |
| 243 | _base_0.__index = _base_0 | 257 | if _base_0.__index == nil then |
| 258 | _base_0.__index = _base_0 | ||
| 259 | end | ||
| 244 | _class_0 = setmetatable({ | 260 | _class_0 = setmetatable({ |
| 245 | __init = function() end, | 261 | __init = function() end, |
| 246 | __base = _base_0, | 262 | __base = _base_0, |
| @@ -264,7 +280,9 @@ do | |||
| 264 | return print("val:", self.val) | 280 | return print("val:", self.val) |
| 265 | end | 281 | end |
| 266 | } | 282 | } |
| 267 | _base_0.__index = _base_0 | 283 | if _base_0.__index == nil then |
| 284 | _base_0.__index = _base_0 | ||
| 285 | end | ||
| 268 | _class_0 = setmetatable({ | 286 | _class_0 = setmetatable({ |
| 269 | __init = function() end, | 287 | __init = function() end, |
| 270 | __base = _base_0, | 288 | __base = _base_0, |
| @@ -293,7 +311,9 @@ do | |||
| 293 | end | 311 | end |
| 294 | end | 312 | end |
| 295 | } | 313 | } |
| 296 | _base_0.__index = _base_0 | 314 | if _base_0.__index == nil then |
| 315 | _base_0.__index = _base_0 | ||
| 316 | end | ||
| 297 | setmetatable(_base_0, _parent_0.__base) | 317 | setmetatable(_base_0, _parent_0.__base) |
| 298 | _class_0 = setmetatable({ | 318 | _class_0 = setmetatable({ |
| 299 | __init = function(self, ...) | 319 | __init = function(self, ...) |
| @@ -353,7 +373,9 @@ do | |||
| 353 | return nil | 373 | return nil |
| 354 | end | 374 | end |
| 355 | } | 375 | } |
| 356 | _base_0.__index = _base_0 | 376 | if _base_0.__index == nil then |
| 377 | _base_0.__index = _base_0 | ||
| 378 | end | ||
| 357 | _class_0 = setmetatable({ | 379 | _class_0 = setmetatable({ |
| 358 | __init = function() end, | 380 | __init = function() end, |
| 359 | __base = _base_0, | 381 | __base = _base_0, |
| @@ -386,7 +408,9 @@ do | |||
| 386 | blue = function(self) end, | 408 | blue = function(self) end, |
| 387 | green = function(self) end | 409 | green = function(self) end |
| 388 | } | 410 | } |
| 389 | _base_0.__index = _base_0 | 411 | if _base_0.__index == nil then |
| 412 | _base_0.__index = _base_0 | ||
| 413 | end | ||
| 390 | _class_0 = setmetatable({ | 414 | _class_0 = setmetatable({ |
| 391 | __init = function() end, | 415 | __init = function() end, |
| 392 | __base = _base_0, | 416 | __base = _base_0, |
| @@ -420,7 +444,9 @@ do | |||
| 420 | local _class_0 | 444 | local _class_0 |
| 421 | local hello | 445 | local hello |
| 422 | local _base_0 = { } | 446 | local _base_0 = { } |
| 423 | _base_0.__index = _base_0 | 447 | if _base_0.__index == nil then |
| 448 | _base_0.__index = _base_0 | ||
| 449 | end | ||
| 424 | _class_0 = setmetatable({ | 450 | _class_0 = setmetatable({ |
| 425 | __init = function() end, | 451 | __init = function() end, |
| 426 | __base = _base_0, | 452 | __base = _base_0, |
| @@ -453,7 +479,9 @@ yyy = function() | |||
| 453 | do | 479 | do |
| 454 | local _class_0 | 480 | local _class_0 |
| 455 | local _base_0 = { } | 481 | local _base_0 = { } |
| 456 | _base_0.__index = _base_0 | 482 | if _base_0.__index == nil then |
| 483 | _base_0.__index = _base_0 | ||
| 484 | end | ||
| 457 | _class_0 = setmetatable({ | 485 | _class_0 = setmetatable({ |
| 458 | __init = function() end, | 486 | __init = function() end, |
| 459 | __base = _base_0, | 487 | __base = _base_0, |
| @@ -476,7 +504,9 @@ end | |||
| 476 | do | 504 | do |
| 477 | local _class_0 | 505 | local _class_0 |
| 478 | local _base_0 = { } | 506 | local _base_0 = { } |
| 479 | _base_0.__index = _base_0 | 507 | if _base_0.__index == nil then |
| 508 | _base_0.__index = _base_0 | ||
| 509 | end | ||
| 480 | _class_0 = setmetatable({ | 510 | _class_0 = setmetatable({ |
| 481 | __init = function() end, | 511 | __init = function() end, |
| 482 | __base = _base_0, | 512 | __base = _base_0, |
| @@ -497,7 +527,9 @@ end | |||
| 497 | do | 527 | do |
| 498 | local _class_0 | 528 | local _class_0 |
| 499 | local _base_0 = { } | 529 | local _base_0 = { } |
| 500 | _base_0.__index = _base_0 | 530 | if _base_0.__index == nil then |
| 531 | _base_0.__index = _base_0 | ||
| 532 | end | ||
| 501 | _class_0 = setmetatable({ | 533 | _class_0 = setmetatable({ |
| 502 | __init = function() end, | 534 | __init = function() end, |
| 503 | __base = _base_0, | 535 | __base = _base_0, |
| @@ -519,7 +551,9 @@ do | |||
| 519 | local _class_0 | 551 | local _class_0 |
| 520 | local _parent_0 = Hello.World | 552 | local _parent_0 = Hello.World |
| 521 | local _base_0 = { } | 553 | local _base_0 = { } |
| 522 | _base_0.__index = _base_0 | 554 | if _base_0.__index == nil then |
| 555 | _base_0.__index = _base_0 | ||
| 556 | end | ||
| 523 | setmetatable(_base_0, _parent_0.__base) | 557 | setmetatable(_base_0, _parent_0.__base) |
| 524 | _class_0 = setmetatable({ | 558 | _class_0 = setmetatable({ |
| 525 | __init = function(self, ...) | 559 | __init = function(self, ...) |
| @@ -560,7 +594,9 @@ local a | |||
| 560 | do | 594 | do |
| 561 | local _class_0 | 595 | local _class_0 |
| 562 | local _base_0 = { } | 596 | local _base_0 = { } |
| 563 | _base_0.__index = _base_0 | 597 | if _base_0.__index == nil then |
| 598 | _base_0.__index = _base_0 | ||
| 599 | end | ||
| 564 | _class_0 = setmetatable({ | 600 | _class_0 = setmetatable({ |
| 565 | __init = function() end, | 601 | __init = function() end, |
| 566 | __base = _base_0, | 602 | __base = _base_0, |
| @@ -581,7 +617,9 @@ local Something | |||
| 581 | do | 617 | do |
| 582 | local _class_0 | 618 | local _class_0 |
| 583 | local _base_0 = { } | 619 | local _base_0 = { } |
| 584 | _base_0.__index = _base_0 | 620 | if _base_0.__index == nil then |
| 621 | _base_0.__index = _base_0 | ||
| 622 | end | ||
| 585 | _class_0 = setmetatable({ | 623 | _class_0 = setmetatable({ |
| 586 | __init = function() end, | 624 | __init = function() end, |
| 587 | __base = _base_0, | 625 | __base = _base_0, |
| @@ -603,7 +641,9 @@ do | |||
| 603 | local _class_0 | 641 | local _class_0 |
| 604 | local _parent_0 = Hello | 642 | local _parent_0 = Hello |
| 605 | local _base_0 = { } | 643 | local _base_0 = { } |
| 606 | _base_0.__index = _base_0 | 644 | if _base_0.__index == nil then |
| 645 | _base_0.__index = _base_0 | ||
| 646 | end | ||
| 607 | setmetatable(_base_0, _parent_0.__base) | 647 | setmetatable(_base_0, _parent_0.__base) |
| 608 | _class_0 = setmetatable({ | 648 | _class_0 = setmetatable({ |
| 609 | __init = function(self, ...) | 649 | __init = function(self, ...) |
| @@ -642,7 +682,9 @@ do | |||
| 642 | local _class_0 | 682 | local _class_0 |
| 643 | local _parent_0 = World | 683 | local _parent_0 = World |
| 644 | local _base_0 = { } | 684 | local _base_0 = { } |
| 645 | _base_0.__index = _base_0 | 685 | if _base_0.__index == nil then |
| 686 | _base_0.__index = _base_0 | ||
| 687 | end | ||
| 646 | setmetatable(_base_0, _parent_0.__base) | 688 | setmetatable(_base_0, _parent_0.__base) |
| 647 | _class_0 = setmetatable({ | 689 | _class_0 = setmetatable({ |
| 648 | __init = function(self, ...) | 690 | __init = function(self, ...) |
| @@ -680,7 +722,9 @@ print(((function() | |||
| 680 | do | 722 | do |
| 681 | local _class_0 | 723 | local _class_0 |
| 682 | local _base_0 = { } | 724 | local _base_0 = { } |
| 683 | _base_0.__index = _base_0 | 725 | if _base_0.__index == nil then |
| 726 | _base_0.__index = _base_0 | ||
| 727 | end | ||
| 684 | _class_0 = setmetatable({ | 728 | _class_0 = setmetatable({ |
| 685 | __init = function() end, | 729 | __init = function() end, |
| 686 | __base = _base_0, | 730 | __base = _base_0, |
| @@ -701,7 +745,9 @@ end)()).__name) | |||
| 701 | do | 745 | do |
| 702 | local _class_0 | 746 | local _class_0 |
| 703 | local _base_0 = { } | 747 | local _base_0 = { } |
| 704 | _base_0.__index = _base_0 | 748 | if _base_0.__index == nil then |
| 749 | _base_0.__index = _base_0 | ||
| 750 | end | ||
| 705 | _class_0 = setmetatable({ | 751 | _class_0 = setmetatable({ |
| 706 | __init = function() end, | 752 | __init = function() end, |
| 707 | __base = _base_0, | 753 | __base = _base_0, |
| @@ -723,7 +769,9 @@ do | |||
| 723 | local _class_0 | 769 | local _class_0 |
| 724 | local val, insert | 770 | local val, insert |
| 725 | local _base_0 = { } | 771 | local _base_0 = { } |
| 726 | _base_0.__index = _base_0 | 772 | if _base_0.__index == nil then |
| 773 | _base_0.__index = _base_0 | ||
| 774 | end | ||
| 727 | _class_0 = setmetatable({ | 775 | _class_0 = setmetatable({ |
| 728 | __init = function(self) | 776 | __init = function(self) |
| 729 | return print(insert, val) | 777 | return print(insert, val) |
| @@ -747,7 +795,9 @@ end | |||
| 747 | do | 795 | do |
| 748 | local _class_0 | 796 | local _class_0 |
| 749 | local _base_0 = { } | 797 | local _base_0 = { } |
| 750 | _base_0.__index = _base_0 | 798 | if _base_0.__index == nil then |
| 799 | _base_0.__index = _base_0 | ||
| 800 | end | ||
| 751 | _class_0 = setmetatable({ | 801 | _class_0 = setmetatable({ |
| 752 | __init = hi, | 802 | __init = hi, |
| 753 | __base = _base_0, | 803 | __base = _base_0, |
| @@ -778,7 +828,9 @@ do | |||
| 778 | } | 828 | } |
| 779 | end | 829 | end |
| 780 | } | 830 | } |
| 781 | _base_0.__index = _base_0 | 831 | if _base_0.__index == nil then |
| 832 | _base_0.__index = _base_0 | ||
| 833 | end | ||
| 782 | setmetatable(_base_0, _parent_0.__base) | 834 | setmetatable(_base_0, _parent_0.__base) |
| 783 | _class_0 = setmetatable({ | 835 | _class_0 = setmetatable({ |
| 784 | __init = function(self, ...) | 836 | __init = function(self, ...) |
| @@ -819,7 +871,9 @@ do | |||
| 819 | return _class_0.__parent.__base.dang(self) | 871 | return _class_0.__parent.__base.dang(self) |
| 820 | end) | 872 | end) |
| 821 | } | 873 | } |
| 822 | _base_0.__index = _base_0 | 874 | if _base_0.__index == nil then |
| 875 | _base_0.__index = _base_0 | ||
| 876 | end | ||
| 823 | setmetatable(_base_0, _parent_0.__base) | 877 | setmetatable(_base_0, _parent_0.__base) |
| 824 | _class_0 = setmetatable({ | 878 | _class_0 = setmetatable({ |
| 825 | __init = function(self, ...) | 879 | __init = function(self, ...) |
| @@ -856,7 +910,9 @@ do | |||
| 856 | local _class_0 | 910 | local _class_0 |
| 857 | local _parent_0 = Thing | 911 | local _parent_0 = Thing |
| 858 | local _base_0 = { } | 912 | local _base_0 = { } |
| 859 | _base_0.__index = _base_0 | 913 | if _base_0.__index == nil then |
| 914 | _base_0.__index = _base_0 | ||
| 915 | end | ||
| 860 | setmetatable(_base_0, _parent_0.__base) | 916 | setmetatable(_base_0, _parent_0.__base) |
| 861 | _class_0 = setmetatable({ | 917 | _class_0 = setmetatable({ |
| 862 | __init = function(self, ...) | 918 | __init = function(self, ...) |
| @@ -921,7 +977,9 @@ do | |||
| 921 | return self.__class["if"] and self.__class["do"](self.__class) | 977 | return self.__class["if"] and self.__class["do"](self.__class) |
| 922 | end | 978 | end |
| 923 | } | 979 | } |
| 924 | _base_0.__index = _base_0 | 980 | if _base_0.__index == nil then |
| 981 | _base_0.__index = _base_0 | ||
| 982 | end | ||
| 925 | _class_0 = setmetatable({ | 983 | _class_0 = setmetatable({ |
| 926 | __init = function(self) | 984 | __init = function(self) |
| 927 | self.__class["if"] = true | 985 | self.__class["if"] = true |
| @@ -958,7 +1016,9 @@ do | |||
| 958 | return self["if"] and self["do"](self) | 1016 | return self["if"] and self["do"](self) |
| 959 | end | 1017 | end |
| 960 | } | 1018 | } |
| 961 | _base_0.__index = _base_0 | 1019 | if _base_0.__index == nil then |
| 1020 | _base_0.__index = _base_0 | ||
| 1021 | end | ||
| 962 | _class_0 = setmetatable({ | 1022 | _class_0 = setmetatable({ |
| 963 | __init = function(self) | 1023 | __init = function(self) |
| 964 | self["if"] = true | 1024 | self["if"] = true |
| @@ -991,7 +1051,9 @@ do | |||
| 991 | } | 1051 | } |
| 992 | end | 1052 | end |
| 993 | } | 1053 | } |
| 994 | _base_0.__index = _base_0 | 1054 | if _base_0.__index == nil then |
| 1055 | _base_0.__index = _base_0 | ||
| 1056 | end | ||
| 995 | setmetatable(_base_0, _parent_0.__base) | 1057 | setmetatable(_base_0, _parent_0.__base) |
| 996 | _class_0 = setmetatable({ | 1058 | _class_0 = setmetatable({ |
| 997 | __init = function(self, ...) | 1059 | __init = function(self, ...) |
| @@ -1025,6 +1087,9 @@ end | |||
| 1025 | do | 1087 | do |
| 1026 | local _class_0 | 1088 | local _class_0 |
| 1027 | local _base_0 = { } | 1089 | local _base_0 = { } |
| 1090 | if _base_0.__index == nil then | ||
| 1091 | _base_0.__index = _base_0 | ||
| 1092 | end | ||
| 1028 | local _list_0 = { | 1093 | local _list_0 = { |
| 1029 | B, | 1094 | B, |
| 1030 | C, | 1095 | C, |
| @@ -1033,12 +1098,11 @@ do | |||
| 1033 | for _index_0 = 1, #_list_0 do | 1098 | for _index_0 = 1, #_list_0 do |
| 1034 | local _mixin_0 = _list_0[_index_0] | 1099 | local _mixin_0 = _list_0[_index_0] |
| 1035 | for _key_0, _val_0 in pairs(_mixin_0.__base) do | 1100 | for _key_0, _val_0 in pairs(_mixin_0.__base) do |
| 1036 | if not _key_0:match("^__") and _base_0[_key_0] == nil then | 1101 | if _key_0 ~= "__class" then |
| 1037 | _base_0[_key_0] = _val_0 | 1102 | _base_0[_key_0] = _val_0 |
| 1038 | end | 1103 | end |
| 1039 | end | 1104 | end |
| 1040 | end | 1105 | end |
| 1041 | _base_0.__index = _base_0 | ||
| 1042 | _class_0 = setmetatable({ | 1106 | _class_0 = setmetatable({ |
| 1043 | __init = function() end, | 1107 | __init = function() end, |
| 1044 | __base = _base_0, | 1108 | __base = _base_0, |
| @@ -1057,7 +1121,9 @@ end | |||
| 1057 | do | 1121 | do |
| 1058 | local _class_0 | 1122 | local _class_0 |
| 1059 | local _base_0 = { } | 1123 | local _base_0 = { } |
| 1060 | _base_0.__index = _base_0 | 1124 | if _base_0.__index == nil then |
| 1125 | _base_0.__index = _base_0 | ||
| 1126 | end | ||
| 1061 | _class_0 = setmetatable({ | 1127 | _class_0 = setmetatable({ |
| 1062 | __init = function() end, | 1128 | __init = function() end, |
| 1063 | __base = _base_0, | 1129 | __base = _base_0, |
