aboutsummaryrefslogtreecommitdiff
path: root/spec/inputs/nil_coalescing.yue
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2022-02-14 11:20:10 +0800
committerLi Jin <dragon-fly@qq.com>2022-02-14 11:20:10 +0800
commit2c2cad4b4d3680bb30474b38ebed0f938e82636e (patch)
tree3d8cb1dc8e9ea0c156d766056b9535813358148b /spec/inputs/nil_coalescing.yue
parentac6c7c9998a77d5f93bf97e31568e65e6dd9585e (diff)
downloadyuescript-2c2cad4b4d3680bb30474b38ebed0f938e82636e.tar.gz
yuescript-2c2cad4b4d3680bb30474b38ebed0f938e82636e.tar.bz2
yuescript-2c2cad4b4d3680bb30474b38ebed0f938e82636e.zip
fix typo.
Diffstat (limited to 'spec/inputs/nil_coalescing.yue')
-rw-r--r--spec/inputs/nil_coalescing.yue48
1 files changed, 48 insertions, 0 deletions
diff --git a/spec/inputs/nil_coalescing.yue b/spec/inputs/nil_coalescing.yue
new file mode 100644
index 0000000..76915c7
--- /dev/null
+++ b/spec/inputs/nil_coalescing.yue
@@ -0,0 +1,48 @@
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
39do
40 a = 1 ?? 2 ?? 3
41
42do
43 a.b.c ??= 1
44 a = b.x ?? c.x ?? d.x
45 a.c ??= 1
46
47nil
48