Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1372)

Unified Diff: pkg/analyzer/lib/src/generated/parser.dart

Issue 786653002: Rename method (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/parser.dart
diff --git a/pkg/analyzer/lib/src/generated/parser.dart b/pkg/analyzer/lib/src/generated/parser.dart
index 4cefa67097029ca9d2d03a08ee37e6c8f9039b1d..3641626c4eb38cf219126047a202e974dcf5d714 100644
--- a/pkg/analyzer/lib/src/generated/parser.dart
+++ b/pkg/analyzer/lib/src/generated/parser.dart
@@ -2328,21 +2328,20 @@ class Parser {
*/
Parser(this._source, this._errorListener);
+ void set currentToken(Token currentToken) {
+ this._currentToken = currentToken;
+ }
+
/**
- * Advance to the next token in the token stream, making it the new current token.
- *
- * @return the token that was current before this method was invoked
+ * Advance to the next token in the token stream, making it the new current
+ * token and return the token that was current before this method was invoked.
*/
- Token get andAdvance {
+ Token getAndAdvance() {
Token token = _currentToken;
_advance();
return token;
}
- void set currentToken(Token currentToken) {
- this._currentToken = currentToken;
- }
-
/**
* Return `true` if the current token is the first token of a return type that is followed
* by an identifier, possibly followed by a list of type parameters, followed by a
@@ -2412,7 +2411,7 @@ class Parser {
Token period = null;
SimpleIdentifier constructorName = null;
if (_matches(TokenType.PERIOD)) {
- period = andAdvance;
+ period = getAndAdvance();
constructorName = parseSimpleIdentifier();
}
ArgumentList arguments = null;
@@ -2466,7 +2465,7 @@ class Parser {
Token leftParenthesis = _expect(TokenType.OPEN_PAREN);
List<Expression> arguments = new List<Expression>();
if (_matches(TokenType.CLOSE_PAREN)) {
- return new ArgumentList(leftParenthesis, arguments, andAdvance);
+ return new ArgumentList(leftParenthesis, arguments, getAndAdvance());
}
//
// Even though unnamed arguments must all appear before any named arguments,
@@ -2523,12 +2522,12 @@ class Parser {
Expression expression;
if (_matchesKeyword(Keyword.SUPER) &&
_tokenMatches(_peek(), TokenType.BAR)) {
- expression = new SuperExpression(andAdvance);
+ expression = new SuperExpression(getAndAdvance());
} else {
expression = _parseBitwiseXorExpression();
}
while (_matches(TokenType.BAR)) {
- Token operator = andAdvance;
+ Token operator = getAndAdvance();
expression =
new BinaryExpression(expression, operator, _parseBitwiseXorExpression());
}
@@ -2687,7 +2686,7 @@ class Parser {
_reportErrorForToken(ParserErrorCode.CLASS_IN_CLASS, _peek());
// TODO(brianwilkerson) We don't currently have any way to capture the
// class that was parsed.
- _parseClassDeclaration(commentAndMetadata, andAdvance);
+ _parseClassDeclaration(commentAndMetadata, getAndAdvance());
return null;
} else if (_isOperator(_currentToken)) {
//
@@ -2755,7 +2754,7 @@ class Parser {
_validateModifiersForConstructor(modifiers),
modifiers.factoryKeyword,
parseSimpleIdentifier(),
- andAdvance,
+ getAndAdvance(),
parseSimpleIdentifier(),
parseFormalParameterList());
} else if (_tokenMatches(_peek(), TokenType.OPEN_PAREN)) {
@@ -2800,7 +2799,7 @@ class Parser {
_reportErrorForCurrentToken(ParserErrorCode.TYPEDEF_IN_CLASS);
// TODO(brianwilkerson) We don't currently have any way to capture the
// function type alias that was parsed.
- _parseFunctionTypeAlias(commentAndMetadata, andAdvance);
+ _parseFunctionTypeAlias(commentAndMetadata, getAndAdvance());
return null;
}
TypeName type = parseTypeName();
@@ -2923,7 +2922,7 @@ class Parser {
*/
Combinator parseCombinator() {
if (_matchesString(_SHOW) || _matchesString(_HIDE)) {
- Token keyword = andAdvance;
+ Token keyword = getAndAdvance();
List<SimpleIdentifier> names = _parseIdentifierList();
if (keyword.lexeme == _SHOW) {
return new ShowCombinator(keyword, names);
@@ -2978,7 +2977,7 @@ class Parser {
Token firstToken = _currentToken;
ScriptTag scriptTag = null;
if (_matches(TokenType.SCRIPT_TAG)) {
- scriptTag = new ScriptTag(andAdvance);
+ scriptTag = new ScriptTag(getAndAdvance());
}
//
// Even though all directives must appear before declarations and must occur
@@ -3103,7 +3102,7 @@ class Parser {
if (!_matches(TokenType.QUESTION)) {
return condition;
}
- Token question = andAdvance;
+ Token question = getAndAdvance();
Expression thenExpression = parseExpressionWithoutCascade();
Token colon = _expect(TokenType.COLON);
Expression elseExpression = parseExpressionWithoutCascade();
@@ -3130,7 +3129,7 @@ class Parser {
Token period = null;
SimpleIdentifier name = null;
if (_matches(TokenType.PERIOD)) {
- period = andAdvance;
+ period = getAndAdvance();
name = parseSimpleIdentifier();
}
return new ConstructorName(type, period, name);
@@ -3213,7 +3212,7 @@ class Parser {
}
return new CascadeExpression(expression, cascadeSections);
} else if (tokenType.isAssignmentOperator) {
- Token operator = andAdvance;
+ Token operator = getAndAdvance();
_ensureAssignable(expression);
return new AssignmentExpression(expression, operator, parseExpression2());
}
@@ -3246,7 +3245,7 @@ class Parser {
//
Expression expression = parseConditionalExpression();
if (_currentToken.type.isAssignmentOperator) {
- Token operator = andAdvance;
+ Token operator = getAndAdvance();
_ensureAssignable(expression);
expression = new AssignmentExpression(
expression,
@@ -3305,7 +3304,7 @@ class Parser {
null,
null,
null,
- andAdvance);
+ getAndAdvance());
}
//
// Even though it is invalid to have default parameters outside of brackets,
@@ -3361,7 +3360,7 @@ class Parser {
_reportErrorForCurrentToken(ParserErrorCode.MIXED_PARAMETER_GROUPS);
reportedMixedGroups = true;
}
- leftSquareBracket = andAdvance;
+ leftSquareBracket = getAndAdvance();
currentParameters = positionalParameters;
kind = ParameterKind.POSITIONAL;
} else if (_matches(TokenType.OPEN_CURLY_BRACKET)) {
@@ -3375,7 +3374,7 @@ class Parser {
_reportErrorForCurrentToken(ParserErrorCode.MIXED_PARAMETER_GROUPS);
reportedMixedGroups = true;
}
- leftCurlyBracket = andAdvance;
+ leftCurlyBracket = getAndAdvance();
currentParameters = namedParameters;
kind = ParameterKind.NAMED;
}
@@ -3396,7 +3395,7 @@ class Parser {
// TODO(brianwilkerson) Improve the detection and reporting of missing and
// mismatched delimiters.
if (_matches(TokenType.CLOSE_SQUARE_BRACKET)) {
- rightSquareBracket = andAdvance;
+ rightSquareBracket = getAndAdvance();
currentParameters = normalParameters;
if (leftSquareBracket == null) {
if (leftCurlyBracket != null) {
@@ -3413,7 +3412,7 @@ class Parser {
}
kind = ParameterKind.REQUIRED;
} else if (_matches(TokenType.CLOSE_CURLY_BRACKET)) {
- rightCurlyBracket = andAdvance;
+ rightCurlyBracket = getAndAdvance();
currentParameters = normalParameters;
if (leftCurlyBracket == null) {
if (leftSquareBracket != null) {
@@ -3550,7 +3549,7 @@ class Parser {
Expression parseLogicalOrExpression() {
Expression expression = _parseLogicalAndExpression();
while (_matches(TokenType.BAR_BAR)) {
- Token operator = andAdvance;
+ Token operator = getAndAdvance();
expression =
new BinaryExpression(expression, operator, _parseLogicalAndExpression());
}
@@ -3601,7 +3600,7 @@ class Parser {
Token thisKeyword = null;
Token period = null;
if (_matchesKeyword(Keyword.THIS)) {
- thisKeyword = andAdvance;
+ thisKeyword = getAndAdvance();
period = _expect(TokenType.PERIOD);
}
SimpleIdentifier identifier = parseSimpleIdentifier();
@@ -3676,7 +3675,7 @@ class Parser {
if (!_matches(TokenType.PERIOD)) {
return qualifier;
}
- Token period = andAdvance;
+ Token period = getAndAdvance();
SimpleIdentifier qualified = parseSimpleIdentifier();
return new PrefixedIdentifier(qualifier, period, qualified);
}
@@ -3694,7 +3693,7 @@ class Parser {
*/
TypeName parseReturnType() {
if (_matchesKeyword(Keyword.VOID)) {
- return new TypeName(new SimpleIdentifier(andAdvance), null);
+ return new TypeName(new SimpleIdentifier(getAndAdvance()), null);
} else {
return parseTypeName();
}
@@ -3712,7 +3711,7 @@ class Parser {
*/
SimpleIdentifier parseSimpleIdentifier() {
if (_matchesIdentifier()) {
- return new SimpleIdentifier(andAdvance);
+ return new SimpleIdentifier(getAndAdvance());
}
_reportErrorForCurrentToken(ParserErrorCode.MISSING_IDENTIFIER);
return _createSyntheticIdentifier();
@@ -3792,7 +3791,7 @@ class Parser {
StringLiteral parseStringLiteral() {
List<StringLiteral> strings = new List<StringLiteral>();
while (_matches(TokenType.STRING)) {
- Token string = andAdvance;
+ Token string = getAndAdvance();
if (_matches(TokenType.STRING_INTERPOLATION_EXPRESSION) ||
_matches(TokenType.STRING_INTERPOLATION_IDENTIFIER)) {
strings.add(_parseStringInterpolation(string));
@@ -3851,7 +3850,7 @@ class Parser {
Identifier typeName;
if (_matchesKeyword(Keyword.VAR)) {
_reportErrorForCurrentToken(ParserErrorCode.VAR_AS_TYPE_NAME);
- typeName = new SimpleIdentifier(andAdvance);
+ typeName = new SimpleIdentifier(getAndAdvance());
} else if (_matchesIdentifier()) {
typeName = parsePrefixedIdentifier();
} else {
@@ -3879,7 +3878,7 @@ class Parser {
CommentAndMetadata commentAndMetadata = _parseCommentAndMetadata();
SimpleIdentifier name = parseSimpleIdentifier();
if (_matchesKeyword(Keyword.EXTENDS)) {
- Token keyword = andAdvance;
+ Token keyword = getAndAdvance();
TypeName bound = parseTypeName();
return new TypeParameter(
commentAndMetadata.comment,
@@ -4175,7 +4174,7 @@ class Parser {
*/
Token _expect(TokenType type) {
if (_matches(type)) {
- return andAdvance;
+ return getAndAdvance();
}
// Remove uses of this method in favor of matches?
// Pass in the error code to use to report the error?
@@ -4185,7 +4184,7 @@ class Parser {
ParserErrorCode.UNEXPECTED_TOKEN,
[_currentToken.lexeme]);
_advance();
- return andAdvance;
+ return getAndAdvance();
}
_reportErrorForToken(
ParserErrorCode.EXPECTED_TOKEN,
@@ -4207,7 +4206,7 @@ class Parser {
*/
Token _expectGt() {
if (_matchesGt()) {
- return andAdvance;
+ return getAndAdvance();
}
_reportErrorForCurrentToken(
ParserErrorCode.EXPECTED_TOKEN,
@@ -4224,7 +4223,7 @@ class Parser {
*/
Token _expectKeyword(Keyword keyword) {
if (_matchesKeyword(keyword)) {
- return andAdvance;
+ return getAndAdvance();
}
// Remove uses of this method in favor of matches?
// Pass in the error code to use to report the error?
@@ -4242,7 +4241,7 @@ class Parser {
*/
Token _expectSemicolon() {
if (_matches(TokenType.SEMICOLON)) {
- return andAdvance;
+ return getAndAdvance();
} else {
_reportErrorForToken(
ParserErrorCode.EXPECTED_TOKEN,
@@ -4731,12 +4730,12 @@ class Parser {
Expression expression;
if (_matchesKeyword(Keyword.SUPER) &&
_currentToken.next.type.isAdditiveOperator) {
- expression = new SuperExpression(andAdvance);
+ expression = new SuperExpression(getAndAdvance());
} else {
expression = _parseMultiplicativeExpression();
}
while (_currentToken.type.isAdditiveOperator) {
- Token operator = andAdvance;
+ Token operator = getAndAdvance();
expression =
new BinaryExpression(expression, operator, _parseMultiplicativeExpression());
}
@@ -4800,7 +4799,7 @@ class Parser {
*/
Expression _parseAssignableExpression(bool primaryAllowed) {
if (_matchesKeyword(Keyword.SUPER)) {
- return _parseAssignableSelector(new SuperExpression(andAdvance), false);
+ return _parseAssignableSelector(new SuperExpression(getAndAdvance()), false);
}
//
// A primary expression can start with an identifier. We resolve the
@@ -4871,7 +4870,7 @@ class Parser {
*/
Expression _parseAssignableSelector(Expression prefix, bool optional) {
if (_matches(TokenType.OPEN_SQUARE_BRACKET)) {
- Token leftBracket = andAdvance;
+ Token leftBracket = getAndAdvance();
bool wasInInitializer = _inInitializer;
_inInitializer = false;
try {
@@ -4886,7 +4885,7 @@ class Parser {
_inInitializer = wasInInitializer;
}
} else if (_matches(TokenType.PERIOD)) {
- Token period = andAdvance;
+ Token period = getAndAdvance();
return new PropertyAccess(prefix, period, parseSimpleIdentifier());
} else {
if (!optional) {
@@ -4909,7 +4908,7 @@ class Parser {
* @return the await expression that was parsed
*/
AwaitExpression _parseAwaitExpression() {
- Token awaitToken = andAdvance;
+ Token awaitToken = getAndAdvance();
Expression expression = _parseUnaryExpression();
return new AwaitExpression(awaitToken, expression);
}
@@ -4929,12 +4928,12 @@ class Parser {
Expression expression;
if (_matchesKeyword(Keyword.SUPER) &&
_tokenMatches(_peek(), TokenType.AMPERSAND)) {
- expression = new SuperExpression(andAdvance);
+ expression = new SuperExpression(getAndAdvance());
} else {
expression = _parseShiftExpression();
}
while (_matches(TokenType.AMPERSAND)) {
- Token operator = andAdvance;
+ Token operator = getAndAdvance();
expression =
new BinaryExpression(expression, operator, _parseShiftExpression());
}
@@ -4956,12 +4955,12 @@ class Parser {
Expression expression;
if (_matchesKeyword(Keyword.SUPER) &&
_tokenMatches(_peek(), TokenType.CARET)) {
- expression = new SuperExpression(andAdvance);
+ expression = new SuperExpression(getAndAdvance());
} else {
expression = _parseBitwiseAndExpression();
}
while (_matches(TokenType.CARET)) {
- Token operator = andAdvance;
+ Token operator = getAndAdvance();
expression =
new BinaryExpression(expression, operator, _parseBitwiseAndExpression());
}
@@ -5015,7 +5014,7 @@ class Parser {
if (_matchesIdentifier()) {
functionName = parseSimpleIdentifier();
} else if (_currentToken.type == TokenType.OPEN_SQUARE_BRACKET) {
- Token leftBracket = andAdvance;
+ Token leftBracket = getAndAdvance();
bool wasInInitializer = _inInitializer;
_inInitializer = false;
try {
@@ -5083,7 +5082,7 @@ class Parser {
}
}
if (_currentToken.type.isAssignmentOperator) {
- Token operator = andAdvance;
+ Token operator = getAndAdvance();
_ensureAssignable(expression);
expression = new AssignmentExpression(
expression,
@@ -5320,13 +5319,13 @@ class Parser {
}
Token semicolon;
if (_matches(TokenType.SEMICOLON)) {
- semicolon = andAdvance;
+ semicolon = getAndAdvance();
} else {
if (_matches(TokenType.OPEN_CURLY_BRACKET)) {
_reportErrorForCurrentToken(
ParserErrorCode.EXPECTED_TOKEN,
[TokenType.SEMICOLON.lexeme]);
- Token leftBracket = andAdvance;
+ Token leftBracket = getAndAdvance();
_parseClassMembers(className.name, _getEndToken(leftBracket));
_expect(TokenType.CLOSE_CURLY_BRACKET);
} else {
@@ -5715,7 +5714,7 @@ class Parser {
_reportErrorForToken(ParserErrorCode.EXPECTED_EXECUTABLE, _currentToken);
Token semicolon;
if (_matches(TokenType.SEMICOLON)) {
- semicolon = andAdvance;
+ semicolon = getAndAdvance();
} else {
semicolon = _createSyntheticToken(TokenType.SEMICOLON);
}
@@ -5778,7 +5777,7 @@ class Parser {
Token separator = null;
List<ConstructorInitializer> initializers = null;
if (_matches(TokenType.COLON)) {
- separator = andAdvance;
+ separator = getAndAdvance();
initializers = new List<ConstructorInitializer>();
do {
if (_matchesKeyword(Keyword.THIS)) {
@@ -5810,7 +5809,7 @@ class Parser {
ConstructorName redirectedConstructor = null;
FunctionBody body;
if (_matches(TokenType.EQ)) {
- separator = andAdvance;
+ separator = getAndAdvance();
redirectedConstructor = parseConstructorName();
body = new EmptyFunctionBody(_expect(TokenType.SEMICOLON));
if (factoryKeyword == null) {
@@ -5873,13 +5872,13 @@ class Parser {
Token keyword = null;
Token period = null;
if (_matchesKeyword(Keyword.THIS)) {
- keyword = andAdvance;
+ keyword = getAndAdvance();
period = _expect(TokenType.PERIOD);
}
SimpleIdentifier fieldName = parseSimpleIdentifier();
Token equals = null;
if (_matches(TokenType.EQ)) {
- equals = andAdvance;
+ equals = getAndAdvance();
} else if (!_matchesKeyword(Keyword.THIS) &&
!_matchesKeyword(Keyword.SUPER) &&
!_matches(TokenType.OPEN_CURLY_BRACKET) &&
@@ -6001,7 +6000,7 @@ class Parser {
Token firstToken = _currentToken;
ScriptTag scriptTag = null;
if (_matches(TokenType.SCRIPT_TAG)) {
- scriptTag = new ScriptTag(andAdvance);
+ scriptTag = new ScriptTag(getAndAdvance());
}
List<Directive> directives = new List<Directive>();
while (!_matches(TokenType.EOF)) {
@@ -6121,7 +6120,7 @@ class Parser {
*
* @return the empty statement that was parsed
*/
- Statement _parseEmptyStatement() => new EmptyStatement(andAdvance);
+ Statement _parseEmptyStatement() => new EmptyStatement(getAndAdvance());
EnumConstantDeclaration _parseEnumConstantDeclaration() {
CommentAndMetadata commentAndMetadata = _parseCommentAndMetadata();
@@ -6204,13 +6203,13 @@ class Parser {
Expression expression;
if (_matchesKeyword(Keyword.SUPER) &&
_currentToken.next.type.isEqualityOperator) {
- expression = new SuperExpression(andAdvance);
+ expression = new SuperExpression(getAndAdvance());
} else {
expression = _parseRelationalExpression();
}
bool leftEqualityExpression = false;
while (_currentToken.type.isEqualityOperator) {
- Token operator = andAdvance;
+ Token operator = getAndAdvance();
if (leftEqualityExpression) {
_reportErrorForNode(
ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND,
@@ -6285,12 +6284,12 @@ class Parser {
Token keyword = null;
TypeName type = null;
if (_matchesKeyword(Keyword.FINAL) || _matchesKeyword(Keyword.CONST)) {
- keyword = andAdvance;
+ keyword = getAndAdvance();
if (_isTypedIdentifier(_currentToken)) {
type = parseTypeName();
}
} else if (_matchesKeyword(Keyword.VAR)) {
- keyword = andAdvance;
+ keyword = getAndAdvance();
} else {
if (_isTypedIdentifier(_currentToken)) {
type = parseReturnType();
@@ -6321,7 +6320,7 @@ class Parser {
FormalParameter _parseFormalParameter(ParameterKind kind) {
NormalFormalParameter parameter = parseNormalFormalParameter();
if (_matches(TokenType.EQ)) {
- Token seperator = andAdvance;
+ Token seperator = getAndAdvance();
Expression defaultValue = parseExpression2();
if (kind == ParameterKind.NAMED) {
_reportErrorForToken(
@@ -6338,7 +6337,7 @@ class Parser {
seperator,
defaultValue);
} else if (_matches(TokenType.COLON)) {
- Token seperator = andAdvance;
+ Token seperator = getAndAdvance();
Expression defaultValue = parseExpression2();
if (kind == ParameterKind.POSITIONAL) {
_reportErrorForToken(
@@ -6385,7 +6384,7 @@ class Parser {
try {
Token awaitKeyword = null;
if (_matchesString(_AWAIT)) {
- awaitKeyword = andAdvance;
+ awaitKeyword = getAndAdvance();
}
Token forKeyword = _expectKeyword(Keyword.FOR);
Token leftParenthesis = _expect(TokenType.OPEN_PAREN);
@@ -6450,7 +6449,7 @@ class Parser {
identifier = variable.name;
}
}
- Token inKeyword = andAdvance;
+ Token inKeyword = getAndAdvance();
Expression iterator = parseExpression2();
Token rightParenthesis = _expect(TokenType.CLOSE_PAREN);
Statement body = parseStatement2();
@@ -6543,9 +6542,9 @@ class Parser {
if (!mayBeEmpty) {
_reportErrorForCurrentToken(emptyErrorCode);
}
- return new EmptyFunctionBody(andAdvance);
+ return new EmptyFunctionBody(getAndAdvance());
} else if (_matchesString(_NATIVE)) {
- Token nativeToken = andAdvance;
+ Token nativeToken = getAndAdvance();
StringLiteral stringLiteral = null;
if (_matches(TokenType.STRING)) {
stringLiteral = parseStringLiteral();
@@ -6559,16 +6558,16 @@ class Parser {
Token star = null;
if (_parseAsync) {
if (_matchesString(ASYNC)) {
- keyword = andAdvance;
+ keyword = getAndAdvance();
if (_matches(TokenType.STAR)) {
- star = andAdvance;
+ star = getAndAdvance();
_inGenerator = true;
}
_inAsync = true;
} else if (_matchesString(SYNC)) {
- keyword = andAdvance;
+ keyword = getAndAdvance();
if (_matches(TokenType.STAR)) {
- star = andAdvance;
+ star = getAndAdvance();
_inGenerator = true;
}
}
@@ -6584,11 +6583,11 @@ class Parser {
star);
}
}
- Token functionDefinition = andAdvance;
+ Token functionDefinition = getAndAdvance();
if (_matchesKeyword(Keyword.RETURN)) {
_reportErrorForToken(
ParserErrorCode.UNEXPECTED_TOKEN,
- andAdvance);
+ getAndAdvance());
}
Expression expression = parseExpression2();
Token semicolon = null;
@@ -6655,11 +6654,11 @@ class Parser {
bool isGetter = false;
if (_matchesKeyword(Keyword.GET) &&
!_tokenMatches(_peek(), TokenType.OPEN_PAREN)) {
- keyword = andAdvance;
+ keyword = getAndAdvance();
isGetter = true;
} else if (_matchesKeyword(Keyword.SET) &&
!_tokenMatches(_peek(), TokenType.OPEN_PAREN)) {
- keyword = andAdvance;
+ keyword = getAndAdvance();
}
SimpleIdentifier name = parseSimpleIdentifier();
FormalParameterList parameters = null;
@@ -6915,7 +6914,7 @@ class Parser {
Token elseKeyword = null;
Statement elseStatement = null;
if (_matchesKeyword(Keyword.ELSE)) {
- elseKeyword = andAdvance;
+ elseKeyword = getAndAdvance();
elseStatement = parseStatement2();
}
return new IfStatement(
@@ -6947,7 +6946,7 @@ class Parser {
SimpleIdentifier prefix = null;
if (_matchesKeyword(Keyword.DEFERRED)) {
if (_parseDeferredLibraries) {
- deferredToken = andAdvance;
+ deferredToken = getAndAdvance();
} else {
_reportErrorForCurrentToken(
ParserErrorCode.DEFERRED_IMPORTS_NOT_SUPPORTED);
@@ -6955,7 +6954,7 @@ class Parser {
}
}
if (_matchesKeyword(Keyword.AS)) {
- asToken = andAdvance;
+ asToken = getAndAdvance();
prefix = parseSimpleIdentifier();
} else if (deferredToken != null) {
_reportErrorForCurrentToken(
@@ -7129,7 +7128,7 @@ class Parser {
typeArguments,
leftBracket,
null,
- andAdvance);
+ getAndAdvance());
}
bool wasInInitializer = _inInitializer;
_inInitializer = false;
@@ -7143,7 +7142,7 @@ class Parser {
typeArguments,
leftBracket,
elements,
- andAdvance);
+ getAndAdvance());
}
elements.add(parseExpression2());
}
@@ -7205,7 +7204,7 @@ class Parser {
Expression _parseLogicalAndExpression() {
Expression expression = _parseEqualityExpression();
while (_matches(TokenType.AMPERSAND_AMPERSAND)) {
- Token operator = andAdvance;
+ Token operator = getAndAdvance();
expression =
new BinaryExpression(expression, operator, _parseEqualityExpression());
}
@@ -7235,7 +7234,7 @@ class Parser {
typeArguments,
leftBracket,
entries,
- andAdvance);
+ getAndAdvance());
}
bool wasInInitializer = _inInitializer;
_inInitializer = false;
@@ -7248,7 +7247,7 @@ class Parser {
typeArguments,
leftBracket,
entries,
- andAdvance);
+ getAndAdvance());
}
entries.add(parseMapLiteralEntry());
}
@@ -7386,7 +7385,7 @@ class Parser {
[_currentToken.lexeme]);
_advance();
} else {
- modifiers.abstractKeyword = andAdvance;
+ modifiers.abstractKeyword = getAndAdvance();
}
} else if (_matchesKeyword(Keyword.CONST)) {
if (modifiers.constKeyword != null) {
@@ -7395,7 +7394,7 @@ class Parser {
[_currentToken.lexeme]);
_advance();
} else {
- modifiers.constKeyword = andAdvance;
+ modifiers.constKeyword = getAndAdvance();
}
} else if (_matchesKeyword(Keyword.EXTERNAL) &&
!_tokenMatches(_peek(), TokenType.PERIOD) &&
@@ -7406,7 +7405,7 @@ class Parser {
[_currentToken.lexeme]);
_advance();
} else {
- modifiers.externalKeyword = andAdvance;
+ modifiers.externalKeyword = getAndAdvance();
}
} else if (_matchesKeyword(Keyword.FACTORY) &&
!_tokenMatches(_peek(), TokenType.PERIOD) &&
@@ -7417,7 +7416,7 @@ class Parser {
[_currentToken.lexeme]);
_advance();
} else {
- modifiers.factoryKeyword = andAdvance;
+ modifiers.factoryKeyword = getAndAdvance();
}
} else if (_matchesKeyword(Keyword.FINAL)) {
if (modifiers.finalKeyword != null) {
@@ -7426,7 +7425,7 @@ class Parser {
[_currentToken.lexeme]);
_advance();
} else {
- modifiers.finalKeyword = andAdvance;
+ modifiers.finalKeyword = getAndAdvance();
}
} else if (_matchesKeyword(Keyword.STATIC) &&
!_tokenMatches(_peek(), TokenType.PERIOD) &&
@@ -7437,7 +7436,7 @@ class Parser {
[_currentToken.lexeme]);
_advance();
} else {
- modifiers.staticKeyword = andAdvance;
+ modifiers.staticKeyword = getAndAdvance();
}
} else if (_matchesKeyword(Keyword.VAR)) {
if (modifiers.varKeyword != null) {
@@ -7446,7 +7445,7 @@ class Parser {
[_currentToken.lexeme]);
_advance();
} else {
- modifiers.varKeyword = andAdvance;
+ modifiers.varKeyword = getAndAdvance();
}
} else {
progress = false;
@@ -7470,12 +7469,12 @@ class Parser {
Expression expression;
if (_matchesKeyword(Keyword.SUPER) &&
_currentToken.next.type.isMultiplicativeOperator) {
- expression = new SuperExpression(andAdvance);
+ expression = new SuperExpression(getAndAdvance());
} else {
expression = _parseUnaryExpression();
}
while (_currentToken.type.isMultiplicativeOperator) {
- Token operator = andAdvance;
+ Token operator = getAndAdvance();
expression =
new BinaryExpression(expression, operator, _parseUnaryExpression());
}
@@ -7493,7 +7492,7 @@ class Parser {
* @return the class native clause that was parsed
*/
NativeClause _parseNativeClause() {
- Token keyword = andAdvance;
+ Token keyword = getAndAdvance();
StringLiteral name = parseStringLiteral();
return new NativeClause(keyword, name);
}
@@ -7718,7 +7717,7 @@ class Parser {
Token externalKeyword, TypeName returnType) {
Token operatorKeyword;
if (_matchesKeyword(Keyword.OPERATOR)) {
- operatorKeyword = andAdvance;
+ operatorKeyword = getAndAdvance();
} else {
_reportErrorForToken(
ParserErrorCode.MISSING_KEYWORD_OPERATOR,
@@ -7730,7 +7729,7 @@ class Parser {
ParserErrorCode.NON_USER_DEFINABLE_OPERATOR,
[_currentToken.lexeme]);
}
- SimpleIdentifier name = new SimpleIdentifier(andAdvance);
+ SimpleIdentifier name = new SimpleIdentifier(getAndAdvance());
if (_matches(TokenType.EQ)) {
Token previous = _currentToken.previous;
if ((_tokenMatches(previous, TokenType.EQ_EQ) ||
@@ -7803,7 +7802,7 @@ class Parser {
Directive _parsePartDirective(CommentAndMetadata commentAndMetadata) {
Token partKeyword = _expectKeyword(Keyword.PART);
if (_matchesString(_OF)) {
- Token ofKeyword = andAdvance;
+ Token ofKeyword = getAndAdvance();
LibraryIdentifier libraryName = _parseLibraryName(
ParserErrorCode.MISSING_NAME_IN_PART_OF_DIRECTIVE,
ofKeyword);
@@ -7871,7 +7870,7 @@ class Parser {
return operand;
}
_ensureAssignable(operand);
- Token operator = andAdvance;
+ Token operator = getAndAdvance();
return new PostfixExpression(operand, operator);
}
@@ -7904,17 +7903,17 @@ class Parser {
*/
Expression _parsePrimaryExpression() {
if (_matchesKeyword(Keyword.THIS)) {
- return new ThisExpression(andAdvance);
+ return new ThisExpression(getAndAdvance());
} else if (_matchesKeyword(Keyword.SUPER)) {
- return _parseAssignableSelector(new SuperExpression(andAdvance), false);
+ return _parseAssignableSelector(new SuperExpression(getAndAdvance()), false);
} else if (_matchesKeyword(Keyword.NULL)) {
- return new NullLiteral(andAdvance);
+ return new NullLiteral(getAndAdvance());
} else if (_matchesKeyword(Keyword.FALSE)) {
- return new BooleanLiteral(andAdvance, false);
+ return new BooleanLiteral(getAndAdvance(), false);
} else if (_matchesKeyword(Keyword.TRUE)) {
- return new BooleanLiteral(andAdvance, true);
+ return new BooleanLiteral(getAndAdvance(), true);
} else if (_matches(TokenType.DOUBLE)) {
- Token token = andAdvance;
+ Token token = getAndAdvance();
double value = 0.0;
try {
value = double.parse(token.lexeme);
@@ -7923,7 +7922,7 @@ class Parser {
}
return new DoubleLiteral(token, value);
} else if (_matches(TokenType.HEXADECIMAL)) {
- Token token = andAdvance;
+ Token token = getAndAdvance();
int value = null;
try {
value = int.parse(token.lexeme.substring(2), radix: 16);
@@ -7932,7 +7931,7 @@ class Parser {
}
return new IntegerLiteral(token, value);
} else if (_matches(TokenType.INT)) {
- Token token = andAdvance;
+ Token token = getAndAdvance();
int value = null;
try {
value = int.parse(token.lexeme);
@@ -7968,7 +7967,7 @@ class Parser {
if (_isFunctionExpression(_currentToken)) {
return parseFunctionExpression();
}
- Token leftParenthesis = andAdvance;
+ Token leftParenthesis = getAndAdvance();
bool wasInInitializer = _inInitializer;
_inInitializer = false;
try {
@@ -8024,7 +8023,7 @@ class Parser {
Token period = null;
SimpleIdentifier constructorName = null;
if (_matches(TokenType.PERIOD)) {
- period = andAdvance;
+ period = getAndAdvance();
constructorName = parseSimpleIdentifier();
}
ArgumentList argumentList = parseArgumentList();
@@ -8049,26 +8048,26 @@ class Parser {
Expression _parseRelationalExpression() {
if (_matchesKeyword(Keyword.SUPER) &&
_currentToken.next.type.isRelationalOperator) {
- Expression expression = new SuperExpression(andAdvance);
- Token operator = andAdvance;
+ Expression expression = new SuperExpression(getAndAdvance());
+ Token operator = getAndAdvance();
expression =
new BinaryExpression(expression, operator, parseBitwiseOrExpression());
return expression;
}
Expression expression = parseBitwiseOrExpression();
if (_matchesKeyword(Keyword.AS)) {
- Token asOperator = andAdvance;
+ Token asOperator = getAndAdvance();
expression = new AsExpression(expression, asOperator, parseTypeName());
} else if (_matchesKeyword(Keyword.IS)) {
- Token isOperator = andAdvance;
+ Token isOperator = getAndAdvance();
Token notOperator = null;
if (_matches(TokenType.BANG)) {
- notOperator = andAdvance;
+ notOperator = getAndAdvance();
}
expression =
new IsExpression(expression, isOperator, notOperator, parseTypeName());
} else if (_currentToken.type.isRelationalOperator) {
- Token operator = andAdvance;
+ Token operator = getAndAdvance();
expression =
new BinaryExpression(expression, operator, parseBitwiseOrExpression());
}
@@ -8101,7 +8100,7 @@ class Parser {
Statement _parseReturnStatement() {
Token returnKeyword = _expectKeyword(Keyword.RETURN);
if (_matches(TokenType.SEMICOLON)) {
- return new ReturnStatement(returnKeyword, null, andAdvance);
+ return new ReturnStatement(returnKeyword, null, getAndAdvance());
}
Expression expression = parseExpression2();
Token semicolon = _expect(TokenType.SEMICOLON);
@@ -8168,12 +8167,12 @@ class Parser {
Expression expression;
if (_matchesKeyword(Keyword.SUPER) &&
_currentToken.next.type.isShiftOperator) {
- expression = new SuperExpression(andAdvance);
+ expression = new SuperExpression(getAndAdvance());
} else {
expression = _parseAdditiveExpression();
}
while (_currentToken.type.isShiftOperator) {
- Token operator = andAdvance;
+ Token operator = getAndAdvance();
expression =
new BinaryExpression(expression, operator, _parseAdditiveExpression());
}
@@ -8225,7 +8224,7 @@ class Parser {
_computeStringValue(string.lexeme, true, !hasMore)));
while (hasMore) {
if (_matches(TokenType.STRING_INTERPOLATION_EXPRESSION)) {
- Token openToken = andAdvance;
+ Token openToken = getAndAdvance();
bool wasInInitializer = _inInitializer;
_inInitializer = false;
try {
@@ -8237,17 +8236,17 @@ class Parser {
_inInitializer = wasInInitializer;
}
} else {
- Token openToken = andAdvance;
+ Token openToken = getAndAdvance();
Expression expression = null;
if (_matchesKeyword(Keyword.THIS)) {
- expression = new ThisExpression(andAdvance);
+ expression = new ThisExpression(getAndAdvance());
} else {
expression = parseSimpleIdentifier();
}
elements.add(new InterpolationExpression(openToken, expression, null));
}
if (_matches(TokenType.STRING)) {
- string = andAdvance;
+ string = getAndAdvance();
hasMore = _matches(TokenType.STRING_INTERPOLATION_EXPRESSION) ||
_matches(TokenType.STRING_INTERPOLATION_IDENTIFIER);
elements.add(
@@ -8276,7 +8275,7 @@ class Parser {
Token period = null;
SimpleIdentifier constructorName = null;
if (_matches(TokenType.PERIOD)) {
- period = andAdvance;
+ period = getAndAdvance();
constructorName = parseSimpleIdentifier();
}
ArgumentList argumentList = parseArgumentList();
@@ -8334,7 +8333,7 @@ class Parser {
labels.add(new Label(identifier, colon));
}
if (_matchesKeyword(Keyword.CASE)) {
- Token caseKeyword = andAdvance;
+ Token caseKeyword = getAndAdvance();
Expression caseExpression = parseExpression2();
Token colon = _expect(TokenType.COLON);
members.add(
@@ -8355,7 +8354,7 @@ class Parser {
ParserErrorCode.SWITCH_HAS_MULTIPLE_DEFAULT_CASES,
_peek());
}
- defaultKeyword = andAdvance;
+ defaultKeyword = getAndAdvance();
Token colon = _expect(TokenType.COLON);
members.add(
new SwitchDefault(labels, defaultKeyword, colon, _parseStatementList()));
@@ -8396,14 +8395,14 @@ class Parser {
* @return the symbol literal that was parsed
*/
SymbolLiteral _parseSymbolLiteral() {
- Token poundSign = andAdvance;
+ Token poundSign = getAndAdvance();
List<Token> components = new List<Token>();
if (_matchesIdentifier()) {
- components.add(andAdvance);
+ components.add(getAndAdvance());
while (_matches(TokenType.PERIOD)) {
_advance();
if (_matchesIdentifier()) {
- components.add(andAdvance);
+ components.add(getAndAdvance());
} else {
_reportErrorForCurrentToken(ParserErrorCode.MISSING_IDENTIFIER);
components.add(_createSyntheticToken(TokenType.IDENTIFIER));
@@ -8411,9 +8410,9 @@ class Parser {
}
}
} else if (_currentToken.isOperator) {
- components.add(andAdvance);
+ components.add(getAndAdvance());
} else if (_tokenMatchesKeyword(_currentToken, Keyword.VOID)) {
- components.add(andAdvance);
+ components.add(getAndAdvance());
} else {
_reportErrorForCurrentToken(ParserErrorCode.MISSING_IDENTIFIER);
components.add(_createSyntheticToken(TokenType.IDENTIFIER));
@@ -8494,7 +8493,7 @@ class Parser {
Token onKeyword = null;
TypeName exceptionType = null;
if (_matchesString(_ON)) {
- onKeyword = andAdvance;
+ onKeyword = getAndAdvance();
exceptionType = parseTypeName();
}
Token catchKeyword = null;
@@ -8504,11 +8503,11 @@ class Parser {
SimpleIdentifier stackTraceParameter = null;
Token rightParenthesis = null;
if (_matchesKeyword(Keyword.CATCH)) {
- catchKeyword = andAdvance;
+ catchKeyword = getAndAdvance();
leftParenthesis = _expect(TokenType.OPEN_PAREN);
exceptionParameter = parseSimpleIdentifier();
if (_matches(TokenType.COMMA)) {
- comma = andAdvance;
+ comma = getAndAdvance();
stackTraceParameter = parseSimpleIdentifier();
}
rightParenthesis = _expect(TokenType.CLOSE_PAREN);
@@ -8528,7 +8527,7 @@ class Parser {
}
Token finallyKeyword = null;
if (_matchesKeyword(Keyword.FINALLY)) {
- finallyKeyword = andAdvance;
+ finallyKeyword = getAndAdvance();
finallyClause = parseBlock();
} else {
if (catchClauses.isEmpty) {
@@ -8615,7 +8614,7 @@ class Parser {
if (_matches(TokenType.MINUS) ||
_matches(TokenType.BANG) ||
_matches(TokenType.TILDE)) {
- Token operator = andAdvance;
+ Token operator = getAndAdvance();
if (_matchesKeyword(Keyword.SUPER)) {
if (_tokenMatches(_peek(), TokenType.OPEN_SQUARE_BRACKET) ||
_tokenMatches(_peek(), TokenType.PERIOD)) {
@@ -8625,11 +8624,11 @@ class Parser {
// --> "prefixOperator 'super' assignableSelector selector*"
return new PrefixExpression(operator, _parseUnaryExpression());
}
- return new PrefixExpression(operator, new SuperExpression(andAdvance));
+ return new PrefixExpression(operator, new SuperExpression(getAndAdvance()));
}
return new PrefixExpression(operator, _parseUnaryExpression());
} else if (_currentToken.type.isIncrementOperator) {
- Token operator = andAdvance;
+ Token operator = getAndAdvance();
if (_matchesKeyword(Keyword.SUPER)) {
if (_tokenMatches(_peek(), TokenType.OPEN_SQUARE_BRACKET) ||
_tokenMatches(_peek(), TokenType.PERIOD)) {
@@ -8652,7 +8651,7 @@ class Parser {
operator.previous.setNext(firstOperator);
return new PrefixExpression(
firstOperator,
- new PrefixExpression(secondOperator, new SuperExpression(andAdvance)));
+ new PrefixExpression(secondOperator, new SuperExpression(getAndAdvance())));
} else {
// Invalid operator before 'super'
_reportErrorForCurrentToken(
@@ -8660,7 +8659,7 @@ class Parser {
[operator.lexeme]);
return new PrefixExpression(
operator,
- new SuperExpression(andAdvance));
+ new SuperExpression(getAndAdvance()));
}
}
return new PrefixExpression(operator, _parseAssignableExpression(false));
@@ -8741,7 +8740,7 @@ class Parser {
Token equals = null;
Expression initializer = null;
if (_matches(TokenType.EQ)) {
- equals = andAdvance;
+ equals = getAndAdvance();
initializer = parseExpression2();
}
return new VariableDeclaration(
@@ -8901,10 +8900,10 @@ class Parser {
* @return the yield statement that was parsed
*/
YieldStatement _parseYieldStatement() {
- Token yieldToken = andAdvance;
+ Token yieldToken = getAndAdvance();
Token star = null;
if (_matches(TokenType.STAR)) {
- star = andAdvance;
+ star = getAndAdvance();
}
Expression expression = parseExpression2();
Token semicolon = _expect(TokenType.SEMICOLON);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698