diff --git a/src/TreeInterpreter.ts b/src/TreeInterpreter.ts index adc0bfb..923efd6 100644 --- a/src/TreeInterpreter.ts +++ b/src/TreeInterpreter.ts @@ -52,10 +52,10 @@ export class TreeInterpreter { case 'Subexpression': result = this.visit((node as ExpressionNode).children[0], value); for (i = 1; i < (node as ExpressionNode).children.length; i += 1) { - result = this.visit((node as ExpressionNode).children[1], result); if (result === null) { return null; } + result = this.visit((node as ExpressionNode).children[1], result); } return result; case 'IndexExpression': @@ -184,9 +184,6 @@ export class TreeInterpreter { case 'Identity': return value; case 'MultiSelectList': - if (value === null) { - return null; - } collected = []; for (i = 0; i < (node as ExpressionNode).children.length; i += 1) { collected.push(this.visit((node as ExpressionNode).children[i], value)); diff --git a/test/compliance/pipe.json b/test/compliance/pipe.json index b10c0a4..3f1f15d 100644 --- a/test/compliance/pipe.json +++ b/test/compliance/pipe.json @@ -126,6 +126,10 @@ { "expression": "foo[*].bar[*] | [0][0]", "result": {"baz": "one"} + }, + { + "expression": "`null`|[@]", + "result": [ null ] } ] }]