aboutsummaryrefslogtreecommitdiff
path: root/spec/outputs/nil_coalesce_precedence.lua
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2026-01-22 15:03:12 +0800
committerLi Jin <dragon-fly@qq.com>2026-01-22 15:03:12 +0800
commitf1454bbbd13a71da2005ff789cde2da0e9eb81f6 (patch)
tree37131187f4218dd3ebec049101c28a161e7ca289 /spec/outputs/nil_coalesce_precedence.lua
parent604a8e5e53cdc7391a502fcabf07e8f1cc2a778c (diff)
downloadyuescript-f1454bbbd13a71da2005ff789cde2da0e9eb81f6.tar.gz
yuescript-f1454bbbd13a71da2005ff789cde2da0e9eb81f6.tar.bz2
yuescript-f1454bbbd13a71da2005ff789cde2da0e9eb81f6.zip
Adding tests.
Diffstat (limited to 'spec/outputs/nil_coalesce_precedence.lua')
-rw-r--r--spec/outputs/nil_coalesce_precedence.lua24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/outputs/nil_coalesce_precedence.lua b/spec/outputs/nil_coalesce_precedence.lua
new file mode 100644
index 0000000..6f353ee
--- /dev/null
+++ b/spec/outputs/nil_coalesce_precedence.lua
@@ -0,0 +1,24 @@
1local a = nil
2local b = false
3local c = 0
4local x
5if a ~= nil then
6 x = a
7else
8 do
9 local _exp_0 = (b and 1)
10 if _exp_0 ~= nil then
11 x = _exp_0
12 else
13 x = (c or 2)
14 end
15 end
16end
17local y = ((function()
18 if a ~= nil then
19 return a
20 else
21 return b
22 end
23end)()) and 1 or 2
24return print(x, y)