diff options
author | Li Jin <dragon-fly@qq.com> | 2022-11-11 17:19:24 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2022-11-11 17:19:24 +0800 |
commit | 60f8f00a022ac08701792b2897b72d8c99b50f52 (patch) | |
tree | 1f888c1c6b7907d22ffa842648b000fff989506f /spec/inputs | |
parent | 209fca096b0be5c47553f4c4a94d95de33b23d31 (diff) | |
download | yuescript-0.15.13.tar.gz yuescript-0.15.13.tar.bz2 yuescript-0.15.13.zip |
fix default value issue when doing metatable destructuring.v0.15.13
Diffstat (limited to 'spec/inputs')
-rw-r--r-- | spec/inputs/destructure.yue | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/inputs/destructure.yue b/spec/inputs/destructure.yue index 403923a..d161fd8 100644 --- a/spec/inputs/destructure.yue +++ b/spec/inputs/destructure.yue | |||
@@ -214,5 +214,15 @@ do | |||
214 | tb = {} | 214 | tb = {} |
215 | <[a + b]>: v1, [c!]: v2 = tb | 215 | <[a + b]>: v1, [c!]: v2 = tb |
216 | 216 | ||
217 | do | ||
218 | {a: {:<add> = addFunc}, b: {<[fieldName]>: field = 123}} = tb | ||
219 | {<"abc">: meta_field = "def", <[[any string]]>: abc = 123, <'str'>: def = {}} = tb | ||
220 | |||
221 | switch tb | ||
222 | when {a: {:<add> = addFunc}, b: {<[fieldName]>: field = 123}} | ||
223 | print add, field | ||
224 | switch tb | ||
225 | when {c: {<"abc">: meta_field = "def"}, <[[any string]]>: {d: abc = 123}, <'str'>: {e: def = {}}} | ||
226 | print meta_field, abc, def | ||
217 | nil | 227 | nil |
218 | 228 | ||