aboutsummaryrefslogtreecommitdiff
path: root/spec/inputs
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2022-02-11 10:37:35 +0800
committerLi Jin <dragon-fly@qq.com>2022-02-11 10:37:35 +0800
commit09fc831f540ce3966aeff679164f37e7d40457c9 (patch)
treeea56f0fa897af3089e1289bdfa7676a62198dc13 /spec/inputs
parenta66ec0d18eba6b38fad25cc88c82f7532d689670 (diff)
downloadyuescript-09fc831f540ce3966aeff679164f37e7d40457c9.tar.gz
yuescript-09fc831f540ce3966aeff679164f37e7d40457c9.tar.bz2
yuescript-09fc831f540ce3966aeff679164f37e7d40457c9.zip
add Lua table appending idiom: tb #= 123
Diffstat (limited to 'spec/inputs')
-rw-r--r--spec/inputs/syntax.yue13
1 files changed, 12 insertions, 1 deletions
diff --git a/spec/inputs/syntax.yue b/spec/inputs/syntax.yue
index cb947e1..67d3a27 100644
--- a/spec/inputs/syntax.yue
+++ b/spec/inputs/syntax.yue
@@ -184,10 +184,21 @@ a["hello#{tostring ff}"] += 10
184a[four].x += 10 184a[four].x += 10
185 185
186a.b += 1 186a.b += 1
187a.b[1].c[2+3] += 1 187a.b[1].c[2 + 3] += 1
188with tb 188with tb
189 .a.c += 1 189 .a.c += 1
190 190
191tb #= 10
192a.b.c #= 1
193x #= if v
194 1
195else
196 2
197with tb
198 .b.c #= with vec
199 .x = 1
200 .y = 2
201
191x = 0 202x = 0
192_ = (if ntype(v) == "fndef" then x += 1) for v in *values 203_ = (if ntype(v) == "fndef" then x += 1) for v in *values
193 204