diff options
author | Li Jin <dragon-fly@qq.com> | 2023-05-17 15:11:09 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2023-05-17 15:11:09 +0800 |
commit | 4bd1513262a61071b07f5efe2a3cb9356ce6c8c2 (patch) | |
tree | aaaf73884315aeb436f7bb4020e9bd9c20344c90 | |
parent | 0c589d36fadba92d547fc6a93a2d5494d4d51981 (diff) | |
download | yuescript-0.16.5.tar.gz yuescript-0.16.5.tar.bz2 yuescript-0.16.5.zip |
fix spec.v0.16.5
-rw-r--r-- | spec/inputs/existential.yue | 2 | ||||
-rw-r--r-- | spec/inputs/metatable.yue | 16 | ||||
-rw-r--r-- | spec/outputs/existential.lua | 2 | ||||
-rw-r--r-- | spec/outputs/metatable.lua | 35 |
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 | ||
52 | tb?.<a>? 123 | 52 | tb?.<call>? 123 |
53 | 53 | ||
54 | with? tb.<>?.<index> | 54 | with? 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 | |||
37 | mt = a.<> | 37 | mt = a.<> |
38 | 38 | ||
39 | tb\func #list | 39 | tb\func #list |
40 | tb\<func>list | 40 | tb\<"func">list |
41 | tb\<func> list | 41 | tb\<"func"> list |
42 | 42 | ||
43 | import "module" as :<index>, <newindex>:setFunc | 43 | import "module" as :<index>, <newindex>:setFunc |
44 | 44 | ||
45 | with tb | 45 | with 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 | ||
72 | do | 72 | do |
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 | ||
78 | do | 78 | do |
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 | |||
76 | getmetatable(a).__index = tb | 76 | getmetatable(a).__index = tb |
77 | local mt = getmetatable(a) | 77 | local mt = getmetatable(a) |
78 | tb:func(#list) | 78 | tb:func(#list) |
79 | getmetatable(tb):__func(list) | 79 | do |
80 | getmetatable(tb):__func(list) | 80 | local _obj_0 = getmetatable(tb) |
81 | _obj_0["func"](_obj_0, list) | ||
82 | end | ||
83 | do | ||
84 | local _obj_0 = getmetatable(tb) | ||
85 | _obj_0["func"](_obj_0, list) | ||
86 | end | ||
81 | local index, setFunc | 87 | local index, setFunc |
82 | do | 88 | do |
83 | local _obj_0 = getmetatable(require("module")) | 89 | local _obj_0 = getmetatable(require("module")) |
@@ -86,7 +92,10 @@ end | |||
86 | do | 92 | do |
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)) |
92 | end | 101 | end |
@@ -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, ...) |
133 | end | 142 | end |
134 | do | 143 | do |
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, ...) | ||
139 | end | 158 | end |
140 | do | 159 | do |
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 |