Skip to content

Commit 9e6b8e6

Browse files
netomimattbaileyuk
authored andcommitted
fix: chain operator should respect array constructor
1 parent 222bb63 commit 9e6b8e6

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

src/parser.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,6 +1194,7 @@ const parser = (() => {
11941194
result = {type: 'apply', value: expr.value, position: expr.position};
11951195
result.lhs = processAST(expr.lhs);
11961196
result.rhs = processAST(expr.rhs);
1197+
result.keepArray = result.lhs.keepArray || result.rhs.keepArray;
11971198
break;
11981199
default:
11991200
result = {type: expr.type, value: expr.value, position: expr.position};
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"expr": "( $square := function($x){$x*$x}; $map([1], $square)[] )",
3+
"data": null,
4+
"bindings": {},
5+
"result": [1]
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"expr": "( $data := [1]; $square := function($x){$x*$x}; $data ~> $map($square)[] )",
3+
"data": null,
4+
"bindings": {},
5+
"result": [1]
6+
}

0 commit comments

Comments
 (0)