(options: DeclarationOptions)
| 2048 | } |
| 2049 | |
| 2050 | parseVariableDeclaration(options: DeclarationOptions): Node.VariableDeclarator { |
| 2051 | const node = this.createNode(); |
| 2052 | |
| 2053 | const params = []; |
| 2054 | const id = this.parsePattern(params, 'var'); |
| 2055 | |
| 2056 | if (this.context.strict && id.type === Syntax.Identifier) { |
| 2057 | if (this.scanner.isRestrictedWord((id as Node.Identifier).name)) { |
| 2058 | this.tolerateError(Messages.StrictVarName); |
| 2059 | } |
| 2060 | } |
| 2061 | |
| 2062 | let init = null; |
| 2063 | if (this.match('=')) { |
| 2064 | this.nextToken(); |
| 2065 | init = this.isolateCoverGrammar(this.parseAssignmentExpression); |
| 2066 | } else if (id.type !== Syntax.Identifier && !options.inFor) { |
| 2067 | this.expect('='); |
| 2068 | } |
| 2069 | |
| 2070 | return this.finalize(node, new Node.VariableDeclarator(id, init)); |
| 2071 | } |
| 2072 | |
| 2073 | parseVariableDeclarationList(options): Node.VariableDeclarator[] { |
| 2074 | const opt: DeclarationOptions = { inFor: options.inFor }; |
no test coverage detected