()
| 1055 | } |
| 1056 | |
| 1057 | private parsePrefix(): AST { |
| 1058 | if (this.next.type == TokenType.Operator) { |
| 1059 | const start = this.inputIndex; |
| 1060 | const operator = this.next.strValue; |
| 1061 | let result: AST; |
| 1062 | switch (operator) { |
| 1063 | case '+': |
| 1064 | this.advance(); |
| 1065 | result = this.parsePrefix(); |
| 1066 | return Unary.createPlus(this.span(start), this.sourceSpan(start), result); |
| 1067 | case '-': |
| 1068 | this.advance(); |
| 1069 | result = this.parsePrefix(); |
| 1070 | return Unary.createMinus(this.span(start), this.sourceSpan(start), result); |
| 1071 | case '!': |
| 1072 | this.advance(); |
| 1073 | result = this.parsePrefix(); |
| 1074 | return new PrefixNot(this.span(start), this.sourceSpan(start), result); |
| 1075 | } |
| 1076 | } else if (this.next.isKeywordTypeof()) { |
| 1077 | const start = this.inputIndex; |
| 1078 | this.advance(); |
| 1079 | const result = this.parsePrefix(); |
| 1080 | return new TypeofExpression(this.span(start), this.sourceSpan(start), result); |
| 1081 | } else if (this.next.isKeywordVoid()) { |
| 1082 | const start = this.inputIndex; |
| 1083 | this.advance(); |
| 1084 | const result = this.parsePrefix(); |
| 1085 | return new VoidExpression(this.span(start), this.sourceSpan(start), result); |
| 1086 | } |
| 1087 | return this.parseCallChain(); |
| 1088 | } |
| 1089 | |
| 1090 | private parseCallChain(): AST { |
| 1091 | const start = this.inputIndex; |
no test coverage detected