diff options
author | Li Jin <dragon-fly@qq.com> | 2024-09-26 22:11:13 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2024-09-26 22:11:13 +0800 |
commit | 7575fe00aad91e0ba943e877ddcd838f76e095c0 (patch) | |
tree | cc1da50dddf61e77f33c026e38afe4ac2ad7d904 /spec | |
parent | 461bf7c32408553125d71b23e04e21fed690c4f5 (diff) | |
download | yuescript-7575fe00aad91e0ba943e877ddcd838f76e095c0.tar.gz yuescript-7575fe00aad91e0ba943e877ddcd838f76e095c0.tar.bz2 yuescript-7575fe00aad91e0ba943e877ddcd838f76e095c0.zip |
Fixed a few issues.v0.25.2
* Fixed a `with` block with return statement issue.
* Fixed a switch-when indentation issue.
* Added error reporting for `return` statement not appearing in last block line.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/inputs/syntax.yue | 4 | ||||
-rw-r--r-- | spec/inputs/unicode/syntax.yue | 4 | ||||
-rw-r--r-- | spec/outputs/syntax.lua | 14 | ||||
-rw-r--r-- | spec/outputs/unicode/syntax.lua | 14 | ||||
-rw-r--r-- | spec/outputs/unicode/with.lua | 4 | ||||
-rw-r--r-- | spec/outputs/with.lua | 4 |
6 files changed, 28 insertions, 16 deletions
diff --git a/spec/inputs/syntax.yue b/spec/inputs/syntax.yue index 271f43f..a414d6f 100644 --- a/spec/inputs/syntax.yue +++ b/spec/inputs/syntax.yue | |||
@@ -52,9 +52,9 @@ _ = -> | |||
52 | 52 | ||
53 | _ = -> 1,2,34 | 53 | _ = -> 1,2,34 |
54 | 54 | ||
55 | return 5 + () -> 4 + 2 | 55 | do return 5 + () -> 4 + 2 |
56 | 56 | ||
57 | return 5 + (() -> 4) + 2 | 57 | do return 5 + (() -> 4) + 2 |
58 | 58 | ||
59 | print 5 + () -> | 59 | print 5 + () -> |
60 | _ = 34 | 60 | _ = 34 |
diff --git a/spec/inputs/unicode/syntax.yue b/spec/inputs/unicode/syntax.yue index f382688..8a98416 100644 --- a/spec/inputs/unicode/syntax.yue +++ b/spec/inputs/unicode/syntax.yue | |||
@@ -51,9 +51,9 @@ _ = -> | |||
51 | 51 | ||
52 | _ = -> 1,2,34 | 52 | _ = -> 1,2,34 |
53 | 53 | ||
54 | return 5 + () -> 4 + 2 | 54 | do return 5 + () -> 4 + 2 |
55 | 55 | ||
56 | return 5 + (() -> 4) + 2 | 56 | do return 5 + (() -> 4) + 2 |
57 | 57 | ||
58 | 打印 5 + () -> | 58 | 打印 5 + () -> |
59 | _ = 34 | 59 | _ = 34 |
diff --git a/spec/outputs/syntax.lua b/spec/outputs/syntax.lua index cfe63eb..5fd1821 100644 --- a/spec/outputs/syntax.lua +++ b/spec/outputs/syntax.lua | |||
@@ -40,12 +40,16 @@ end | |||
40 | _ = function() | 40 | _ = function() |
41 | return 1, 2, 34 | 41 | return 1, 2, 34 |
42 | end | 42 | end |
43 | return 5 + function() | 43 | do |
44 | return 4 + 2 | 44 | return 5 + function() |
45 | return 4 + 2 | ||
46 | end | ||
47 | end | ||
48 | do | ||
49 | return 5 + (function() | ||
50 | return 4 | ||
51 | end) + 2 | ||
45 | end | 52 | end |
46 | return 5 + (function() | ||
47 | return 4 | ||
48 | end) + 2 | ||
49 | print(5 + function() | 53 | print(5 + function() |
50 | _ = 34 | 54 | _ = 34 |
51 | return good(nads) | 55 | return good(nads) |
diff --git a/spec/outputs/unicode/syntax.lua b/spec/outputs/unicode/syntax.lua index 9ea8f68..ea97bb9 100644 --- a/spec/outputs/unicode/syntax.lua +++ b/spec/outputs/unicode/syntax.lua | |||
@@ -40,12 +40,16 @@ end | |||
40 | _ = function() | 40 | _ = function() |
41 | return 1, 2, 34 | 41 | return 1, 2, 34 |
42 | end | 42 | end |
43 | return 5 + function() | 43 | do |
44 | return 4 + 2 | 44 | return 5 + function() |
45 | return 4 + 2 | ||
46 | end | ||
47 | end | ||
48 | do | ||
49 | return 5 + (function() | ||
50 | return 4 | ||
51 | end) + 2 | ||
45 | end | 52 | end |
46 | return 5 + (function() | ||
47 | return 4 | ||
48 | end) + 2 | ||
49 | _u6253_u5370(5 + function() | 53 | _u6253_u5370(5 + function() |
50 | _ = 34 | 54 | _ = 34 |
51 | return _u597d(_u7403) | 55 | return _u597d(_u7403) |
diff --git a/spec/outputs/unicode/with.lua b/spec/outputs/unicode/with.lua index 7a5ba00..cfad264 100644 --- a/spec/outputs/unicode/with.lua +++ b/spec/outputs/unicode/with.lua | |||
@@ -123,7 +123,9 @@ do | |||
123 | local _ | 123 | local _ |
124 | _ = function() | 124 | _ = function() |
125 | local _with_0 = _u55e8 | 125 | local _with_0 = _u55e8 |
126 | return _with_0.a, _with_0.b | 126 | do |
127 | return _with_0.a, _with_0.b | ||
128 | end | ||
127 | end | 129 | end |
128 | end | 130 | end |
129 | do | 131 | do |
diff --git a/spec/outputs/with.lua b/spec/outputs/with.lua index b2a1c3b..d880d1e 100644 --- a/spec/outputs/with.lua +++ b/spec/outputs/with.lua | |||
@@ -121,7 +121,9 @@ do | |||
121 | local _ | 121 | local _ |
122 | _ = function() | 122 | _ = function() |
123 | local _with_0 = hi | 123 | local _with_0 = hi |
124 | return _with_0.a, _with_0.b | 124 | do |
125 | return _with_0.a, _with_0.b | ||
126 | end | ||
125 | end | 127 | end |
126 | end | 128 | end |
127 | do | 129 | do |