diff options
Diffstat (limited to 'spec/outputs/nil_coalesce_precedence.lua')
| -rw-r--r-- | spec/outputs/nil_coalesce_precedence.lua | 24 |
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 @@ | |||
| 1 | local a = nil | ||
| 2 | local b = false | ||
| 3 | local c = 0 | ||
| 4 | local x | ||
| 5 | if a ~= nil then | ||
| 6 | x = a | ||
| 7 | else | ||
| 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 | ||
| 16 | end | ||
| 17 | local y = ((function() | ||
| 18 | if a ~= nil then | ||
| 19 | return a | ||
| 20 | else | ||
| 21 | return b | ||
| 22 | end | ||
| 23 | end)()) and 1 or 2 | ||
| 24 | return print(x, y) | ||
