diff options
-rw-r--r-- | spec/inputs/pipe.yue | 6 | ||||
-rw-r--r-- | spec/outputs/pipe.lua | 2 | ||||
-rw-r--r-- | src/yuescript/yue_compiler.cpp | 6 |
3 files changed, 13 insertions, 1 deletions
diff --git a/spec/inputs/pipe.yue b/spec/inputs/pipe.yue index 7e33422..02f87a3 100644 --- a/spec/inputs/pipe.yue +++ b/spec/inputs/pipe.yue | |||
@@ -71,6 +71,12 @@ do | |||
71 | |> f2 2 | 71 | |> f2 2 |
72 | |> f3 3 | 72 | |> f3 3 |
73 | |> f4 4 | 73 | |> f4 4 |
74 | |||
75 | const x = y | ||
76 | |> z | ||
77 | |||
78 | close a = b | ||
79 | |> c | ||
74 | 80 | ||
75 | x = 123 |> a |> b or 456 |> c |> d or a.if\then("abc") or a?.b\c?(123) or x\y | 81 | x = 123 |> a |> b or 456 |> c |> d or a.if\then("abc") or a?.b\c?(123) or x\y |
76 | 82 | ||
diff --git a/spec/outputs/pipe.lua b/spec/outputs/pipe.lua index 345f8b0..124231a 100644 --- a/spec/outputs/pipe.lua +++ b/spec/outputs/pipe.lua | |||
@@ -103,6 +103,8 @@ do | |||
103 | _2, _3, _4 = 1, 2, f(3) | 103 | _2, _3, _4 = 1, 2, f(3) |
104 | local _5 | 104 | local _5 |
105 | _5 = f4(f3(f2(f1(v, 1), 2), 3), 4) | 105 | _5 = f4(f3(f2(f1(v, 1), 2), 3), 4) |
106 | local x <const> = z(y) | ||
107 | local a <close> = c(b) | ||
106 | end | 108 | end |
107 | local x = b(a(123)) or d(c(456)) or (function() | 109 | local x = b(a(123)) or d(c(456)) or (function() |
108 | local _call_0 = a["if"] | 110 | local _call_0 = a["if"] |
diff --git a/src/yuescript/yue_compiler.cpp b/src/yuescript/yue_compiler.cpp index b81764f..fa7be45 100644 --- a/src/yuescript/yue_compiler.cpp +++ b/src/yuescript/yue_compiler.cpp | |||
@@ -74,7 +74,7 @@ static std::unordered_set<std::string> Metamethods = { | |||
74 | "close"s // Lua 5.4 | 74 | "close"s // Lua 5.4 |
75 | }; | 75 | }; |
76 | 76 | ||
77 | const std::string_view version = "0.19.4"sv; | 77 | const std::string_view version = "0.19.5"sv; |
78 | const std::string_view extension = "yue"sv; | 78 | const std::string_view extension = "yue"sv; |
79 | 79 | ||
80 | class CompileError : public std::logic_error { | 80 | class CompileError : public std::logic_error { |
@@ -910,6 +910,10 @@ private: | |||
910 | return static_cast<Exp_t*>(expListAssign->expList->exprs.back()); | 910 | return static_cast<Exp_t*>(expListAssign->expList->exprs.back()); |
911 | } | 911 | } |
912 | } | 912 | } |
913 | case id<LocalAttrib_t>(): { | ||
914 | auto attribNode = static_cast<LocalAttrib_t*>(stmt->content.get()); | ||
915 | return lastExpFromAssign(attribNode->assign); | ||
916 | } | ||
913 | case id<Export_t>(): { | 917 | case id<Export_t>(): { |
914 | auto exportNode = static_cast<Export_t*>(stmt->content.get()); | 918 | auto exportNode = static_cast<Export_t*>(stmt->content.get()); |
915 | if (auto action = exportNode->assign.get()) { | 919 | if (auto action = exportNode->assign.get()) { |