From 7575fe00aad91e0ba943e877ddcd838f76e095c0 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Thu, 26 Sep 2024 22:11:13 +0800 Subject: Fixed a few issues. * 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. --- spec/inputs/syntax.yue | 4 ++-- spec/inputs/unicode/syntax.yue | 4 ++-- spec/outputs/syntax.lua | 14 +++++++++----- spec/outputs/unicode/syntax.lua | 14 +++++++++----- spec/outputs/unicode/with.lua | 4 +++- spec/outputs/with.lua | 4 +++- 6 files changed, 28 insertions(+), 16 deletions(-) (limited to 'spec') 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 @@ _ = -> _ = -> 1,2,34 -return 5 + () -> 4 + 2 +do return 5 + () -> 4 + 2 -return 5 + (() -> 4) + 2 +do return 5 + (() -> 4) + 2 print 5 + () -> _ = 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 @@ _ = -> _ = -> 1,2,34 -return 5 + () -> 4 + 2 +do return 5 + () -> 4 + 2 -return 5 + (() -> 4) + 2 +do return 5 + (() -> 4) + 2 打印 5 + () -> _ = 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 _ = function() return 1, 2, 34 end -return 5 + function() - return 4 + 2 +do + return 5 + function() + return 4 + 2 + end +end +do + return 5 + (function() + return 4 + end) + 2 end -return 5 + (function() - return 4 -end) + 2 print(5 + function() _ = 34 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 _ = function() return 1, 2, 34 end -return 5 + function() - return 4 + 2 +do + return 5 + function() + return 4 + 2 + end +end +do + return 5 + (function() + return 4 + end) + 2 end -return 5 + (function() - return 4 -end) + 2 _u6253_u5370(5 + function() _ = 34 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 local _ _ = function() local _with_0 = _u55e8 - return _with_0.a, _with_0.b + do + return _with_0.a, _with_0.b + end end end 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 local _ _ = function() local _with_0 = hi - return _with_0.a, _with_0.b + do + return _with_0.a, _with_0.b + end end end do -- cgit v1.2.3-55-g6feb