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 authored and mattbaileyuk committed Sep 27, 2024
1 parent 222bb63 commit 9e6b8e6
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 9e6b8e6

Please sign in to comment.