Skip to content

Commit daae845

Browse files
committed
[parser] Add comments that parseStmt() and isStartOfStmt() must be kept in sync, NFC
1 parent 87cf549 commit daae845

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/Parse/ParseStmt.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ using namespace swift::syntax;
3636
/// isStartOfStmt - Return true if the current token starts a statement.
3737
///
3838
bool Parser::isStartOfStmt() {
39+
// This needs to be kept in sync with `Parser::parseStmt()`. If a new token
40+
// kind is accepted here as start of statement, it should also be handled in
41+
// `Parser::parseStmt()`.
3942
switch (Tok.getKind()) {
4043
default: return false;
4144
case tok::kw_return:
@@ -588,7 +591,9 @@ ParserResult<Stmt> Parser::parseStmt() {
588591
if (isContextualYieldKeyword()) {
589592
Tok.setKind(tok::kw_yield);
590593
}
591-
594+
595+
// This needs to handle everything that `Parser::isStartOfStmt()` accepts as
596+
// start of statement.
592597
switch (Tok.getKind()) {
593598
case tok::pound_line:
594599
case tok::pound_sourceLocation:

0 commit comments

Comments
 (0)