diff options
| author | Li Jin <dragon-fly@qq.com> | 2023-10-27 16:58:43 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2023-10-27 16:58:43 +0800 |
| commit | 7bfa002f3d4dcb62e6a301141be6d17889a94f55 (patch) | |
| tree | 927eab759af3e333b1f7d80c3724ec4b869c02e1 /spec/inputs | |
| parent | bafe9b44212316a51ee00f7af15e881c81d96fe6 (diff) | |
| download | yuescript-7bfa002f3d4dcb62e6a301141be6d17889a94f55.tar.gz yuescript-7bfa002f3d4dcb62e6a301141be6d17889a94f55.tar.bz2 yuescript-7bfa002f3d4dcb62e6a301141be6d17889a94f55.zip | |
fix a missing case for list destructuring.
Diffstat (limited to 'spec/inputs')
| -rw-r--r-- | spec/inputs/destructure.yue | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/inputs/destructure.yue b/spec/inputs/destructure.yue index d161fd8..73e4d33 100644 --- a/spec/inputs/destructure.yue +++ b/spec/inputs/destructure.yue | |||
| @@ -80,6 +80,8 @@ do | |||
| 80 | for {x,y} in *thing | 80 | for {x,y} in *thing |
| 81 | print x,y | 81 | print x,y |
| 82 | 82 | ||
| 83 | for [x,y] in *thing | ||
| 84 | print x,y | ||
| 83 | 85 | ||
| 84 | -- | 86 | -- |
| 85 | 87 | ||
| @@ -178,10 +180,16 @@ do | |||
| 178 | for {left = "null", right = false} in *tuples | 180 | for {left = "null", right = false} in *tuples |
| 179 | print left, right | 181 | print left, right |
| 180 | 182 | ||
| 183 | for [left = "null", right = false] in *tuples | ||
| 184 | print left, right | ||
| 185 | |||
| 181 | do | 186 | do |
| 182 | {_, a, _, b} = tb -- list placeholder | 187 | {_, a, _, b} = tb -- list placeholder |
| 183 | 188 | ||
| 184 | do | 189 | do |
| 190 | [a, _, b, _] = tb -- list placeholder | ||
| 191 | |||
| 192 | do | ||
| 185 | {x: a.b = 1, y: a.c = 2} = x.x.x | 193 | {x: a.b = 1, y: a.c = 2} = x.x.x |
| 186 | 194 | ||
| 187 | do | 195 | do |
