Skip to content

Commit

Permalink
fixing issue #150.
Browse files Browse the repository at this point in the history
  • Loading branch information
pigpigyyy committed Oct 6, 2023
1 parent bf84f1c commit 6d88ca6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions spec/inputs/pipe.yue
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions spec/outputs/pipe.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 <const> = z(y)
local a <close> = c(b)
end
local x = b(a(123)) or d(c(456)) or (function()
local _call_0 = a["if"]
Expand Down
6 changes: 5 additions & 1 deletion src/yuescript/yue_compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ static std::unordered_set<std::string> 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 {
Expand Down Expand Up @@ -910,6 +910,10 @@ class YueCompilerImpl {
return static_cast<Exp_t*>(expListAssign->expList->exprs.back());
}
}
case id<LocalAttrib_t>(): {
auto attribNode = static_cast<LocalAttrib_t*>(stmt->content.get());
return lastExpFromAssign(attribNode->assign);
}
case id<Export_t>(): {
auto exportNode = static_cast<Export_t*>(stmt->content.get());
if (auto action = exportNode->assign.get()) {
Expand Down

0 comments on commit 6d88ca6

Please sign in to comment.