mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Teach parseMatchingToken() to set a matched location even when it wasn't matched.
We were working around this in several different places, which was error-prone (see <rdar://problem/17479771>). This way, we always have usable left/right delimiter locations. Swift SVN r19292
This commit is contained in:
@@ -520,6 +520,8 @@ bool Parser::parseMatchingToken(tok K, SourceLoc &TokLoc, Diag<> ErrorDiag,
|
||||
}
|
||||
if (parseToken(K, TokLoc, ErrorDiag)) {
|
||||
diagnose(OtherLoc, OtherNote);
|
||||
|
||||
TokLoc = Tok.getLoc();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -588,7 +590,6 @@ Parser::parseList(tok RightK, SourceLoc LeftLoc, SourceLoc &RightLoc,
|
||||
|
||||
if (parseMatchingToken(RightK, RightLoc, ErrorDiag, LeftLoc)) {
|
||||
Status.setIsParseError();
|
||||
RightLoc = PreviousLoc.isValid()? PreviousLoc : Tok.getLoc();
|
||||
}
|
||||
|
||||
return Status;
|
||||
|
||||
Reference in New Issue
Block a user