()
| 5063 | } |
| 5064 | |
| 5065 | func (p *Parser) parseSimpleUnaryExpression() *ast.Expression { |
| 5066 | switch p.token { |
| 5067 | case ast.KindPlusToken, ast.KindMinusToken, ast.KindTildeToken, ast.KindExclamationToken: |
| 5068 | return p.parsePrefixUnaryExpression() |
| 5069 | case ast.KindDeleteKeyword: |
| 5070 | return p.parseDeleteExpression() |
| 5071 | case ast.KindTypeOfKeyword: |
| 5072 | return p.parseTypeOfExpression() |
| 5073 | case ast.KindVoidKeyword: |
| 5074 | return p.parseVoidExpression() |
| 5075 | case ast.KindLessThanToken: |
| 5076 | // Just like in parseUpdateExpression, we need to avoid parsing type assertions when |
| 5077 | // in JSX and we see an expression like "+ <foo> bar". |
| 5078 | if p.languageVariant == core.LanguageVariantJSX { |
| 5079 | return p.parseJsxElementOrSelfClosingElementOrFragment(true /*inExpressionContext*/, -1 /*topInvalidNodePosition*/, nil /*openingTag*/, true /*mustBeUnary*/) |
| 5080 | } |
| 5081 | // // This is modified UnaryExpression grammar in TypeScript |
| 5082 | // // UnaryExpression (modified): |
| 5083 | // // < type > UnaryExpression |
| 5084 | return p.parseTypeAssertion() |
| 5085 | case ast.KindAwaitKeyword: |
| 5086 | if p.isAwaitExpression() { |
| 5087 | return p.parseAwaitExpression() |
| 5088 | } |
| 5089 | fallthrough |
| 5090 | default: |
| 5091 | return p.parseUpdateExpression() |
| 5092 | } |
| 5093 | } |
| 5094 | |
| 5095 | func (p *Parser) parsePrefixUnaryExpression() *ast.Node { |
| 5096 | pos := p.nodePos() |
no test coverage detected