()
| 1257 | } |
| 1258 | |
| 1259 | func (p *Parser) parseDoStatement() *ast.Node { |
| 1260 | pos := p.nodePos() |
| 1261 | jsdoc := p.jsdocScannerInfo() |
| 1262 | p.parseExpected(ast.KindDoKeyword) |
| 1263 | statement := p.parseStatement() |
| 1264 | p.parseExpected(ast.KindWhileKeyword) |
| 1265 | openParenPosition := p.scanner.TokenStart() |
| 1266 | openParenParsed := p.parseExpected(ast.KindOpenParenToken) |
| 1267 | expression := p.parseExpressionAllowIn() |
| 1268 | p.parseExpectedMatchingBrackets(ast.KindOpenParenToken, ast.KindCloseParenToken, openParenParsed, openParenPosition) |
| 1269 | // From: https://mail.mozilla.org/pipermail/es-discuss/2011-August/016188.html |
| 1270 | // 157 min --- All allen at wirfs-brock.com CONF --- "do{;}while(false)false" prohibited in |
| 1271 | // spec but allowed in consensus reality. Approved -- this is the de-facto standard whereby |
| 1272 | // do;while(0)x will have a semicolon inserted before x. |
| 1273 | p.parseOptional(ast.KindSemicolonToken) |
| 1274 | result := p.finishNode(p.factory.NewDoStatement(statement, expression), pos) |
| 1275 | p.withJSDoc(result, jsdoc) |
| 1276 | return result |
| 1277 | } |
| 1278 | |
| 1279 | func (p *Parser) parseWhileStatement() *ast.Node { |
| 1280 | pos := p.nodePos() |
no test coverage detected