Skip to content

Commit d16d798

Browse files
authored
Merge pull request #17844 from nkcsgexi/rename-back-tracking
libSyntax: rename SyntaxParsingContext.setDiscard() to SyntaxParsingContext.setBackTracking(). NFC
2 parents 92900d4 + fd6b594 commit d16d798

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

include/swift/Parse/Parser.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ class Parser {
414414
BacktrackingScope(Parser &P)
415415
: P(P), PP(P.getParserPosition()), DT(P.Diags) {
416416
SynContext.emplace(P.SyntaxContext);
417-
SynContext->setDiscard();
417+
SynContext->setBackTracking();
418418
}
419419

420420
~BacktrackingScope();

include/swift/Parse/SyntaxParsingContext.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,9 @@ class alignas(1 << SyntaxAlignInBits) SyntaxParsingContext {
280280
/// Move the collected parts to the tail of parent context.
281281
void setTransparent() { Mode = AccumulationMode::Transparent; }
282282

283-
/// Discard collected parts on this context.
284-
void setDiscard() { Mode = AccumulationMode::Discard; }
283+
/// This context is a back tracking context, so we should discard collected
284+
/// parts on this context.
285+
void setBackTracking() { Mode = AccumulationMode::Discard; }
285286

286287
/// Explicitly finalizing syntax tree creation.
287288
/// This function will be called during the destroying of a root syntax

lib/Parse/ParseDecl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3546,7 +3546,7 @@ parseDeclTypeAlias(Parser::ParseDeclOptions Flags, DeclAttributes &Attributes) {
35463546
}
35473547

35483548
if (Flags.contains(PD_InProtocol) && !genericParams && !Tok.is(tok::equal)) {
3549-
TmpCtxt->setDiscard();
3549+
TmpCtxt->setBackTracking();
35503550
TmpCtxt.reset();
35513551
// If we're in a protocol and don't see an '=' this looks like leftover Swift 2
35523552
// code intending to be an associatedtype.
@@ -4134,7 +4134,7 @@ bool Parser::parseGetSetImpl(ParseDeclOptions Flags,
41344134
// that the diagnostics point to correct tokens.
41354135
if (BeginParserPosition.isValid()) {
41364136
backtrackToPosition(BeginParserPosition);
4137-
BacktrackCtxt->setDiscard();
4137+
BacktrackCtxt->setBackTracking();
41384138
BacktrackCtxt.reset();
41394139
Attributes = DeclAttributes();
41404140
}

lib/Parse/ParseExpr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2133,7 +2133,7 @@ DeclName Parser::parseUnqualifiedDeclName(bool afterDot,
21332133
// This is not a compound name.
21342134
// FIXME: Could recover better if we "know" it's a compound name.
21352135
loc = DeclNameLoc(baseNameLoc);
2136-
ArgsCtxt.setDiscard();
2136+
ArgsCtxt.setBackTracking();
21372137
return baseName;
21382138
}
21392139
// We have a compound name. Cancel backtracking and build that name.

0 commit comments

Comments
 (0)