(kind?: string)
| 2023 | // https://tc39.github.io/ecma262/#sec-variable-statement |
| 2024 | |
| 2025 | parseVariableIdentifier(kind?: string): Node.Identifier { |
| 2026 | const node = this.createNode(); |
| 2027 | |
| 2028 | const token = this.nextToken(); |
| 2029 | if (token.type === Token.Keyword && token.value === 'yield') { |
| 2030 | if (this.context.strict) { |
| 2031 | this.tolerateUnexpectedToken(token, Messages.StrictReservedWord); |
| 2032 | } else if (!this.context.allowYield) { |
| 2033 | this.throwUnexpectedToken(token); |
| 2034 | } |
| 2035 | } else if (token.type !== Token.Identifier) { |
| 2036 | if (this.context.strict && token.type === Token.Keyword && this.scanner.isStrictModeReservedWord(token.value as string)) { |
| 2037 | this.tolerateUnexpectedToken(token, Messages.StrictReservedWord); |
| 2038 | } else { |
| 2039 | if (this.context.strict || token.value !== 'let' || kind !== 'var') { |
| 2040 | this.throwUnexpectedToken(token); |
| 2041 | } |
| 2042 | } |
| 2043 | } else if ((this.context.isModule || this.context.await) && token.type === Token.Identifier && token.value === 'await') { |
| 2044 | this.tolerateUnexpectedToken(token); |
| 2045 | } |
| 2046 | |
| 2047 | return this.finalize(node, new Node.Identifier(token.value)); |
| 2048 | } |
| 2049 | |
| 2050 | parseVariableDeclaration(options: DeclarationOptions): Node.VariableDeclarator { |
| 2051 | const node = this.createNode(); |
no test coverage detected