mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
libSyntax: Root parsing context should hold a reference to the current token in the parser, NFC.
Since all parsing contexts need a reference to the current token of the parser, we should pass the token reference to the root context. Therefore, the derived sub-contexts can just copy it while being spawned.
This commit is contained in:
@@ -41,7 +41,7 @@ using namespace swift::syntax;
|
||||
ParserResult<Expr> Parser::parseExprImpl(Diag<> Message, bool isExprBasic) {
|
||||
// Start a context for creating expression syntax.
|
||||
SyntaxParsingContextChild ExprParsingContext(SyntaxContext,
|
||||
SyntaxContextKind::Expr, Tok);
|
||||
SyntaxContextKind::Expr);
|
||||
|
||||
// If we are parsing a refutable pattern, check to see if this is the start
|
||||
// of a let/var/is pattern. If so, parse it to an UnresolvedPatternExpr and
|
||||
@@ -1806,7 +1806,7 @@ ParserResult<Expr> Parser::parseExprStringLiteral() {
|
||||
SyntaxContext->addTokenSyntax(Tok.getLoc());
|
||||
SyntaxContext->makeNode(SyntaxKind::StringLiteralExpr);
|
||||
SyntaxParsingContextChild LocalContext(SyntaxContext,
|
||||
SyntaxContextKind::Expr, Tok);
|
||||
SyntaxContextKind::Expr);
|
||||
|
||||
// FIXME: Avoid creating syntax nodes for string interpolation.
|
||||
LocalContext.disable();
|
||||
|
||||
Reference in New Issue
Block a user