MCPcopy Index your code
hub / github.com/microsoft/typescript-go / parseDoStatement

Method parseDoStatement

internal/parser/parser.go:1259–1277  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1257}
1258
1259func (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
1279func (p *Parser) parseWhileStatement() *ast.Node {
1280 pos := p.nodePos()

Callers 1

parseStatementMethod · 0.95

Calls 11

nodePosMethod · 0.95
jsdocScannerInfoMethod · 0.95
parseExpectedMethod · 0.95
parseStatementMethod · 0.95
parseOptionalMethod · 0.95
finishNodeMethod · 0.95
withJSDocMethod · 0.95
TokenStartMethod · 0.80
NewDoStatementMethod · 0.80

Tested by

no test coverage detected