Skip to content

Commit

Permalink
Merge pull request #1678 from DanielXMoore/pipe-new-fix
Browse files Browse the repository at this point in the history
Fix pipe into certain `new` expressions
  • Loading branch information
edemaine authored Jan 5, 2025
2 parents aa8b8c1 + 5435a9a commit d64686f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 1 addition & 2 deletions source/parser/pipe.civet
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,8 @@ function constructInvocation(fn: ExprWithComments, arg: ASTNode!)
if lhs.type is "NewExpression"
{ expression } .= lhs
expression = {
...expression
type: "CallExpression"
children: [ ...expression.children, call ]
children: [ expression, call ]
}
{
...lhs
Expand Down
8 changes: 8 additions & 0 deletions test/pipe.civet
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,14 @@ describe "pipe", ->
new Foo(x)(x)
"""

throws """
pipe to invalid new
---
x |> new .
---
ParseErrors: unknown:1:10 Partial placeholder . outside of call expression
"""

testCase """
pipe from new
---
Expand Down

0 comments on commit d64686f

Please sign in to comment.