aboutsummaryrefslogtreecommitdiff
path: root/spec/inputs
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2021-10-31 17:29:45 +0800
committerLi Jin <dragon-fly@qq.com>2021-10-31 17:29:45 +0800
commitaed806476fe50899c0f01750175531ac41267b9d (patch)
treec46f212a2987a9088b03e2c0225f18cd9a5d4265 /spec/inputs
parent60a979e224f26117f5be82bfca757a2483cef0fd (diff)
downloadyuescript-aed806476fe50899c0f01750175531ac41267b9d.tar.gz
yuescript-aed806476fe50899c0f01750175531ac41267b9d.tar.bz2
yuescript-aed806476fe50899c0f01750175531ac41267b9d.zip
partially fix issue #69, fix a few case the generated code leaks some temp variables.
Diffstat (limited to 'spec/inputs')
-rw-r--r--spec/inputs/nil_coalesing.yue40
1 files changed, 40 insertions, 0 deletions
diff --git a/spec/inputs/nil_coalesing.yue b/spec/inputs/nil_coalesing.yue
new file mode 100644
index 0000000..45b34f4
--- /dev/null
+++ b/spec/inputs/nil_coalesing.yue
@@ -0,0 +1,40 @@
1do
2 a = b ?? c
3
4do
5 :a = b ?? c
6
7do
8 a = func!
9 a ??= false
10
11do
12 a ??= func!
13
14do
15 local a, b, c, d, e
16 a = b ?? c ?? d ?? e
17
18do
19 a = b ?? c ?? d ?? e
20
21do
22 func x ?? "hello"
23
24do
25 with funcA! ?? funcB!
26 print .field
27
28do
29 a = 1 + 2 + b ?? c + 3 + 4
30
31do
32 a = 1 + 2 + (b ?? c) + 3 + 4
33
34do
35 :a, :b = func!
36 a or= 1
37 b ??= c ?? 2
38
39nil
40