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

Method parseStatement

internal/parser/parser.go:1064–1123  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1062}
1063
1064func (p *Parser) parseStatement() *ast.Statement {
1065 switch p.token {
1066 case ast.KindSemicolonToken:
1067 return p.parseEmptyStatement()
1068 case ast.KindOpenBraceToken:
1069 return p.parseBlock(false /*ignoreMissingOpenBrace*/, nil)
1070 case ast.KindVarKeyword:
1071 return p.parseVariableStatement(p.nodePos(), p.jsdocScannerInfo(), nil /*modifiers*/)
1072 case ast.KindLetKeyword:
1073 if p.isLetDeclaration() {
1074 return p.parseVariableStatement(p.nodePos(), p.jsdocScannerInfo(), nil /*modifiers*/)
1075 }
1076 case ast.KindAwaitKeyword:
1077 if p.isAwaitUsingDeclaration() {
1078 return p.parseVariableStatement(p.nodePos(), p.jsdocScannerInfo(), nil /*modifiers*/)
1079 }
1080 case ast.KindUsingKeyword:
1081 if p.isUsingDeclaration() {
1082 return p.parseVariableStatement(p.nodePos(), p.jsdocScannerInfo(), nil /*modifiers*/)
1083 }
1084 case ast.KindFunctionKeyword:
1085 return p.parseFunctionDeclaration(p.nodePos(), p.jsdocScannerInfo(), nil /*modifiers*/)
1086 case ast.KindClassKeyword:
1087 return p.parseClassDeclaration(p.nodePos(), p.jsdocScannerInfo(), nil /*modifiers*/)
1088 case ast.KindIfKeyword:
1089 return p.parseIfStatement()
1090 case ast.KindDoKeyword:
1091 return p.parseDoStatement()
1092 case ast.KindWhileKeyword:
1093 return p.parseWhileStatement()
1094 case ast.KindForKeyword:
1095 return p.parseForOrForInOrForOfStatement()
1096 case ast.KindContinueKeyword:
1097 return p.parseContinueStatement()
1098 case ast.KindBreakKeyword:
1099 return p.parseBreakStatement()
1100 case ast.KindReturnKeyword:
1101 return p.parseReturnStatement()
1102 case ast.KindWithKeyword:
1103 return p.parseWithStatement()
1104 case ast.KindSwitchKeyword:
1105 return p.parseSwitchStatement()
1106 case ast.KindThrowKeyword:
1107 return p.parseThrowStatement()
1108 case ast.KindTryKeyword, ast.KindCatchKeyword, ast.KindFinallyKeyword:
1109 return p.parseTryStatement()
1110 case ast.KindDebuggerKeyword:
1111 return p.parseDebuggerStatement()
1112 case ast.KindAtToken:
1113 return p.parseDeclaration()
1114 case ast.KindAsyncKeyword, ast.KindInterfaceKeyword, ast.KindTypeKeyword, ast.KindModuleKeyword, ast.KindNamespaceKeyword,
1115 ast.KindDeclareKeyword, ast.KindConstKeyword, ast.KindEnumKeyword, ast.KindExportKeyword, ast.KindImportKeyword,
1116 ast.KindPrivateKeyword, ast.KindProtectedKeyword, ast.KindPublicKeyword, ast.KindAbstractKeyword, ast.KindAccessorKeyword,
1117 ast.KindStaticKeyword, ast.KindReadonlyKeyword, ast.KindGlobalKeyword:
1118 if p.isStartOfDeclaration() {
1119 return p.parseDeclaration()
1120 }
1121 }

Callers 7

reparseTopLevelAwaitMethod · 0.95
parseIfStatementMethod · 0.95
parseDoStatementMethod · 0.95
parseWhileStatementMethod · 0.95

Calls 15

parseEmptyStatementMethod · 0.95
parseBlockMethod · 0.95
nodePosMethod · 0.95
jsdocScannerInfoMethod · 0.95
isLetDeclarationMethod · 0.95
isUsingDeclarationMethod · 0.95
parseClassDeclarationMethod · 0.95
parseIfStatementMethod · 0.95
parseDoStatementMethod · 0.95

Tested by

no test coverage detected