|
551 | 551 | var node = {type: "Field", name: token.value};
|
552 | 552 | if (this._lookahead(0) === TOK_LPAREN) {
|
553 | 553 | throw new Error("Quoted identifier not allowed for function names.");
|
554 |
| - } else { |
555 |
| - return node; |
556 | 554 | }
|
557 |
| - break; |
| 555 | + return node; |
558 | 556 | case TOK_NOT:
|
559 | 557 | right = this.expression(bindingPower.Not);
|
560 | 558 | return {type: "NotExpression", children: [right]};
|
|
588 | 586 | right = this._parseProjectionRHS(bindingPower.Star);
|
589 | 587 | return {type: "Projection",
|
590 | 588 | children: [{type: "Identity"}, right]};
|
591 |
| - } else { |
592 |
| - return this._parseMultiselectList(); |
593 | 589 | }
|
594 |
| - break; |
| 590 | + return this._parseMultiselectList(); |
595 | 591 | case TOK_CURRENT:
|
596 | 592 | return {type: TOK_CURRENT};
|
597 | 593 | case TOK_EXPREF:
|
|
623 | 619 | if (this._lookahead(0) !== TOK_STAR) {
|
624 | 620 | right = this._parseDotRHS(rbp);
|
625 | 621 | return {type: "Subexpression", children: [left, right]};
|
626 |
| - } else { |
627 |
| - // Creating a projection. |
628 |
| - this._advance(); |
629 |
| - right = this._parseProjectionRHS(rbp); |
630 |
| - return {type: "ValueProjection", children: [left, right]}; |
631 | 622 | }
|
632 |
| - break; |
| 623 | + // Creating a projection. |
| 624 | + this._advance(); |
| 625 | + right = this._parseProjectionRHS(rbp); |
| 626 | + return {type: "ValueProjection", children: [left, right]}; |
633 | 627 | case TOK_PIPE:
|
634 | 628 | right = this.expression(bindingPower.Pipe);
|
635 | 629 | return {type: TOK_PIPE, children: [left, right]};
|
|
683 | 677 | if (token.type === TOK_NUMBER || token.type === TOK_COLON) {
|
684 | 678 | right = this._parseIndexExpression();
|
685 | 679 | return this._projectIfSlice(left, right);
|
686 |
| - } else { |
687 |
| - this._match(TOK_STAR); |
688 |
| - this._match(TOK_RBRACKET); |
689 |
| - right = this._parseProjectionRHS(bindingPower.Star); |
690 |
| - return {type: "Projection", children: [left, right]}; |
691 | 680 | }
|
692 |
| - break; |
| 681 | + this._match(TOK_STAR); |
| 682 | + this._match(TOK_RBRACKET); |
| 683 | + right = this._parseProjectionRHS(bindingPower.Star); |
| 684 | + return {type: "Projection", children: [left, right]}; |
693 | 685 | default:
|
694 | 686 | this._errorToken(this._lookaheadToken(0));
|
695 | 687 | }
|
|
866 | 858 | var matched, current, result, first, second, field, left, right, collected, i;
|
867 | 859 | switch (node.type) {
|
868 | 860 | case "Field":
|
869 |
| - if (value === null ) { |
870 |
| - return null; |
871 |
| - } else if (isObject(value)) { |
| 861 | + if (value !== null && isObject(value)) { |
872 | 862 | field = value[node.name];
|
873 | 863 | if (field === undefined) {
|
874 | 864 | return null;
|
875 | 865 | } else {
|
876 | 866 | return field;
|
877 | 867 | }
|
878 |
| - } else { |
879 |
| - return null; |
880 | 868 | }
|
881 |
| - break; |
| 869 | + return null; |
882 | 870 | case "Subexpression":
|
883 | 871 | result = this.visit(node.children[0], value);
|
884 | 872 | for (i = 1; i < node.children.length; i++) {
|
|
0 commit comments