Skip to content

Commit

Permalink
fix: chain operator should respect array constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
netomi committed Sep 23, 2024
1 parent c22ad4d commit 52851c9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -1194,6 +1194,7 @@ const parser = (() => {
result = {type: 'apply', value: expr.value, position: expr.position};
result.lhs = processAST(expr.lhs);
result.rhs = processAST(expr.rhs);
result.keepArray = result.lhs.keepArray || result.rhs.keepArray;
break;
default:
result = {type: expr.type, value: expr.value, position: expr.position};
Expand Down
6 changes: 6 additions & 0 deletions test/test-suite/groups/hof-map/case0010.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"expr": "( $square := function($x){$x*$x}; $map([1], $square)[] )",
"data": null,
"bindings": {},
"result": [1]
}
6 changes: 6 additions & 0 deletions test/test-suite/groups/hof-map/case0011.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"expr": "( $data := [1]; $square := function($x){$x*$x}; $data ~> $map($square)[] )",
"data": null,
"bindings": {},
"result": [1]
}

0 comments on commit 52851c9

Please sign in to comment.