diff options
| author | Li Jin <dragon-fly@qq.com> | 2020-10-08 13:01:18 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2020-10-08 13:01:18 +0800 |
| commit | 97bbe98289fb74c7cf2d9793b80a1a27b4146045 (patch) | |
| tree | 4bee0dded55bad28f6822b6e2dd3ea5251c66ae2 /spec/inputs/return.mp | |
| parent | 5b656d2913e4f9f0017698ec835ce4ddda1dc81f (diff) | |
| download | yuescript-97bbe98289fb74c7cf2d9793b80a1a27b4146045.tar.gz yuescript-97bbe98289fb74c7cf2d9793b80a1a27b4146045.tar.bz2 yuescript-97bbe98289fb74c7cf2d9793b80a1a27b4146045.zip | |
change file extension moonp.
Diffstat (limited to 'spec/inputs/return.mp')
| -rw-r--r-- | spec/inputs/return.mp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/spec/inputs/return.mp b/spec/inputs/return.mp new file mode 100644 index 0000000..f170ffd --- /dev/null +++ b/spec/inputs/return.mp | |||
| @@ -0,0 +1,55 @@ | |||
| 1 | -- testing `return` propagation | ||
| 2 | |||
| 3 | _ = -> _ = x for x in *things | ||
| 4 | _ = -> [x for x in *things] | ||
| 5 | |||
| 6 | |||
| 7 | -- doesn't make sense on purpose | ||
| 8 | do | ||
| 9 | return x for x in *things | ||
| 10 | |||
| 11 | do | ||
| 12 | return [x for x in *things] | ||
| 13 | |||
| 14 | do | ||
| 15 | return {x,y for x,y in *things} | ||
| 16 | |||
| 17 | _ = -> | ||
| 18 | if a | ||
| 19 | if a | ||
| 20 | a | ||
| 21 | else | ||
| 22 | b | ||
| 23 | elseif b | ||
| 24 | if a | ||
| 25 | a | ||
| 26 | else | ||
| 27 | b | ||
| 28 | else | ||
| 29 | if a | ||
| 30 | a | ||
| 31 | else | ||
| 32 | b | ||
| 33 | |||
| 34 | |||
| 35 | do | ||
| 36 | return if a | ||
| 37 | if a | ||
| 38 | a | ||
| 39 | else | ||
| 40 | b | ||
| 41 | elseif b | ||
| 42 | if a | ||
| 43 | a | ||
| 44 | else | ||
| 45 | b | ||
| 46 | else | ||
| 47 | if a | ||
| 48 | a | ||
| 49 | else | ||
| 50 | b | ||
| 51 | |||
| 52 | _ = -> a\b | ||
| 53 | do a\b | ||
| 54 | |||
| 55 | |||
