diff options
author | Li Jin <dragon-fly@qq.com> | 2021-10-31 17:29:45 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2021-10-31 17:29:45 +0800 |
commit | aed806476fe50899c0f01750175531ac41267b9d (patch) | |
tree | c46f212a2987a9088b03e2c0225f18cd9a5d4265 /spec/inputs | |
parent | 60a979e224f26117f5be82bfca757a2483cef0fd (diff) | |
download | yuescript-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.yue | 40 |
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 @@ | |||
1 | do | ||
2 | a = b ?? c | ||
3 | |||
4 | do | ||
5 | :a = b ?? c | ||
6 | |||
7 | do | ||
8 | a = func! | ||
9 | a ??= false | ||
10 | |||
11 | do | ||
12 | a ??= func! | ||
13 | |||
14 | do | ||
15 | local a, b, c, d, e | ||
16 | a = b ?? c ?? d ?? e | ||
17 | |||
18 | do | ||
19 | a = b ?? c ?? d ?? e | ||
20 | |||
21 | do | ||
22 | func x ?? "hello" | ||
23 | |||
24 | do | ||
25 | with funcA! ?? funcB! | ||
26 | print .field | ||
27 | |||
28 | do | ||
29 | a = 1 + 2 + b ?? c + 3 + 4 | ||
30 | |||
31 | do | ||
32 | a = 1 + 2 + (b ?? c) + 3 + 4 | ||
33 | |||
34 | do | ||
35 | :a, :b = func! | ||
36 | a or= 1 | ||
37 | b ??= c ?? 2 | ||
38 | |||
39 | nil | ||
40 | |||