()
| 2172 | // https://tc39.github.io/ecma262/#sec-while-statement |
| 2173 | |
| 2174 | parseWhileStatement(): Node.WhileStatement { |
| 2175 | const node = this.createNode(); |
| 2176 | let body; |
| 2177 | |
| 2178 | this.expectKeyword('while'); |
| 2179 | this.expect('('); |
| 2180 | const test = this.parseExpression(); |
| 2181 | |
| 2182 | if (!this.match(')') && this.config.tolerant) { |
| 2183 | this.tolerateUnexpectedToken(this.nextToken()); |
| 2184 | body = this.finalize(this.createNode(), new Node.EmptyStatement()); |
| 2185 | } else { |
| 2186 | this.expect(')'); |
| 2187 | |
| 2188 | const previousInIteration = this.context.inIteration; |
| 2189 | this.context.inIteration = true; |
| 2190 | body = this.parseStatement(); |
| 2191 | this.context.inIteration = previousInIteration; |
| 2192 | } |
| 2193 | |
| 2194 | return this.finalize(node, new Node.WhileStatement(test, body)); |
| 2195 | } |
| 2196 | |
| 2197 | // https://tc39.github.io/ecma262/#sec-for-statement |
| 2198 | // https://tc39.github.io/ecma262/#sec-for-in-and-for-of-statements |
no test coverage detected