From 6d88ca63050623db73e3cfe614e9a90657f5e875 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Fri, 6 Oct 2023 15:25:58 +0800 Subject: fixing issue #150. --- spec/inputs/pipe.yue | 6 ++++++ spec/outputs/pipe.lua | 2 ++ src/yuescript/yue_compiler.cpp | 6 +++++- 3 files changed, 13 insertions(+), 1 deletion(-) 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 |> f2 2 |> f3 3 |> f4 4 + + const x = y + |> z + + close a = b + |> c x = 123 |> a |> b or 456 |> c |> d or a.if\then("abc") or a?.b\c?(123) or x\y 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 _2, _3, _4 = 1, 2, f(3) local _5 _5 = f4(f3(f2(f1(v, 1), 2), 3), 4) + local x = z(y) + local a = c(b) end local x = b(a(123)) or d(c(456)) or (function() 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 Metamethods = { "close"s // Lua 5.4 }; -const std::string_view version = "0.19.4"sv; +const std::string_view version = "0.19.5"sv; const std::string_view extension = "yue"sv; class CompileError : public std::logic_error { @@ -910,6 +910,10 @@ private: return static_cast(expListAssign->expList->exprs.back()); } } + case id(): { + auto attribNode = static_cast(stmt->content.get()); + return lastExpFromAssign(attribNode->assign); + } case id(): { auto exportNode = static_cast(stmt->content.get()); if (auto action = exportNode->assign.get()) { -- cgit v1.2.3-55-g6feb