Skip to content

Commit 44f1555

Browse files
committed
Revert "Refactor: Rename Parser::consumeToken, consumeLoc. Add consumeToken API."
This reverts commit 39bfc12.
1 parent c46c423 commit 44f1555

10 files changed

+448
-529
lines changed

include/swift/Parse/Parser.h

+11-12
Original file line numberDiff line numberDiff line change
@@ -321,10 +321,10 @@ class Parser {
321321
void restoreParserPosition(ParserPosition PP) {
322322
L->restoreState(PP.LS);
323323

324-
// We might be at tok::eof now, so ensure that consumeLoc()
324+
// We might be at tok::eof now, so ensure that consumeToken()
325325
// does not assert about lexing past eof.
326326
Tok = syntax::Token::unknown();
327-
consumeLoc();
327+
consumeToken();
328328

329329
PreviousLoc = PP.PreviousLoc;
330330
}
@@ -334,10 +334,10 @@ class Parser {
334334

335335
L->backtrackToState(PP.LS);
336336

337-
// We might be at tok::eof now, so ensure that consumeLoc()
337+
// We might be at tok::eof now, so ensure that consumeToken()
338338
// does not assert about lexing past eof.
339339
Tok = syntax::Token::unknown();
340-
consumeLoc();
340+
consumeToken();
341341

342342
PreviousLoc = PP.PreviousLoc;
343343
}
@@ -386,22 +386,21 @@ class Parser {
386386
//===--------------------------------------------------------------------===//
387387
// Utilities
388388

389-
/// \brief Return the next token that will be installed by \c consumeLoc.
389+
/// \brief Return the next token that will be installed by \c consumeToken.
390390
const syntax::Token &peekToken();
391391

392-
syntax::Token consumeToken();
393-
SourceLoc consumeLoc();
394-
SourceLoc consumeLoc(tok K) {
392+
SourceLoc consumeToken();
393+
SourceLoc consumeToken(tok K) {
395394
assert(Tok.is(K) && "Consuming wrong token kind");
396-
return consumeLoc();
395+
return consumeToken();
397396
}
398397

399398
SourceLoc consumeIdentifier(Identifier *Result = nullptr) {
400399
assert(Tok.isAny(tok::identifier, tok::kw_self,
401400
tok::kw_Self, tok::kw_throws));
402401
if (Result)
403402
*Result = Context.getIdentifier(Tok.getText().str());
404-
return consumeLoc();
403+
return consumeToken();
405404
}
406405

407406
/// \brief Retrieve the location just past the end of the previous
@@ -412,15 +411,15 @@ class Parser {
412411
/// return true. Otherwise, return false without consuming it.
413412
bool consumeIf(tok K) {
414413
if (Tok.isNot(K)) return false;
415-
consumeLoc(K);
414+
consumeToken(K);
416415
return true;
417416
}
418417

419418
/// \brief If the current token is the specified kind, consume it and
420419
/// return true. Otherwise, return false without consuming it.
421420
bool consumeIf(tok K, SourceLoc &consumedLoc) {
422421
if (Tok.isNot(K)) return false;
423-
consumedLoc = consumeLoc(K);
422+
consumedLoc = consumeToken(K);
424423
return true;
425424
}
426425

include/swift/Syntax/RawSyntax.h

-76
This file was deleted.

0 commit comments

Comments
 (0)