aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--spec/inputs/existential.yue2
-rw-r--r--spec/inputs/metatable.yue16
-rw-r--r--spec/outputs/existential.lua2
-rw-r--r--spec/outputs/metatable.lua35
4 files changed, 37 insertions, 18 deletions
diff --git a/spec/inputs/existential.yue b/spec/inputs/existential.yue
index e73b421..27891dc 100644
--- a/spec/inputs/existential.yue
+++ b/spec/inputs/existential.yue
@@ -49,7 +49,7 @@ with? io.open "test.txt", "w"
49 \write "hello" 49 \write "hello"
50 \close! 50 \close!
51 51
52tb?.<a>? 123 52tb?.<call>? 123
53 53
54with? tb.<>?.<index> 54with? tb.<>?.<index>
55 .a = 1 55 .a = 1
diff --git a/spec/inputs/metatable.yue b/spec/inputs/metatable.yue
index 61cc266..38b7ce5 100644
--- a/spec/inputs/metatable.yue
+++ b/spec/inputs/metatable.yue
@@ -37,14 +37,14 @@ a.<index> = tb
37mt = a.<> 37mt = a.<>
38 38
39tb\func #list 39tb\func #list
40tb\<func>list 40tb\<"func">list
41tb\<func> list 41tb\<"func"> list
42 42
43import "module" as :<index>, <newindex>:setFunc 43import "module" as :<index>, <newindex>:setFunc
44 44
45with tb 45with tb
46 print .<add>, .x\<index> "key" 46 print .<add>, .x\<index> "key"
47 a = .<index>.<add>\<new> 123 47 a = .<index>.<add>\<"new"> 123
48 b = t#.<close>.test 48 b = t#.<close>.test
49 c = t #.<close> .test 49 c = t #.<close> .test
50 50
@@ -70,13 +70,13 @@ do
70 return tb\<["value" .. tostring x > y]>(123, ...) 70 return tb\<["value" .. tostring x > y]>(123, ...)
71 71
72do 72do
73 f = tb\<value>(123, ...) 73 f = tb\<'value'>(123, ...)
74 f tb\<value>(123, ...) 74 f tb\<'value'>(123, ...)
75 tb\<value>(123, ...) 75 tb\<'value'>(123, ...)
76 return tb\<value> 123, ... 76 return tb\<'value'> 123, ...
77 77
78do 78do
79 f = tb.<value> 123, ... 79 f = tb.<["value"]> 123, ...
80 f = tb.<"value#{x < y}">(123, ...) 80 f = tb.<"value#{x < y}">(123, ...)
81 f tb.<'value'> 123, ... 81 f tb.<'value'> 123, ...
82 tb.<[[ value 82 tb.<[[ value
diff --git a/spec/outputs/existential.lua b/spec/outputs/existential.lua
index b241b3b..391f553 100644
--- a/spec/outputs/existential.lua
+++ b/spec/outputs/existential.lua
@@ -201,7 +201,7 @@ do
201 local _obj_0 = tb 201 local _obj_0 = tb
202 if _obj_0 ~= nil then 202 if _obj_0 ~= nil then
203 do 203 do
204 local _obj_1 = getmetatable(_obj_0).__a 204 local _obj_1 = getmetatable(_obj_0).__call
205 if _obj_1 ~= nil then 205 if _obj_1 ~= nil then
206 _obj_1(123) 206 _obj_1(123)
207 end 207 end
diff --git a/spec/outputs/metatable.lua b/spec/outputs/metatable.lua
index 907a584..9f95787 100644
--- a/spec/outputs/metatable.lua
+++ b/spec/outputs/metatable.lua
@@ -76,8 +76,14 @@ getmetatable(a).__index = tb
76getmetatable(a).__index = tb 76getmetatable(a).__index = tb
77local mt = getmetatable(a) 77local mt = getmetatable(a)
78tb:func(#list) 78tb:func(#list)
79getmetatable(tb):__func(list) 79do
80getmetatable(tb):__func(list) 80 local _obj_0 = getmetatable(tb)
81 _obj_0["func"](_obj_0, list)
82end
83do
84 local _obj_0 = getmetatable(tb)
85 _obj_0["func"](_obj_0, list)
86end
81local index, setFunc 87local index, setFunc
82do 88do
83 local _obj_0 = getmetatable(require("module")) 89 local _obj_0 = getmetatable(require("module"))
@@ -86,7 +92,10 @@ end
86do 92do
87 local _with_0 = tb 93 local _with_0 = tb
88 print(getmetatable(_with_0).__add, getmetatable(_with_0.x):__index("key")) 94 print(getmetatable(_with_0).__add, getmetatable(_with_0.x):__index("key"))
89 a = getmetatable(getmetatable(getmetatable(_with_0).__index).__add):__new(123) 95 do
96 local _obj_0 = getmetatable(getmetatable(getmetatable(_with_0).__index).__add)
97 a = _obj_0["new"](_obj_0, 123)
98 end
90 b = t(#getmetatable(_with_0).__close.test) 99 b = t(#getmetatable(_with_0).__close.test)
91 c = t(#getmetatable(_with_0).__close(_with_0.test)) 100 c = t(#getmetatable(_with_0).__close(_with_0.test))
92end 101end
@@ -132,13 +141,23 @@ do
132 return _obj_0["value" .. tostring(x > y)](_obj_0, 123, ...) 141 return _obj_0["value" .. tostring(x > y)](_obj_0, 123, ...)
133end 142end
134do 143do
135 f = getmetatable(tb):__value(123, ...) 144 do
136 f(getmetatable(tb):__value(123, ...)) 145 local _obj_0 = getmetatable(tb)
137 getmetatable(tb):__value(123, ...) 146 f = _obj_0['value'](_obj_0, 123, ...)
138 return getmetatable(tb):__value(123, ...) 147 end
148 f((function(...)
149 local _obj_0 = getmetatable(tb)
150 return _obj_0['value'](_obj_0, 123, ...)
151 end)(...))
152 do
153 local _obj_0 = getmetatable(tb)
154 _obj_0['value'](_obj_0, 123, ...)
155 end
156 local _obj_0 = getmetatable(tb)
157 return _obj_0['value'](_obj_0, 123, ...)
139end 158end
140do 159do
141 f = getmetatable(tb).__value(123, ...) 160 f = getmetatable(tb)["value"](123, ...)
142 f = getmetatable(tb)["value" .. tostring(x < y)](123, ...) 161 f = getmetatable(tb)["value" .. tostring(x < y)](123, ...)
143 f(getmetatable(tb)['value'](123, ...)) 162 f(getmetatable(tb)['value'](123, ...))
144 getmetatable(tb)[ [[ value 163 getmetatable(tb)[ [[ value