| 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 4e99c1be378465678fd7bc9becaeec36cf2b20ec..9647bf9e923e9753b8964be33a003cc632599579 100644
|
| --- a/pkg/analyzer/lib/src/generated/parser.dart
|
| +++ b/pkg/analyzer/lib/src/generated/parser.dart
|
| @@ -9,6 +9,7 @@ library engine.parser;
|
|
|
| import 'dart:collection';
|
| import 'java_core.dart';
|
| +import 'java_engine.dart';
|
| import 'instrumentation.dart';
|
| import 'error.dart';
|
| import 'source.dart';
|
| @@ -217,7 +218,7 @@ class IncrementalParseDispatcher implements ASTVisitor<ASTNode> {
|
|
|
| ASTNode visitAssertStatement(AssertStatement node) {
|
| if (identical(_oldNode, node.condition)) {
|
| - return _parser.parseExpression3();
|
| + return _parser.parseExpression4();
|
| }
|
| return notAChild(node);
|
| }
|
| @@ -231,7 +232,7 @@ class IncrementalParseDispatcher implements ASTVisitor<ASTNode> {
|
| throw new InsufficientContextException();
|
| } else if (identical(_oldNode, node.rightHandSide)) {
|
| if (isCascadeAllowed(node)) {
|
| - return _parser.parseExpression3();
|
| + return _parser.parseExpression4();
|
| }
|
| return _parser.parseExpressionWithoutCascade();
|
| }
|
| @@ -421,7 +422,7 @@ class IncrementalParseDispatcher implements ASTVisitor<ASTNode> {
|
| if (identical(_oldNode, node.parameter)) {
|
| return _parser.parseNormalFormalParameter();
|
| } else if (identical(_oldNode, node.defaultValue)) {
|
| - return _parser.parseExpression3();
|
| + return _parser.parseExpression4();
|
| }
|
| return notAChild(node);
|
| }
|
| @@ -430,7 +431,7 @@ class IncrementalParseDispatcher implements ASTVisitor<ASTNode> {
|
| if (identical(_oldNode, node.body)) {
|
| return _parser.parseStatement2();
|
| } else if (identical(_oldNode, node.condition)) {
|
| - return _parser.parseExpression3();
|
| + return _parser.parseExpression4();
|
| }
|
| return notAChild(node);
|
| }
|
| @@ -456,14 +457,14 @@ class IncrementalParseDispatcher implements ASTVisitor<ASTNode> {
|
|
|
| ASTNode visitExpressionFunctionBody(ExpressionFunctionBody node) {
|
| if (identical(_oldNode, node.expression)) {
|
| - return _parser.parseExpression3();
|
| + return _parser.parseExpression4();
|
| }
|
| return notAChild(node);
|
| }
|
|
|
| ASTNode visitExpressionStatement(ExpressionStatement node) {
|
| if (identical(_oldNode, node.expression)) {
|
| - return _parser.parseExpression3();
|
| + return _parser.parseExpression4();
|
| }
|
| return notAChild(node);
|
| }
|
| @@ -523,9 +524,9 @@ class IncrementalParseDispatcher implements ASTVisitor<ASTNode> {
|
| } else if (identical(_oldNode, node.initialization)) {
|
| throw new InsufficientContextException();
|
| } else if (identical(_oldNode, node.condition)) {
|
| - return _parser.parseExpression3();
|
| + return _parser.parseExpression4();
|
| } else if (node.updaters.contains(_oldNode)) {
|
| - return _parser.parseExpression3();
|
| + return _parser.parseExpression4();
|
| } else if (identical(_oldNode, node.body)) {
|
| return _parser.parseStatement2();
|
| }
|
| @@ -613,7 +614,7 @@ class IncrementalParseDispatcher implements ASTVisitor<ASTNode> {
|
|
|
| ASTNode visitIfStatement(IfStatement node) {
|
| if (identical(_oldNode, node.condition)) {
|
| - return _parser.parseExpression3();
|
| + return _parser.parseExpression4();
|
| } else if (identical(_oldNode, node.thenStatement)) {
|
| return _parser.parseStatement2();
|
| } else if (identical(_oldNode, node.elseStatement)) {
|
| @@ -648,7 +649,7 @@ class IncrementalParseDispatcher implements ASTVisitor<ASTNode> {
|
| if (identical(_oldNode, node.target)) {
|
| throw new InsufficientContextException();
|
| } else if (identical(_oldNode, node.index)) {
|
| - return _parser.parseExpression3();
|
| + return _parser.parseExpression4();
|
| }
|
| return notAChild(node);
|
| }
|
| @@ -669,7 +670,7 @@ class IncrementalParseDispatcher implements ASTVisitor<ASTNode> {
|
| if (node.leftBracket == null) {
|
| throw new InsufficientContextException();
|
| }
|
| - return _parser.parseExpression3();
|
| + return _parser.parseExpression4();
|
| }
|
| return notAChild(node);
|
| }
|
| @@ -725,7 +726,7 @@ class IncrementalParseDispatcher implements ASTVisitor<ASTNode> {
|
| if (identical(_oldNode, node.typeArguments)) {
|
| return _parser.parseTypeArgumentList();
|
| } else if (node.elements.contains(_oldNode)) {
|
| - return _parser.parseExpression3();
|
| + return _parser.parseExpression4();
|
| }
|
| return notAChild(node);
|
| }
|
| @@ -741,9 +742,9 @@ class IncrementalParseDispatcher implements ASTVisitor<ASTNode> {
|
|
|
| ASTNode visitMapLiteralEntry(MapLiteralEntry node) {
|
| if (identical(_oldNode, node.key)) {
|
| - return _parser.parseExpression3();
|
| + return _parser.parseExpression4();
|
| } else if (identical(_oldNode, node.value)) {
|
| - return _parser.parseExpression3();
|
| + return _parser.parseExpression4();
|
| }
|
| return notAChild(node);
|
| }
|
| @@ -782,7 +783,7 @@ class IncrementalParseDispatcher implements ASTVisitor<ASTNode> {
|
| if (identical(_oldNode, node.name)) {
|
| return _parser.parseLabel();
|
| } else if (identical(_oldNode, node.expression)) {
|
| - return _parser.parseExpression3();
|
| + return _parser.parseExpression4();
|
| }
|
| return notAChild(node);
|
| }
|
| @@ -805,7 +806,7 @@ class IncrementalParseDispatcher implements ASTVisitor<ASTNode> {
|
|
|
| ASTNode visitParenthesizedExpression(ParenthesizedExpression node) {
|
| if (identical(_oldNode, node.expression)) {
|
| - return _parser.parseExpression3();
|
| + return _parser.parseExpression4();
|
| }
|
| return notAChild(node);
|
| }
|
| @@ -877,7 +878,7 @@ class IncrementalParseDispatcher implements ASTVisitor<ASTNode> {
|
|
|
| ASTNode visitReturnStatement(ReturnStatement node) {
|
| if (identical(_oldNode, node.expression)) {
|
| - return _parser.parseExpression3();
|
| + return _parser.parseExpression4();
|
| }
|
| return notAChild(node);
|
| }
|
| @@ -930,7 +931,7 @@ class IncrementalParseDispatcher implements ASTVisitor<ASTNode> {
|
| if (node.labels.contains(_oldNode)) {
|
| return _parser.parseLabel();
|
| } else if (identical(_oldNode, node.expression)) {
|
| - return _parser.parseExpression3();
|
| + return _parser.parseExpression4();
|
| } else if (node.statements.contains(_oldNode)) {
|
| return _parser.parseStatement2();
|
| }
|
| @@ -948,7 +949,7 @@ class IncrementalParseDispatcher implements ASTVisitor<ASTNode> {
|
|
|
| ASTNode visitSwitchStatement(SwitchStatement node) {
|
| if (identical(_oldNode, node.expression)) {
|
| - return _parser.parseExpression3();
|
| + return _parser.parseExpression4();
|
| } else if (node.members.contains(_oldNode)) {
|
| throw new InsufficientContextException();
|
| }
|
| @@ -962,7 +963,7 @@ class IncrementalParseDispatcher implements ASTVisitor<ASTNode> {
|
| ASTNode visitThrowExpression(ThrowExpression node) {
|
| if (identical(_oldNode, node.expression)) {
|
| if (isCascadeAllowed2(node)) {
|
| - return _parser.parseExpression3();
|
| + return _parser.parseExpression4();
|
| }
|
| return _parser.parseExpressionWithoutCascade();
|
| }
|
| @@ -1060,7 +1061,7 @@ class IncrementalParseDispatcher implements ASTVisitor<ASTNode> {
|
|
|
| ASTNode visitWhileStatement(WhileStatement node) {
|
| if (identical(_oldNode, node.condition)) {
|
| - return _parser.parseExpression3();
|
| + return _parser.parseExpression4();
|
| } else if (identical(_oldNode, node.body)) {
|
| return _parser.parseStatement2();
|
| }
|
| @@ -1414,7 +1415,7 @@ class Parser {
|
| InstrumentationBuilder instrumentation = Instrumentation.builder2("dart.engine.Parser.parseExpression");
|
| try {
|
| _currentToken = token;
|
| - return parseExpression3();
|
| + return parseExpression4();
|
| } finally {
|
| instrumentation.log();
|
| }
|
| @@ -1509,9 +1510,9 @@ class Parser {
|
| // have an identifier followed by a colon.
|
| //
|
| if (matchesIdentifier() && matches4(peek(), TokenType.COLON)) {
|
| - return new NamedExpression(parseLabel(), parseExpression3());
|
| + return new NamedExpression(parseLabel(), parseExpression4());
|
| } else {
|
| - return parseExpression3();
|
| + return parseExpression4();
|
| }
|
| }
|
|
|
| @@ -1549,7 +1550,7 @@ class Parser {
|
| if (foundNamedArgument) {
|
| if (!generatedError && argument is! NamedExpression) {
|
| // Report the error, once, but allow the arguments to be in any order in the AST.
|
| - reportError11(ParserErrorCode.POSITIONAL_AFTER_NAMED_ARGUMENT, []);
|
| + reportError12(ParserErrorCode.POSITIONAL_AFTER_NAMED_ARGUMENT, []);
|
| generatedError = true;
|
| }
|
| } else if (argument is NamedExpression) {
|
| @@ -1609,7 +1610,7 @@ class Parser {
|
| }
|
| if (identical(_currentToken, statementStart)) {
|
| // Ensure that we are making progress and report an error if we're not.
|
| - reportError12(ParserErrorCode.UNEXPECTED_TOKEN, _currentToken, [_currentToken.lexeme]);
|
| + reportError13(ParserErrorCode.UNEXPECTED_TOKEN, _currentToken, [_currentToken.lexeme]);
|
| advance();
|
| }
|
| statementStart = _currentToken;
|
| @@ -1660,7 +1661,7 @@ class Parser {
|
| //
|
| // We appear to have a variable declaration with a type of "void".
|
| //
|
| - reportError10(ParserErrorCode.VOID_VARIABLE, returnType, []);
|
| + reportError11(ParserErrorCode.VOID_VARIABLE, returnType, []);
|
| return parseInitializedIdentifierList(commentAndMetadata, modifiers.staticKeyword, validateModifiersForField(modifiers), returnType);
|
| }
|
| }
|
| @@ -1671,7 +1672,7 @@ class Parser {
|
| validateModifiersForOperator(modifiers);
|
| return parseOperator(commentAndMetadata, modifiers.externalKeyword, returnType);
|
| }
|
| - reportError12(ParserErrorCode.EXPECTED_EXECUTABLE, _currentToken, []);
|
| + reportError13(ParserErrorCode.EXPECTED_EXECUTABLE, _currentToken, []);
|
| return null;
|
| }
|
| } else if (matches(Keyword.GET) && matchesIdentifier2(peek())) {
|
| @@ -1691,7 +1692,7 @@ class Parser {
|
| validateModifiersForOperator(modifiers);
|
| return parseOperator(commentAndMetadata, modifiers.externalKeyword, null);
|
| }
|
| - reportError12(ParserErrorCode.EXPECTED_CLASS_MEMBER, _currentToken, []);
|
| + reportError13(ParserErrorCode.EXPECTED_CLASS_MEMBER, _currentToken, []);
|
| return null;
|
| } else if (matches4(peek(), TokenType.PERIOD) && matchesIdentifier2(peek2(2)) && matches4(peek2(3), TokenType.OPEN_PAREN)) {
|
| return parseConstructor(commentAndMetadata, modifiers.externalKeyword, validateModifiersForConstructor(modifiers), modifiers.factoryKeyword, parseSimpleIdentifier(), andAdvance, parseSimpleIdentifier(), parseFormalParameterList());
|
| @@ -1706,7 +1707,7 @@ class Parser {
|
| return parseMethodDeclaration2(commentAndMetadata, modifiers.externalKeyword, modifiers.staticKeyword, null, methodName, parameters);
|
| } else if (matchesAny(peek(), [TokenType.EQ, TokenType.COMMA, TokenType.SEMICOLON])) {
|
| if (modifiers.constKeyword == null && modifiers.finalKeyword == null && modifiers.varKeyword == null) {
|
| - reportError11(ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE, []);
|
| + reportError12(ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE, []);
|
| }
|
| return parseInitializedIdentifierList(commentAndMetadata, modifiers.staticKeyword, validateModifiersForField(modifiers), null);
|
| }
|
| @@ -1741,7 +1742,7 @@ class Parser {
|
| // At this point it consists of a type name, so we'll treat it as a field declaration
|
| // with a missing field name and semicolon.
|
| //
|
| - reportError12(ParserErrorCode.EXPECTED_CLASS_MEMBER, _currentToken, []);
|
| + reportError13(ParserErrorCode.EXPECTED_CLASS_MEMBER, _currentToken, []);
|
| try {
|
| lockErrorListener();
|
| return parseInitializedIdentifierList(commentAndMetadata, modifiers.staticKeyword, validateModifiersForField(modifiers), type);
|
| @@ -1752,7 +1753,7 @@ class Parser {
|
| SimpleIdentifier methodName = parseSimpleIdentifier();
|
| FormalParameterList parameters = parseFormalParameterList();
|
| if (methodName.name == className) {
|
| - reportError10(ParserErrorCode.CONSTRUCTOR_WITH_RETURN_TYPE, type, []);
|
| + reportError11(ParserErrorCode.CONSTRUCTOR_WITH_RETURN_TYPE, type, []);
|
| return parseConstructor(commentAndMetadata, modifiers.externalKeyword, validateModifiersForConstructor(modifiers), modifiers.factoryKeyword, methodName, null, null, parameters);
|
| }
|
| validateModifiersForGetterOrSetterOrMethod(modifiers);
|
| @@ -1806,15 +1807,15 @@ class Parser {
|
| if ((matches(Keyword.IMPORT) || matches(Keyword.EXPORT) || matches(Keyword.LIBRARY) || matches(Keyword.PART)) && !matches4(peek(), TokenType.PERIOD) && !matches4(peek(), TokenType.LT) && !matches4(peek(), TokenType.OPEN_PAREN)) {
|
| Directive directive = parseDirective(commentAndMetadata);
|
| if (declarations.length > 0 && !directiveFoundAfterDeclaration) {
|
| - reportError11(ParserErrorCode.DIRECTIVE_AFTER_DECLARATION, []);
|
| + reportError12(ParserErrorCode.DIRECTIVE_AFTER_DECLARATION, []);
|
| directiveFoundAfterDeclaration = true;
|
| }
|
| if (directive is LibraryDirective) {
|
| if (libraryDirectiveFound) {
|
| - reportError11(ParserErrorCode.MULTIPLE_LIBRARY_DIRECTIVES, []);
|
| + reportError12(ParserErrorCode.MULTIPLE_LIBRARY_DIRECTIVES, []);
|
| } else {
|
| if (directives.length > 0) {
|
| - reportError12(ParserErrorCode.LIBRARY_DIRECTIVE_NOT_FIRST, directive.libraryToken, []);
|
| + reportError13(ParserErrorCode.LIBRARY_DIRECTIVE_NOT_FIRST, directive.libraryToken, []);
|
| }
|
| libraryDirectiveFound = true;
|
| }
|
| @@ -1822,29 +1823,29 @@ class Parser {
|
| partDirectiveFound = true;
|
| } else if (partDirectiveFound) {
|
| if (directive is ExportDirective) {
|
| - reportError12(ParserErrorCode.EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE, directive.keyword, []);
|
| + reportError13(ParserErrorCode.EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE, directive.keyword, []);
|
| } else if (directive is ImportDirective) {
|
| - reportError12(ParserErrorCode.IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE, directive.keyword, []);
|
| + reportError13(ParserErrorCode.IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE, directive.keyword, []);
|
| }
|
| }
|
| if (directive is PartOfDirective) {
|
| if (partOfDirectiveFound) {
|
| - reportError11(ParserErrorCode.MULTIPLE_PART_OF_DIRECTIVES, []);
|
| + reportError12(ParserErrorCode.MULTIPLE_PART_OF_DIRECTIVES, []);
|
| } else {
|
| int directiveCount = directives.length;
|
| for (int i = 0; i < directiveCount; i++) {
|
| - reportError12(ParserErrorCode.NON_PART_OF_DIRECTIVE_IN_PART, directives[i].keyword, []);
|
| + reportError13(ParserErrorCode.NON_PART_OF_DIRECTIVE_IN_PART, directives[i].keyword, []);
|
| }
|
| partOfDirectiveFound = true;
|
| }
|
| } else {
|
| if (partOfDirectiveFound) {
|
| - reportError12(ParserErrorCode.NON_PART_OF_DIRECTIVE_IN_PART, directive.keyword, []);
|
| + reportError13(ParserErrorCode.NON_PART_OF_DIRECTIVE_IN_PART, directive.keyword, []);
|
| }
|
| }
|
| directives.add(directive);
|
| } else if (matches5(TokenType.SEMICOLON)) {
|
| - reportError12(ParserErrorCode.UNEXPECTED_TOKEN, _currentToken, [_currentToken.lexeme]);
|
| + reportError13(ParserErrorCode.UNEXPECTED_TOKEN, _currentToken, [_currentToken.lexeme]);
|
| advance();
|
| } else {
|
| CompilationUnitMember member = parseCompilationUnitMember(commentAndMetadata);
|
| @@ -1853,7 +1854,7 @@ class Parser {
|
| }
|
| }
|
| if (identical(_currentToken, memberStart)) {
|
| - reportError12(ParserErrorCode.UNEXPECTED_TOKEN, _currentToken, [_currentToken.lexeme]);
|
| + reportError13(ParserErrorCode.UNEXPECTED_TOKEN, _currentToken, [_currentToken.lexeme]);
|
| advance();
|
| while (!matches5(TokenType.EOF) && !couldBeStartOfCompilationUnitMember()) {
|
| advance();
|
| @@ -1919,7 +1920,7 @@ class Parser {
|
| *
|
| * @return the expression that was parsed
|
| */
|
| - Expression parseExpression3() {
|
| + Expression parseExpression4() {
|
| if (matches(Keyword.THROW)) {
|
| return parseThrowExpression();
|
| } else if (matches(Keyword.RETHROW)) {
|
| @@ -1945,7 +1946,7 @@ class Parser {
|
| } else if (tokenType.isAssignmentOperator) {
|
| Token operator = andAdvance;
|
| ensureAssignable(expression);
|
| - return new AssignmentExpression(expression, operator, parseExpression3());
|
| + return new AssignmentExpression(expression, operator, parseExpression4());
|
| }
|
| return expression;
|
| }
|
| @@ -2055,9 +2056,9 @@ class Parser {
|
| } else if (!optional(TokenType.COMMA)) {
|
| // TODO(brianwilkerson) The token is wrong, we need to recover from this case.
|
| if (getEndToken(leftParenthesis) != null) {
|
| - reportError11(ParserErrorCode.EXPECTED_TOKEN, [TokenType.COMMA.lexeme]);
|
| + reportError12(ParserErrorCode.EXPECTED_TOKEN, [TokenType.COMMA.lexeme]);
|
| } else {
|
| - reportError12(ParserErrorCode.MISSING_CLOSING_PARENTHESIS, _currentToken.previous, []);
|
| + reportError13(ParserErrorCode.MISSING_CLOSING_PARENTHESIS, _currentToken.previous, []);
|
| break;
|
| }
|
| }
|
| @@ -2068,11 +2069,11 @@ class Parser {
|
| if (matches5(TokenType.OPEN_SQUARE_BRACKET)) {
|
| wasOptionalParameter = true;
|
| if (leftSquareBracket != null && !reportedMuliplePositionalGroups) {
|
| - reportError11(ParserErrorCode.MULTIPLE_POSITIONAL_PARAMETER_GROUPS, []);
|
| + reportError12(ParserErrorCode.MULTIPLE_POSITIONAL_PARAMETER_GROUPS, []);
|
| reportedMuliplePositionalGroups = true;
|
| }
|
| if (leftCurlyBracket != null && !reportedMixedGroups) {
|
| - reportError11(ParserErrorCode.MIXED_PARAMETER_GROUPS, []);
|
| + reportError12(ParserErrorCode.MIXED_PARAMETER_GROUPS, []);
|
| reportedMixedGroups = true;
|
| }
|
| leftSquareBracket = andAdvance;
|
| @@ -2081,11 +2082,11 @@ class Parser {
|
| } else if (matches5(TokenType.OPEN_CURLY_BRACKET)) {
|
| wasOptionalParameter = true;
|
| if (leftCurlyBracket != null && !reportedMulipleNamedGroups) {
|
| - reportError11(ParserErrorCode.MULTIPLE_NAMED_PARAMETER_GROUPS, []);
|
| + reportError12(ParserErrorCode.MULTIPLE_NAMED_PARAMETER_GROUPS, []);
|
| reportedMulipleNamedGroups = true;
|
| }
|
| if (leftSquareBracket != null && !reportedMixedGroups) {
|
| - reportError11(ParserErrorCode.MIXED_PARAMETER_GROUPS, []);
|
| + reportError12(ParserErrorCode.MIXED_PARAMETER_GROUPS, []);
|
| reportedMixedGroups = true;
|
| }
|
| leftCurlyBracket = andAdvance;
|
| @@ -2099,7 +2100,7 @@ class Parser {
|
| parameters.add(parameter);
|
| currentParameters.add(parameter);
|
| if (identical(kind, ParameterKind.REQUIRED) && wasOptionalParameter) {
|
| - reportError10(ParserErrorCode.NORMAL_BEFORE_OPTIONAL_PARAMETERS, parameter, []);
|
| + reportError11(ParserErrorCode.NORMAL_BEFORE_OPTIONAL_PARAMETERS, parameter, []);
|
| }
|
| //
|
| // Handle the end of parameter groups.
|
| @@ -2110,11 +2111,11 @@ class Parser {
|
| currentParameters = normalParameters;
|
| if (leftSquareBracket == null) {
|
| if (leftCurlyBracket != null) {
|
| - reportError11(ParserErrorCode.WRONG_TERMINATOR_FOR_PARAMETER_GROUP, ["}"]);
|
| + reportError12(ParserErrorCode.WRONG_TERMINATOR_FOR_PARAMETER_GROUP, ["}"]);
|
| rightCurlyBracket = rightSquareBracket;
|
| rightSquareBracket = null;
|
| } else {
|
| - reportError11(ParserErrorCode.UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP, ["["]);
|
| + reportError12(ParserErrorCode.UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP, ["["]);
|
| }
|
| }
|
| kind = ParameterKind.REQUIRED;
|
| @@ -2123,11 +2124,11 @@ class Parser {
|
| currentParameters = normalParameters;
|
| if (leftCurlyBracket == null) {
|
| if (leftSquareBracket != null) {
|
| - reportError11(ParserErrorCode.WRONG_TERMINATOR_FOR_PARAMETER_GROUP, ["]"]);
|
| + reportError12(ParserErrorCode.WRONG_TERMINATOR_FOR_PARAMETER_GROUP, ["]"]);
|
| rightSquareBracket = rightCurlyBracket;
|
| rightCurlyBracket = null;
|
| } else {
|
| - reportError11(ParserErrorCode.UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP, ["{"]);
|
| + reportError12(ParserErrorCode.UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP, ["{"]);
|
| }
|
| }
|
| kind = ParameterKind.REQUIRED;
|
| @@ -2138,10 +2139,10 @@ class Parser {
|
| // Check that the groups were closed correctly.
|
| //
|
| if (leftSquareBracket != null && rightSquareBracket == null) {
|
| - reportError11(ParserErrorCode.MISSING_TERMINATOR_FOR_PARAMETER_GROUP, ["]"]);
|
| + reportError12(ParserErrorCode.MISSING_TERMINATOR_FOR_PARAMETER_GROUP, ["]"]);
|
| }
|
| if (leftCurlyBracket != null && rightCurlyBracket == null) {
|
| - reportError11(ParserErrorCode.MISSING_TERMINATOR_FOR_PARAMETER_GROUP, ["}"]);
|
| + reportError12(ParserErrorCode.MISSING_TERMINATOR_FOR_PARAMETER_GROUP, ["}"]);
|
| }
|
| //
|
| // Build the parameter list.
|
| @@ -2258,9 +2259,9 @@ class Parser {
|
| * @return the map literal entry that was parsed
|
| */
|
| MapLiteralEntry parseMapLiteralEntry() {
|
| - Expression key = parseExpression3();
|
| + Expression key = parseExpression4();
|
| Token separator = expect2(TokenType.COLON);
|
| - Expression value = parseExpression3();
|
| + Expression value = parseExpression4();
|
| return new MapLiteralEntry(key, separator, value);
|
| }
|
|
|
| @@ -2300,7 +2301,7 @@ class Parser {
|
| FormalParameterList parameters = parseFormalParameterList();
|
| if (thisKeyword == null) {
|
| if (holder.keyword != null) {
|
| - reportError12(ParserErrorCode.FUNCTION_TYPED_PARAMETER_VAR, holder.keyword, []);
|
| + reportError13(ParserErrorCode.FUNCTION_TYPED_PARAMETER_VAR, holder.keyword, []);
|
| }
|
| return new FunctionTypedFormalParameter(commentAndMetadata.comment, commentAndMetadata.metadata, holder.type, identifier, parameters);
|
| } else {
|
| @@ -2310,9 +2311,9 @@ class Parser {
|
| TypeName type = holder.type;
|
| if (type != null) {
|
| if (matches3(type.name.beginToken, Keyword.VOID)) {
|
| - reportError12(ParserErrorCode.VOID_PARAMETER, type.name.beginToken, []);
|
| + reportError13(ParserErrorCode.VOID_PARAMETER, type.name.beginToken, []);
|
| } else if (holder.keyword != null && matches3(holder.keyword, Keyword.VAR)) {
|
| - reportError12(ParserErrorCode.VAR_AND_TYPE, holder.keyword, []);
|
| + reportError13(ParserErrorCode.VAR_AND_TYPE, holder.keyword, []);
|
| }
|
| }
|
| if (thisKeyword != null) {
|
| @@ -2374,7 +2375,7 @@ class Parser {
|
| if (matchesIdentifier()) {
|
| return new SimpleIdentifier(andAdvance);
|
| }
|
| - reportError11(ParserErrorCode.MISSING_IDENTIFIER, []);
|
| + reportError12(ParserErrorCode.MISSING_IDENTIFIER, []);
|
| return createSyntheticIdentifier();
|
| }
|
|
|
| @@ -2422,7 +2423,7 @@ class Parser {
|
| }
|
| }
|
| if (strings.length < 1) {
|
| - reportError11(ParserErrorCode.EXPECTED_STRING_LITERAL, []);
|
| + reportError12(ParserErrorCode.EXPECTED_STRING_LITERAL, []);
|
| return createSyntheticStringLiteral();
|
| } else if (strings.length == 1) {
|
| return strings[0];
|
| @@ -2468,13 +2469,13 @@ class Parser {
|
| TypeName parseTypeName() {
|
| Identifier typeName;
|
| if (matches(Keyword.VAR)) {
|
| - reportError11(ParserErrorCode.VAR_AS_TYPE_NAME, []);
|
| + reportError12(ParserErrorCode.VAR_AS_TYPE_NAME, []);
|
| typeName = new SimpleIdentifier(andAdvance);
|
| } else if (matchesIdentifier()) {
|
| typeName = parsePrefixedIdentifier();
|
| } else {
|
| typeName = createSyntheticIdentifier();
|
| - reportError11(ParserErrorCode.EXPECTED_TYPE_NAME, []);
|
| + reportError12(ParserErrorCode.EXPECTED_TYPE_NAME, []);
|
| }
|
| TypeArgumentList typeArguments = null;
|
| if (matches5(TokenType.LT)) {
|
| @@ -2569,7 +2570,7 @@ class Parser {
|
| */
|
| void appendScalarValue(JavaStringBuilder builder, String escapeSequence, int scalarValue, int startIndex, int endIndex) {
|
| if (scalarValue < 0 || scalarValue > Character.MAX_CODE_POINT || (scalarValue >= 0xD800 && scalarValue <= 0xDFFF)) {
|
| - reportError11(ParserErrorCode.INVALID_CODE_POINT, [escapeSequence]);
|
| + reportError12(ParserErrorCode.INVALID_CODE_POINT, [escapeSequence]);
|
| return;
|
| }
|
| if (scalarValue < Character.MAX_VALUE) {
|
| @@ -2591,23 +2592,23 @@ class Parser {
|
| bool isRaw = false;
|
| int start = 0;
|
| if (first) {
|
| - if (lexeme.startsWith("r\"\"\"") || lexeme.startsWith("r'''")) {
|
| + if (StringUtilities.startsWith4(lexeme, 0, 0x72, 0x22, 0x22, 0x22) || StringUtilities.startsWith4(lexeme, 0, 0x72, 0x27, 0x27, 0x27)) {
|
| isRaw = true;
|
| start += 4;
|
| - } else if (lexeme.startsWith("r\"") || lexeme.startsWith("r'")) {
|
| + } else if (StringUtilities.startsWith2(lexeme, 0, 0x72, 0x22) || StringUtilities.startsWith2(lexeme, 0, 0x72, 0x27)) {
|
| isRaw = true;
|
| start += 2;
|
| - } else if (lexeme.startsWith("\"\"\"") || lexeme.startsWith("'''")) {
|
| + } else if (StringUtilities.startsWith3(lexeme, 0, 0x22, 0x22, 0x22) || StringUtilities.startsWith3(lexeme, 0, 0x27, 0x27, 0x27)) {
|
| start += 3;
|
| - } else if (lexeme.startsWith("\"") || lexeme.startsWith("'")) {
|
| + } else if (StringUtilities.startsWithChar(lexeme, 0x22) || StringUtilities.startsWithChar(lexeme, 0x27)) {
|
| start += 1;
|
| }
|
| }
|
| int end = lexeme.length;
|
| if (last) {
|
| - if (lexeme.endsWith("\"\"\"") || lexeme.endsWith("'''")) {
|
| + if (StringUtilities.endsWith3(lexeme, 0x22, 0x22, 0x22) || StringUtilities.endsWith3(lexeme, 0x27, 0x27, 0x27)) {
|
| end -= 3;
|
| - } else if (lexeme.endsWith("\"") || lexeme.endsWith("'")) {
|
| + } else if (StringUtilities.endsWithChar(lexeme, 0x22) || StringUtilities.endsWithChar(lexeme, 0x27)) {
|
| end -= 1;
|
| }
|
| }
|
| @@ -2729,7 +2730,7 @@ class Parser {
|
| */
|
| void ensureAssignable(Expression expression) {
|
| if (expression != null && !expression.isAssignable) {
|
| - reportError11(ParserErrorCode.ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE, []);
|
| + reportError12(ParserErrorCode.ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE, []);
|
| }
|
| }
|
|
|
| @@ -2746,7 +2747,7 @@ class Parser {
|
| }
|
| // Remove uses of this method in favor of matches?
|
| // Pass in the error code to use to report the error?
|
| - reportError11(ParserErrorCode.EXPECTED_TOKEN, [keyword.syntax]);
|
| + reportError12(ParserErrorCode.EXPECTED_TOKEN, [keyword.syntax]);
|
| return _currentToken;
|
| }
|
|
|
| @@ -2764,9 +2765,9 @@ class Parser {
|
| // Remove uses of this method in favor of matches?
|
| // Pass in the error code to use to report the error?
|
| if (identical(type, TokenType.SEMICOLON)) {
|
| - reportError12(ParserErrorCode.EXPECTED_TOKEN, _currentToken.previous, [type.lexeme]);
|
| + reportError13(ParserErrorCode.EXPECTED_TOKEN, _currentToken.previous, [type.lexeme]);
|
| } else {
|
| - reportError11(ParserErrorCode.EXPECTED_TOKEN, [type.lexeme]);
|
| + reportError12(ParserErrorCode.EXPECTED_TOKEN, [type.lexeme]);
|
| }
|
| return _currentToken;
|
| }
|
| @@ -2813,9 +2814,17 @@ class Parser {
|
| List<List<int>> getCodeBlockRanges(String comment) {
|
| List<List<int>> ranges = new List<List<int>>();
|
| int length = comment.length;
|
| + if (length < 3) {
|
| + return ranges;
|
| + }
|
| int index = 0;
|
| - if (comment.startsWith("/**") || comment.startsWith("///")) {
|
| - index = 3;
|
| + int firstChar = comment.codeUnitAt(0);
|
| + if (firstChar == 0x2F) {
|
| + int secondChar = comment.codeUnitAt(1);
|
| + int thirdChar = comment.codeUnitAt(2);
|
| + if ((secondChar == 0x2A && thirdChar == 0x2A) || (secondChar == 0x2F && thirdChar == 0x2F)) {
|
| + index = 3;
|
| + }
|
| }
|
| while (index < length) {
|
| int currentChar = comment.codeUnitAt(index);
|
| @@ -2824,7 +2833,7 @@ class Parser {
|
| while (index < length && Character.isWhitespace(comment.codeUnitAt(index))) {
|
| index = index + 1;
|
| }
|
| - if (JavaString.startsWithBefore(comment, "* ", index)) {
|
| + if (StringUtilities.startsWith6(comment, index, 0x2A, 0x20, 0x20, 0x20, 0x20, 0x20)) {
|
| int end = index + 6;
|
| while (end < length && comment.codeUnitAt(end) != 0xD && comment.codeUnitAt(end) != 0xA) {
|
| end = end + 1;
|
| @@ -2832,8 +2841,8 @@ class Parser {
|
| ranges.add(<int> [index, end]);
|
| index = end;
|
| }
|
| - } else if (JavaString.startsWithBefore(comment, "[:", index)) {
|
| - int end = JavaString.indexOf(comment, ":]", index + 2);
|
| + } else if (index + 1 < length && currentChar == 0x5B && comment.codeUnitAt(index + 1) == 0x3A) {
|
| + int end = StringUtilities.indexOf2(comment, index + 2, 0x3A, 0x5D);
|
| if (end < 0) {
|
| end = length;
|
| }
|
| @@ -3299,7 +3308,7 @@ class Parser {
|
| ArgumentDefinitionTest parseArgumentDefinitionTest() {
|
| Token question = expect2(TokenType.QUESTION);
|
| SimpleIdentifier identifier = parseSimpleIdentifier();
|
| - reportError12(ParserErrorCode.DEPRECATED_ARGUMENT_DEFINITION_TEST, question, []);
|
| + reportError13(ParserErrorCode.DEPRECATED_ARGUMENT_DEFINITION_TEST, question, []);
|
| return new ArgumentDefinitionTest(question, identifier);
|
| }
|
|
|
| @@ -3316,15 +3325,15 @@ class Parser {
|
| AssertStatement parseAssertStatement() {
|
| Token keyword = expect(Keyword.ASSERT);
|
| Token leftParen = expect2(TokenType.OPEN_PAREN);
|
| - Expression expression = parseExpression3();
|
| + Expression expression = parseExpression4();
|
| if (expression is AssignmentExpression) {
|
| - reportError10(ParserErrorCode.ASSERT_DOES_NOT_TAKE_ASSIGNMENT, expression, []);
|
| + reportError11(ParserErrorCode.ASSERT_DOES_NOT_TAKE_ASSIGNMENT, expression, []);
|
| } else if (expression is CascadeExpression) {
|
| - reportError10(ParserErrorCode.ASSERT_DOES_NOT_TAKE_CASCADE, expression, []);
|
| + reportError11(ParserErrorCode.ASSERT_DOES_NOT_TAKE_CASCADE, expression, []);
|
| } else if (expression is ThrowExpression) {
|
| - reportError10(ParserErrorCode.ASSERT_DOES_NOT_TAKE_THROW, expression, []);
|
| + reportError11(ParserErrorCode.ASSERT_DOES_NOT_TAKE_THROW, expression, []);
|
| } else if (expression is RethrowExpression) {
|
| - reportError10(ParserErrorCode.ASSERT_DOES_NOT_TAKE_RETHROW, expression, []);
|
| + reportError11(ParserErrorCode.ASSERT_DOES_NOT_TAKE_RETHROW, expression, []);
|
| }
|
| Token rightParen = expect2(TokenType.CLOSE_PAREN);
|
| Token semicolon = expect2(TokenType.SEMICOLON);
|
| @@ -3403,7 +3412,7 @@ class Parser {
|
| Expression parseAssignableSelector(Expression prefix, bool optional) {
|
| if (matches5(TokenType.OPEN_SQUARE_BRACKET)) {
|
| Token leftBracket = andAdvance;
|
| - Expression index = parseExpression3();
|
| + Expression index = parseExpression4();
|
| Token rightBracket = expect2(TokenType.CLOSE_SQUARE_BRACKET);
|
| return new IndexExpression.forTarget(prefix, leftBracket, index, rightBracket);
|
| } else if (matches5(TokenType.PERIOD)) {
|
| @@ -3412,7 +3421,7 @@ class Parser {
|
| } else {
|
| if (!optional) {
|
| // Report the missing selector.
|
| - reportError11(ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR, []);
|
| + reportError12(ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR, []);
|
| }
|
| return prefix;
|
| }
|
| @@ -3485,7 +3494,7 @@ class Parser {
|
| label = parseSimpleIdentifier();
|
| }
|
| if (!_inLoop && !_inSwitch && label == null) {
|
| - reportError12(ParserErrorCode.BREAK_OUTSIDE_OF_LOOP, breakKeyword, []);
|
| + reportError13(ParserErrorCode.BREAK_OUTSIDE_OF_LOOP, breakKeyword, []);
|
| }
|
| Token semicolon = expect2(TokenType.SEMICOLON);
|
| return new BreakStatement(breakKeyword, label, semicolon);
|
| @@ -3516,12 +3525,12 @@ class Parser {
|
| functionName = parseSimpleIdentifier();
|
| } else if (identical(_currentToken.type, TokenType.OPEN_SQUARE_BRACKET)) {
|
| Token leftBracket = andAdvance;
|
| - Expression index = parseExpression3();
|
| + Expression index = parseExpression4();
|
| Token rightBracket = expect2(TokenType.CLOSE_SQUARE_BRACKET);
|
| expression = new IndexExpression.forCascade(period, leftBracket, index, rightBracket);
|
| period = null;
|
| } else {
|
| - reportError12(ParserErrorCode.MISSING_IDENTIFIER, _currentToken, [_currentToken.lexeme]);
|
| + reportError13(ParserErrorCode.MISSING_IDENTIFIER, _currentToken, [_currentToken.lexeme]);
|
| functionName = createSyntheticIdentifier();
|
| }
|
| if (identical(_currentToken.type, TokenType.OPEN_PAREN)) {
|
| @@ -3612,29 +3621,29 @@ class Parser {
|
| if (extendsClause == null) {
|
| extendsClause = parseExtendsClause();
|
| if (withClause != null) {
|
| - reportError12(ParserErrorCode.WITH_BEFORE_EXTENDS, withClause.withKeyword, []);
|
| + reportError13(ParserErrorCode.WITH_BEFORE_EXTENDS, withClause.withKeyword, []);
|
| } else if (implementsClause != null) {
|
| - reportError12(ParserErrorCode.IMPLEMENTS_BEFORE_EXTENDS, implementsClause.keyword, []);
|
| + reportError13(ParserErrorCode.IMPLEMENTS_BEFORE_EXTENDS, implementsClause.keyword, []);
|
| }
|
| } else {
|
| - reportError12(ParserErrorCode.MULTIPLE_EXTENDS_CLAUSES, extendsClause.keyword, []);
|
| + reportError13(ParserErrorCode.MULTIPLE_EXTENDS_CLAUSES, extendsClause.keyword, []);
|
| parseExtendsClause();
|
| }
|
| } else if (matches(Keyword.WITH)) {
|
| if (withClause == null) {
|
| withClause = parseWithClause();
|
| if (implementsClause != null) {
|
| - reportError12(ParserErrorCode.IMPLEMENTS_BEFORE_WITH, implementsClause.keyword, []);
|
| + reportError13(ParserErrorCode.IMPLEMENTS_BEFORE_WITH, implementsClause.keyword, []);
|
| }
|
| } else {
|
| - reportError12(ParserErrorCode.MULTIPLE_WITH_CLAUSES, withClause.withKeyword, []);
|
| + reportError13(ParserErrorCode.MULTIPLE_WITH_CLAUSES, withClause.withKeyword, []);
|
| parseWithClause();
|
| }
|
| } else if (matches(Keyword.IMPLEMENTS)) {
|
| if (implementsClause == null) {
|
| implementsClause = parseImplementsClause();
|
| } else {
|
| - reportError12(ParserErrorCode.MULTIPLE_IMPLEMENTS_CLAUSES, implementsClause.keyword, []);
|
| + reportError13(ParserErrorCode.MULTIPLE_IMPLEMENTS_CLAUSES, implementsClause.keyword, []);
|
| parseImplementsClause();
|
| }
|
| } else {
|
| @@ -3642,7 +3651,7 @@ class Parser {
|
| }
|
| }
|
| if (withClause != null && extendsClause == null) {
|
| - reportError12(ParserErrorCode.WITH_WITHOUT_EXTENDS, withClause.withKeyword, []);
|
| + reportError13(ParserErrorCode.WITH_WITHOUT_EXTENDS, withClause.withKeyword, []);
|
| }
|
| //
|
| // Look for and skip over the extra-lingual 'native' specification.
|
| @@ -3664,7 +3673,7 @@ class Parser {
|
| } else {
|
| leftBracket = createSyntheticToken2(TokenType.OPEN_CURLY_BRACKET);
|
| rightBracket = createSyntheticToken2(TokenType.CLOSE_CURLY_BRACKET);
|
| - reportError11(ParserErrorCode.MISSING_CLASS_BODY, []);
|
| + reportError12(ParserErrorCode.MISSING_CLASS_BODY, []);
|
| }
|
| ClassDeclaration classDeclaration = new ClassDeclaration(commentAndMetadata.comment, commentAndMetadata.metadata, abstractKeyword, keyword, name, typeParameters, extendsClause, withClause, implementsClause, leftBracket, members, rightBracket);
|
| classDeclaration.nativeClause = nativeClause;
|
| @@ -3689,7 +3698,7 @@ class Parser {
|
| Token memberStart = _currentToken;
|
| while (!matches5(TokenType.EOF) && !matches5(TokenType.CLOSE_CURLY_BRACKET) && (closingBracket != null || (!matches(Keyword.CLASS) && !matches(Keyword.TYPEDEF)))) {
|
| if (matches5(TokenType.SEMICOLON)) {
|
| - reportError12(ParserErrorCode.UNEXPECTED_TOKEN, _currentToken, [_currentToken.lexeme]);
|
| + reportError13(ParserErrorCode.UNEXPECTED_TOKEN, _currentToken, [_currentToken.lexeme]);
|
| advance();
|
| } else {
|
| ClassMember member = parseClassMember(className);
|
| @@ -3698,7 +3707,7 @@ class Parser {
|
| }
|
| }
|
| if (identical(_currentToken, memberStart)) {
|
| - reportError12(ParserErrorCode.UNEXPECTED_TOKEN, _currentToken, [_currentToken.lexeme]);
|
| + reportError13(ParserErrorCode.UNEXPECTED_TOKEN, _currentToken, [_currentToken.lexeme]);
|
| advance();
|
| }
|
| memberStart = _currentToken;
|
| @@ -3746,12 +3755,12 @@ class Parser {
|
| semicolon = andAdvance;
|
| } else {
|
| if (matches5(TokenType.OPEN_CURLY_BRACKET)) {
|
| - reportError11(ParserErrorCode.EXPECTED_TOKEN, [TokenType.SEMICOLON.lexeme]);
|
| + reportError12(ParserErrorCode.EXPECTED_TOKEN, [TokenType.SEMICOLON.lexeme]);
|
| Token leftBracket = andAdvance;
|
| parseClassMembers(className.name, getEndToken(leftBracket));
|
| expect2(TokenType.CLOSE_CURLY_BRACKET);
|
| } else {
|
| - reportError12(ParserErrorCode.EXPECTED_TOKEN, _currentToken.previous, [TokenType.SEMICOLON.lexeme]);
|
| + reportError13(ParserErrorCode.EXPECTED_TOKEN, _currentToken.previous, [TokenType.SEMICOLON.lexeme]);
|
| }
|
| semicolon = createSyntheticToken2(TokenType.SEMICOLON);
|
| }
|
| @@ -3950,7 +3959,7 @@ class Parser {
|
| validateModifiersForTopLevelFunction(modifiers);
|
| return parseFunctionDeclaration(commentAndMetadata, modifiers.externalKeyword, returnType);
|
| } else if (matches(Keyword.OPERATOR) && isOperator(peek())) {
|
| - reportError12(ParserErrorCode.TOP_LEVEL_OPERATOR, _currentToken, []);
|
| + reportError13(ParserErrorCode.TOP_LEVEL_OPERATOR, _currentToken, []);
|
| return convertToFunctionDeclaration(parseOperator(commentAndMetadata, modifiers.externalKeyword, returnType));
|
| } else if (matchesIdentifier() && matchesAny(peek(), [
|
| TokenType.OPEN_PAREN,
|
| @@ -3967,28 +3976,28 @@ class Parser {
|
| //
|
| // We appear to have a variable declaration with a type of "void".
|
| //
|
| - reportError10(ParserErrorCode.VOID_VARIABLE, returnType, []);
|
| + reportError11(ParserErrorCode.VOID_VARIABLE, returnType, []);
|
| return new TopLevelVariableDeclaration(commentAndMetadata.comment, commentAndMetadata.metadata, parseVariableDeclarationList2(null, validateModifiersForTopLevelVariable(modifiers), null), expect2(TokenType.SEMICOLON));
|
| }
|
| }
|
| - reportError12(ParserErrorCode.EXPECTED_EXECUTABLE, _currentToken, []);
|
| + reportError13(ParserErrorCode.EXPECTED_EXECUTABLE, _currentToken, []);
|
| return null;
|
| }
|
| } else if ((matches(Keyword.GET) || matches(Keyword.SET)) && matchesIdentifier2(peek())) {
|
| validateModifiersForTopLevelFunction(modifiers);
|
| return parseFunctionDeclaration(commentAndMetadata, modifiers.externalKeyword, null);
|
| } else if (matches(Keyword.OPERATOR) && isOperator(peek())) {
|
| - reportError12(ParserErrorCode.TOP_LEVEL_OPERATOR, _currentToken, []);
|
| + reportError13(ParserErrorCode.TOP_LEVEL_OPERATOR, _currentToken, []);
|
| return convertToFunctionDeclaration(parseOperator(commentAndMetadata, modifiers.externalKeyword, null));
|
| } else if (!matchesIdentifier()) {
|
| - reportError12(ParserErrorCode.EXPECTED_EXECUTABLE, _currentToken, []);
|
| + reportError13(ParserErrorCode.EXPECTED_EXECUTABLE, _currentToken, []);
|
| return null;
|
| } else if (matches4(peek(), TokenType.OPEN_PAREN)) {
|
| validateModifiersForTopLevelFunction(modifiers);
|
| return parseFunctionDeclaration(commentAndMetadata, modifiers.externalKeyword, null);
|
| } else if (matchesAny(peek(), [TokenType.EQ, TokenType.COMMA, TokenType.SEMICOLON])) {
|
| if (modifiers.constKeyword == null && modifiers.finalKeyword == null && modifiers.varKeyword == null) {
|
| - reportError11(ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE, []);
|
| + reportError12(ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE, []);
|
| }
|
| return new TopLevelVariableDeclaration(commentAndMetadata.comment, commentAndMetadata.metadata, parseVariableDeclarationList2(null, validateModifiersForTopLevelVariable(modifiers), null), expect2(TokenType.SEMICOLON));
|
| }
|
| @@ -3997,13 +4006,13 @@ class Parser {
|
| validateModifiersForTopLevelFunction(modifiers);
|
| return parseFunctionDeclaration(commentAndMetadata, modifiers.externalKeyword, returnType);
|
| } else if (matches(Keyword.OPERATOR) && isOperator(peek())) {
|
| - reportError12(ParserErrorCode.TOP_LEVEL_OPERATOR, _currentToken, []);
|
| + reportError13(ParserErrorCode.TOP_LEVEL_OPERATOR, _currentToken, []);
|
| return convertToFunctionDeclaration(parseOperator(commentAndMetadata, modifiers.externalKeyword, returnType));
|
| } else if (matches5(TokenType.AT)) {
|
| return new TopLevelVariableDeclaration(commentAndMetadata.comment, commentAndMetadata.metadata, parseVariableDeclarationList2(null, validateModifiersForTopLevelVariable(modifiers), returnType), expect2(TokenType.SEMICOLON));
|
| } else if (!matchesIdentifier()) {
|
| // TODO(brianwilkerson) Generalize this error. We could also be parsing a top-level variable at this point.
|
| - reportError12(ParserErrorCode.EXPECTED_EXECUTABLE, _currentToken, []);
|
| + reportError13(ParserErrorCode.EXPECTED_EXECUTABLE, _currentToken, []);
|
| Token semicolon;
|
| if (matches5(TokenType.SEMICOLON)) {
|
| semicolon = andAdvance;
|
| @@ -4080,21 +4089,21 @@ class Parser {
|
| redirectedConstructor = parseConstructorName();
|
| body = new EmptyFunctionBody(expect2(TokenType.SEMICOLON));
|
| if (factoryKeyword == null) {
|
| - reportError10(ParserErrorCode.REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR, redirectedConstructor, []);
|
| + reportError11(ParserErrorCode.REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR, redirectedConstructor, []);
|
| }
|
| } else {
|
| body = parseFunctionBody(true, ParserErrorCode.MISSING_FUNCTION_BODY, false);
|
| if (constKeyword != null && factoryKeyword != null && externalKeyword == null) {
|
| - reportError12(ParserErrorCode.CONST_FACTORY, factoryKeyword, []);
|
| + reportError13(ParserErrorCode.CONST_FACTORY, factoryKeyword, []);
|
| } else if (body is EmptyFunctionBody) {
|
| if (factoryKeyword != null && externalKeyword == null) {
|
| - reportError12(ParserErrorCode.FACTORY_WITHOUT_BODY, factoryKeyword, []);
|
| + reportError13(ParserErrorCode.FACTORY_WITHOUT_BODY, factoryKeyword, []);
|
| }
|
| } else {
|
| if (constKeyword != null) {
|
| - reportError10(ParserErrorCode.CONST_CONSTRUCTOR_WITH_BODY, body, []);
|
| + reportError11(ParserErrorCode.CONST_CONSTRUCTOR_WITH_BODY, body, []);
|
| } else if (!bodyAllowed) {
|
| - reportError10(ParserErrorCode.EXTERNAL_CONSTRUCTOR_WITH_BODY, body, []);
|
| + reportError11(ParserErrorCode.EXTERNAL_CONSTRUCTOR_WITH_BODY, body, []);
|
| }
|
| }
|
| }
|
| @@ -4149,14 +4158,14 @@ class Parser {
|
| Statement parseContinueStatement() {
|
| Token continueKeyword = expect(Keyword.CONTINUE);
|
| if (!_inLoop && !_inSwitch) {
|
| - reportError12(ParserErrorCode.CONTINUE_OUTSIDE_OF_LOOP, continueKeyword, []);
|
| + reportError13(ParserErrorCode.CONTINUE_OUTSIDE_OF_LOOP, continueKeyword, []);
|
| }
|
| SimpleIdentifier label = null;
|
| if (matchesIdentifier()) {
|
| label = parseSimpleIdentifier();
|
| }
|
| if (_inSwitch && !_inLoop && label == null) {
|
| - reportError12(ParserErrorCode.CONTINUE_WITHOUT_LABEL_IN_CASE, continueKeyword, []);
|
| + reportError13(ParserErrorCode.CONTINUE_WITHOUT_LABEL_IN_CASE, continueKeyword, []);
|
| }
|
| Token semicolon = expect2(TokenType.SEMICOLON);
|
| return new ContinueStatement(continueKeyword, label, semicolon);
|
| @@ -4208,14 +4217,14 @@ class Parser {
|
| Token commentToken = _currentToken.precedingComments;
|
| while (commentToken != null) {
|
| if (identical(commentToken.type, TokenType.SINGLE_LINE_COMMENT)) {
|
| - if (commentToken.lexeme.startsWith("///")) {
|
| - if (commentTokens.length == 1 && commentTokens[0].lexeme.startsWith("/**")) {
|
| + if (StringUtilities.startsWith3(commentToken.lexeme, 0, 0x2F, 0x2F, 0x2F)) {
|
| + if (commentTokens.length == 1 && StringUtilities.startsWith3(commentTokens[0].lexeme, 0, 0x2F, 0x2A, 0x2A)) {
|
| commentTokens.clear();
|
| }
|
| commentTokens.add(commentToken);
|
| }
|
| } else {
|
| - if (commentToken.lexeme.startsWith("/**")) {
|
| + if (StringUtilities.startsWith3(commentToken.lexeme, 0, 0x2F, 0x2A, 0x2A)) {
|
| commentTokens.clear();
|
| commentTokens.add(commentToken);
|
| }
|
| @@ -4248,7 +4257,7 @@ class Parser {
|
| Statement body = parseStatement2();
|
| Token whileKeyword = expect(Keyword.WHILE);
|
| Token leftParenthesis = expect2(TokenType.OPEN_PAREN);
|
| - Expression condition = parseExpression3();
|
| + Expression condition = parseExpression4();
|
| Token rightParenthesis = expect2(TokenType.CLOSE_PAREN);
|
| Token semicolon = expect2(TokenType.SEMICOLON);
|
| return new DoStatement(doKeyword, body, whileKeyword, leftParenthesis, condition, rightParenthesis, semicolon);
|
| @@ -4291,7 +4300,7 @@ class Parser {
|
| while (_currentToken.type.isEqualityOperator) {
|
| Token operator = andAdvance;
|
| if (leftEqualityExpression) {
|
| - reportError10(ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND, expression, []);
|
| + reportError11(ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND, expression, []);
|
| }
|
| expression = new BinaryExpression(expression, operator, parseRelationalExpression());
|
| leftEqualityExpression = true;
|
| @@ -4330,9 +4339,9 @@ class Parser {
|
| */
|
| List<Expression> parseExpressionList() {
|
| List<Expression> expressions = new List<Expression>();
|
| - expressions.add(parseExpression3());
|
| + expressions.add(parseExpression4());
|
| while (optional(TokenType.COMMA)) {
|
| - expressions.add(parseExpression3());
|
| + expressions.add(parseExpression4());
|
| }
|
| return expressions;
|
| }
|
| @@ -4365,7 +4374,7 @@ class Parser {
|
| if (isTypedIdentifier(_currentToken)) {
|
| type = parseReturnType();
|
| } else if (!optional) {
|
| - reportError11(ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE, []);
|
| + reportError12(ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE, []);
|
| }
|
| }
|
| return new FinalConstVarOrType(keyword, type);
|
| @@ -4391,20 +4400,20 @@ class Parser {
|
| NormalFormalParameter parameter = parseNormalFormalParameter();
|
| if (matches5(TokenType.EQ)) {
|
| Token seperator = andAdvance;
|
| - Expression defaultValue = parseExpression3();
|
| + Expression defaultValue = parseExpression4();
|
| if (identical(kind, ParameterKind.NAMED)) {
|
| - reportError12(ParserErrorCode.WRONG_SEPARATOR_FOR_NAMED_PARAMETER, seperator, []);
|
| + reportError13(ParserErrorCode.WRONG_SEPARATOR_FOR_NAMED_PARAMETER, seperator, []);
|
| } else if (identical(kind, ParameterKind.REQUIRED)) {
|
| - reportError10(ParserErrorCode.POSITIONAL_PARAMETER_OUTSIDE_GROUP, parameter, []);
|
| + reportError11(ParserErrorCode.POSITIONAL_PARAMETER_OUTSIDE_GROUP, parameter, []);
|
| }
|
| return new DefaultFormalParameter(parameter, kind, seperator, defaultValue);
|
| } else if (matches5(TokenType.COLON)) {
|
| Token seperator = andAdvance;
|
| - Expression defaultValue = parseExpression3();
|
| + Expression defaultValue = parseExpression4();
|
| if (identical(kind, ParameterKind.POSITIONAL)) {
|
| - reportError12(ParserErrorCode.WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER, seperator, []);
|
| + reportError13(ParserErrorCode.WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER, seperator, []);
|
| } else if (identical(kind, ParameterKind.REQUIRED)) {
|
| - reportError10(ParserErrorCode.NAMED_PARAMETER_OUTSIDE_GROUP, parameter, []);
|
| + reportError11(ParserErrorCode.NAMED_PARAMETER_OUTSIDE_GROUP, parameter, []);
|
| }
|
| return new DefaultFormalParameter(parameter, kind, seperator, defaultValue);
|
| } else if (kind != ParameterKind.REQUIRED) {
|
| @@ -4450,22 +4459,22 @@ class Parser {
|
| } else if (isInitializedVariableDeclaration()) {
|
| variableList = parseVariableDeclarationList(commentAndMetadata);
|
| } else {
|
| - initialization = parseExpression3();
|
| + initialization = parseExpression4();
|
| }
|
| if (matches(Keyword.IN)) {
|
| DeclaredIdentifier loopVariable = null;
|
| SimpleIdentifier identifier = null;
|
| if (variableList == null) {
|
| // We found: <expression> 'in'
|
| - reportError11(ParserErrorCode.MISSING_VARIABLE_IN_FOR_EACH, []);
|
| + reportError12(ParserErrorCode.MISSING_VARIABLE_IN_FOR_EACH, []);
|
| } else {
|
| NodeList<VariableDeclaration> variables = variableList.variables;
|
| if (variables.length > 1) {
|
| - reportError11(ParserErrorCode.MULTIPLE_VARIABLES_IN_FOR_EACH, [variables.length.toString()]);
|
| + reportError12(ParserErrorCode.MULTIPLE_VARIABLES_IN_FOR_EACH, [variables.length.toString()]);
|
| }
|
| VariableDeclaration variable = variables[0];
|
| if (variable.initializer != null) {
|
| - reportError11(ParserErrorCode.INITIALIZED_VARIABLE_IN_FOR_EACH, []);
|
| + reportError12(ParserErrorCode.INITIALIZED_VARIABLE_IN_FOR_EACH, []);
|
| }
|
| Token keyword = variableList.keyword;
|
| TypeName type = variableList.type;
|
| @@ -4478,7 +4487,7 @@ class Parser {
|
| }
|
| }
|
| Token inKeyword = expect(Keyword.IN);
|
| - Expression iterator = parseExpression3();
|
| + Expression iterator = parseExpression4();
|
| Token rightParenthesis = expect2(TokenType.CLOSE_PAREN);
|
| Statement body = parseStatement2();
|
| if (loopVariable == null) {
|
| @@ -4490,7 +4499,7 @@ class Parser {
|
| Token leftSeparator = expect2(TokenType.SEMICOLON);
|
| Expression condition = null;
|
| if (!matches5(TokenType.SEMICOLON)) {
|
| - condition = parseExpression3();
|
| + condition = parseExpression4();
|
| }
|
| Token rightSeparator = expect2(TokenType.SEMICOLON);
|
| List<Expression> updaters = null;
|
| @@ -4532,12 +4541,12 @@ class Parser {
|
| try {
|
| if (matches5(TokenType.SEMICOLON)) {
|
| if (!mayBeEmpty) {
|
| - reportError11(emptyErrorCode, []);
|
| + reportError12(emptyErrorCode, []);
|
| }
|
| return new EmptyFunctionBody(andAdvance);
|
| } else if (matches5(TokenType.FUNCTION)) {
|
| Token functionDefinition = andAdvance;
|
| - Expression expression = parseExpression3();
|
| + Expression expression = parseExpression4();
|
| Token semicolon = null;
|
| if (!inExpression) {
|
| semicolon = expect2(TokenType.SEMICOLON);
|
| @@ -4561,7 +4570,7 @@ class Parser {
|
| return new NativeFunctionBody(nativeToken, stringLiteral, expect2(TokenType.SEMICOLON));
|
| } else {
|
| // Invalid function body
|
| - reportError11(emptyErrorCode, []);
|
| + reportError12(emptyErrorCode, []);
|
| return new EmptyFunctionBody(createSyntheticToken2(TokenType.SEMICOLON));
|
| }
|
| } finally {
|
| @@ -4602,10 +4611,10 @@ class Parser {
|
| parameters = parseFormalParameterList();
|
| validateFormalParameterList(parameters);
|
| } else {
|
| - reportError11(ParserErrorCode.MISSING_FUNCTION_PARAMETERS, []);
|
| + reportError12(ParserErrorCode.MISSING_FUNCTION_PARAMETERS, []);
|
| }
|
| } else if (matches5(TokenType.OPEN_PAREN)) {
|
| - reportError11(ParserErrorCode.GETTER_WITH_PARAMETERS, []);
|
| + reportError12(ParserErrorCode.GETTER_WITH_PARAMETERS, []);
|
| parseFormalParameterList();
|
| }
|
| FunctionBody body;
|
| @@ -4656,9 +4665,9 @@ class Parser {
|
| Token propertyKeyword = declaration.propertyKeyword;
|
| if (propertyKeyword != null) {
|
| if (identical((propertyKeyword as KeywordToken).keyword, Keyword.GET)) {
|
| - reportError12(ParserErrorCode.GETTER_IN_FUNCTION, propertyKeyword, []);
|
| + reportError13(ParserErrorCode.GETTER_IN_FUNCTION, propertyKeyword, []);
|
| } else {
|
| - reportError12(ParserErrorCode.SETTER_IN_FUNCTION, propertyKeyword, []);
|
| + reportError13(ParserErrorCode.SETTER_IN_FUNCTION, propertyKeyword, []);
|
| }
|
| }
|
| return new FunctionDeclarationStatement(declaration);
|
| @@ -4690,12 +4699,12 @@ class Parser {
|
| typeParameters = parseTypeParameterList();
|
| }
|
| if (matches5(TokenType.SEMICOLON) || matches5(TokenType.EOF)) {
|
| - reportError11(ParserErrorCode.MISSING_TYPEDEF_PARAMETERS, []);
|
| + reportError12(ParserErrorCode.MISSING_TYPEDEF_PARAMETERS, []);
|
| FormalParameterList parameters = new FormalParameterList(createSyntheticToken2(TokenType.OPEN_PAREN), null, null, null, createSyntheticToken2(TokenType.CLOSE_PAREN));
|
| Token semicolon = expect2(TokenType.SEMICOLON);
|
| return new FunctionTypeAlias(commentAndMetadata.comment, commentAndMetadata.metadata, keyword, returnType, name, typeParameters, parameters, semicolon);
|
| } else if (!matches5(TokenType.OPEN_PAREN)) {
|
| - reportError11(ParserErrorCode.MISSING_TYPEDEF_PARAMETERS, []);
|
| + reportError12(ParserErrorCode.MISSING_TYPEDEF_PARAMETERS, []);
|
| // TODO(brianwilkerson) Recover from this error. At the very least we should skip to the start
|
| // of the next valid compilation unit member, allowing for the possibility of finding the
|
| // typedef parameters before that point.
|
| @@ -4730,13 +4739,13 @@ class Parser {
|
| Token propertyKeyword = expect(Keyword.GET);
|
| SimpleIdentifier name = parseSimpleIdentifier();
|
| if (matches5(TokenType.OPEN_PAREN) && matches4(peek(), TokenType.CLOSE_PAREN)) {
|
| - reportError11(ParserErrorCode.GETTER_WITH_PARAMETERS, []);
|
| + reportError12(ParserErrorCode.GETTER_WITH_PARAMETERS, []);
|
| advance();
|
| advance();
|
| }
|
| FunctionBody body = parseFunctionBody(externalKeyword != null || staticKeyword == null, ParserErrorCode.STATIC_GETTER_WITHOUT_BODY, false);
|
| if (externalKeyword != null && body is! EmptyFunctionBody) {
|
| - reportError11(ParserErrorCode.EXTERNAL_GETTER_WITH_BODY, []);
|
| + reportError12(ParserErrorCode.EXTERNAL_GETTER_WITH_BODY, []);
|
| }
|
| return new MethodDeclaration(commentAndMetadata.comment, commentAndMetadata.metadata, externalKeyword, staticKeyword, returnType, propertyKeyword, null, name, null, body);
|
| }
|
| @@ -4774,7 +4783,7 @@ class Parser {
|
| Statement parseIfStatement() {
|
| Token ifKeyword = expect(Keyword.IF);
|
| Token leftParenthesis = expect2(TokenType.OPEN_PAREN);
|
| - Expression condition = parseExpression3();
|
| + Expression condition = parseExpression4();
|
| Token rightParenthesis = expect2(TokenType.CLOSE_PAREN);
|
| Statement thenStatement = parseStatement2();
|
| Token elseKeyword = null;
|
| @@ -4894,9 +4903,9 @@ class Parser {
|
| // TODO(brianwilkerson) Recovery: This should be extended to handle arbitrary tokens until we
|
| // can find a token that can start a compilation unit member.
|
| StringLiteral string = parseStringLiteral();
|
| - reportError10(ParserErrorCode.NON_IDENTIFIER_LIBRARY_NAME, string, []);
|
| + reportError11(ParserErrorCode.NON_IDENTIFIER_LIBRARY_NAME, string, []);
|
| } else {
|
| - reportError12(missingNameError, missingNameToken, []);
|
| + reportError13(missingNameError, missingNameToken, []);
|
| }
|
| List<SimpleIdentifier> components = new List<SimpleIdentifier>();
|
| components.add(createSyntheticIdentifier());
|
| @@ -4935,12 +4944,12 @@ class Parser {
|
| return new ListLiteral(modifier, typeArguments, leftBracket, null, andAdvance);
|
| }
|
| List<Expression> elements = new List<Expression>();
|
| - elements.add(parseExpression3());
|
| + elements.add(parseExpression4());
|
| while (optional(TokenType.COMMA)) {
|
| if (matches5(TokenType.CLOSE_SQUARE_BRACKET)) {
|
| return new ListLiteral(modifier, typeArguments, leftBracket, elements, andAdvance);
|
| }
|
| - elements.add(parseExpression3());
|
| + elements.add(parseExpression4());
|
| }
|
| Token rightBracket = expect2(TokenType.CLOSE_SQUARE_BRACKET);
|
| return new ListLiteral(modifier, typeArguments, leftBracket, elements, rightBracket);
|
| @@ -4969,7 +4978,7 @@ class Parser {
|
| } else if (matches5(TokenType.OPEN_SQUARE_BRACKET) || matches5(TokenType.INDEX)) {
|
| return parseListLiteral(modifier, typeArguments);
|
| }
|
| - reportError11(ParserErrorCode.EXPECTED_LIST_OR_MAP_LITERAL, []);
|
| + reportError12(ParserErrorCode.EXPECTED_LIST_OR_MAP_LITERAL, []);
|
| return new ListLiteral(modifier, typeArguments, createSyntheticToken2(TokenType.OPEN_SQUARE_BRACKET), null, createSyntheticToken2(TokenType.CLOSE_SQUARE_BRACKET));
|
| }
|
|
|
| @@ -5068,11 +5077,11 @@ class Parser {
|
| FunctionBody body = parseFunctionBody(externalKeyword != null || staticKeyword == null, ParserErrorCode.MISSING_FUNCTION_BODY, false);
|
| if (externalKeyword != null) {
|
| if (body is! EmptyFunctionBody) {
|
| - reportError10(ParserErrorCode.EXTERNAL_METHOD_WITH_BODY, body, []);
|
| + reportError11(ParserErrorCode.EXTERNAL_METHOD_WITH_BODY, body, []);
|
| }
|
| } else if (staticKeyword != null) {
|
| if (body is EmptyFunctionBody) {
|
| - reportError10(ParserErrorCode.ABSTRACT_STATIC_METHOD, body, []);
|
| + reportError11(ParserErrorCode.ABSTRACT_STATIC_METHOD, body, []);
|
| }
|
| }
|
| return new MethodDeclaration(commentAndMetadata.comment, commentAndMetadata.metadata, externalKeyword, staticKeyword, returnType, null, null, name, parameters, body);
|
| @@ -5100,49 +5109,49 @@ class Parser {
|
| }
|
| if (matches(Keyword.ABSTRACT)) {
|
| if (modifiers.abstractKeyword != null) {
|
| - reportError11(ParserErrorCode.DUPLICATED_MODIFIER, [_currentToken.lexeme]);
|
| + reportError12(ParserErrorCode.DUPLICATED_MODIFIER, [_currentToken.lexeme]);
|
| advance();
|
| } else {
|
| modifiers.abstractKeyword = andAdvance;
|
| }
|
| } else if (matches(Keyword.CONST)) {
|
| if (modifiers.constKeyword != null) {
|
| - reportError11(ParserErrorCode.DUPLICATED_MODIFIER, [_currentToken.lexeme]);
|
| + reportError12(ParserErrorCode.DUPLICATED_MODIFIER, [_currentToken.lexeme]);
|
| advance();
|
| } else {
|
| modifiers.constKeyword = andAdvance;
|
| }
|
| } else if (matches(Keyword.EXTERNAL) && !matches4(peek(), TokenType.PERIOD) && !matches4(peek(), TokenType.LT)) {
|
| if (modifiers.externalKeyword != null) {
|
| - reportError11(ParserErrorCode.DUPLICATED_MODIFIER, [_currentToken.lexeme]);
|
| + reportError12(ParserErrorCode.DUPLICATED_MODIFIER, [_currentToken.lexeme]);
|
| advance();
|
| } else {
|
| modifiers.externalKeyword = andAdvance;
|
| }
|
| } else if (matches(Keyword.FACTORY) && !matches4(peek(), TokenType.PERIOD) && !matches4(peek(), TokenType.LT)) {
|
| if (modifiers.factoryKeyword != null) {
|
| - reportError11(ParserErrorCode.DUPLICATED_MODIFIER, [_currentToken.lexeme]);
|
| + reportError12(ParserErrorCode.DUPLICATED_MODIFIER, [_currentToken.lexeme]);
|
| advance();
|
| } else {
|
| modifiers.factoryKeyword = andAdvance;
|
| }
|
| } else if (matches(Keyword.FINAL)) {
|
| if (modifiers.finalKeyword != null) {
|
| - reportError11(ParserErrorCode.DUPLICATED_MODIFIER, [_currentToken.lexeme]);
|
| + reportError12(ParserErrorCode.DUPLICATED_MODIFIER, [_currentToken.lexeme]);
|
| advance();
|
| } else {
|
| modifiers.finalKeyword = andAdvance;
|
| }
|
| } else if (matches(Keyword.STATIC) && !matches4(peek(), TokenType.PERIOD) && !matches4(peek(), TokenType.LT)) {
|
| if (modifiers.staticKeyword != null) {
|
| - reportError11(ParserErrorCode.DUPLICATED_MODIFIER, [_currentToken.lexeme]);
|
| + reportError12(ParserErrorCode.DUPLICATED_MODIFIER, [_currentToken.lexeme]);
|
| advance();
|
| } else {
|
| modifiers.staticKeyword = andAdvance;
|
| }
|
| } else if (matches(Keyword.VAR)) {
|
| if (modifiers.varKeyword != null) {
|
| - reportError11(ParserErrorCode.DUPLICATED_MODIFIER, [_currentToken.lexeme]);
|
| + reportError12(ParserErrorCode.DUPLICATED_MODIFIER, [_currentToken.lexeme]);
|
| advance();
|
| } else {
|
| modifiers.varKeyword = andAdvance;
|
| @@ -5237,7 +5246,7 @@ class Parser {
|
| if (matches4(peek(), TokenType.STRING)) {
|
| Token afterString = skipStringLiteral(_currentToken.next);
|
| if (afterString != null && identical(afterString.type, TokenType.COLON)) {
|
| - return new ExpressionStatement(parseExpression3(), expect2(TokenType.SEMICOLON));
|
| + return new ExpressionStatement(parseExpression4(), expect2(TokenType.SEMICOLON));
|
| }
|
| }
|
| return parseBlock();
|
| @@ -5286,7 +5295,7 @@ class Parser {
|
| //
|
| // We appear to have a variable declaration with a type of "void".
|
| //
|
| - reportError10(ParserErrorCode.VOID_VARIABLE, returnType, []);
|
| + reportError11(ParserErrorCode.VOID_VARIABLE, returnType, []);
|
| return parseVariableDeclarationStatement(commentAndMetadata);
|
| }
|
| } else if (matches5(TokenType.CLOSE_CURLY_BRACKET)) {
|
| @@ -5296,7 +5305,7 @@ class Parser {
|
| //
|
| return parseVariableDeclarationStatement2(commentAndMetadata, null, returnType);
|
| }
|
| - reportError11(ParserErrorCode.MISSING_STATEMENT, []);
|
| + reportError12(ParserErrorCode.MISSING_STATEMENT, []);
|
| // TODO(brianwilkerson) Recover from this error.
|
| return new EmptyStatement(createSyntheticToken2(TokenType.SEMICOLON));
|
| }
|
| @@ -5306,23 +5315,23 @@ class Parser {
|
| TokenType.OPEN_CURLY_BRACKET,
|
| TokenType.OPEN_SQUARE_BRACKET,
|
| TokenType.INDEX])) {
|
| - return new ExpressionStatement(parseExpression3(), expect2(TokenType.SEMICOLON));
|
| + return new ExpressionStatement(parseExpression4(), expect2(TokenType.SEMICOLON));
|
| } else if (matches4(peek(), TokenType.IDENTIFIER)) {
|
| Token afterType = skipTypeName(peek());
|
| if (afterType != null) {
|
| if (matches4(afterType, TokenType.OPEN_PAREN) || (matches4(afterType, TokenType.PERIOD) && matches4(afterType.next, TokenType.IDENTIFIER) && matches4(afterType.next.next, TokenType.OPEN_PAREN))) {
|
| - return new ExpressionStatement(parseExpression3(), expect2(TokenType.SEMICOLON));
|
| + return new ExpressionStatement(parseExpression4(), expect2(TokenType.SEMICOLON));
|
| }
|
| }
|
| }
|
| return parseVariableDeclarationStatement(commentAndMetadata);
|
| } else if (identical(keyword, Keyword.NEW) || identical(keyword, Keyword.TRUE) || identical(keyword, Keyword.FALSE) || identical(keyword, Keyword.NULL) || identical(keyword, Keyword.SUPER) || identical(keyword, Keyword.THIS)) {
|
| - return new ExpressionStatement(parseExpression3(), expect2(TokenType.SEMICOLON));
|
| + return new ExpressionStatement(parseExpression4(), expect2(TokenType.SEMICOLON));
|
| } else {
|
| //
|
| // We have found an error of some kind. Try to recover.
|
| //
|
| - reportError11(ParserErrorCode.MISSING_STATEMENT, []);
|
| + reportError12(ParserErrorCode.MISSING_STATEMENT, []);
|
| return new EmptyStatement(createSyntheticToken2(TokenType.SEMICOLON));
|
| }
|
| } else if (matches5(TokenType.SEMICOLON)) {
|
| @@ -5332,10 +5341,10 @@ class Parser {
|
| } else if (isFunctionDeclaration()) {
|
| return parseFunctionDeclarationStatement();
|
| } else if (matches5(TokenType.CLOSE_CURLY_BRACKET)) {
|
| - reportError11(ParserErrorCode.MISSING_STATEMENT, []);
|
| + reportError12(ParserErrorCode.MISSING_STATEMENT, []);
|
| return new EmptyStatement(createSyntheticToken2(TokenType.SEMICOLON));
|
| } else {
|
| - return new ExpressionStatement(parseExpression3(), expect2(TokenType.SEMICOLON));
|
| + return new ExpressionStatement(parseExpression4(), expect2(TokenType.SEMICOLON));
|
| }
|
| }
|
|
|
| @@ -5362,17 +5371,17 @@ class Parser {
|
| if (matches(Keyword.OPERATOR)) {
|
| operatorKeyword = andAdvance;
|
| } else {
|
| - reportError12(ParserErrorCode.MISSING_KEYWORD_OPERATOR, _currentToken, []);
|
| + reportError13(ParserErrorCode.MISSING_KEYWORD_OPERATOR, _currentToken, []);
|
| operatorKeyword = createSyntheticToken(Keyword.OPERATOR);
|
| }
|
| if (!_currentToken.isUserDefinableOperator) {
|
| - reportError11(ParserErrorCode.NON_USER_DEFINABLE_OPERATOR, [_currentToken.lexeme]);
|
| + reportError12(ParserErrorCode.NON_USER_DEFINABLE_OPERATOR, [_currentToken.lexeme]);
|
| }
|
| SimpleIdentifier name = new SimpleIdentifier(andAdvance);
|
| if (matches5(TokenType.EQ)) {
|
| Token previous = _currentToken.previous;
|
| if ((matches4(previous, TokenType.EQ_EQ) || matches4(previous, TokenType.BANG_EQ)) && _currentToken.offset == previous.offset + 2) {
|
| - reportError11(ParserErrorCode.INVALID_OPERATOR, ["${previous.lexeme}${_currentToken.lexeme}"]);
|
| + reportError12(ParserErrorCode.INVALID_OPERATOR, ["${previous.lexeme}${_currentToken.lexeme}"]);
|
| advance();
|
| }
|
| }
|
| @@ -5380,7 +5389,7 @@ class Parser {
|
| validateFormalParameterList(parameters);
|
| FunctionBody body = parseFunctionBody(true, ParserErrorCode.MISSING_FUNCTION_BODY, false);
|
| if (externalKeyword != null && body is! EmptyFunctionBody) {
|
| - reportError11(ParserErrorCode.EXTERNAL_OPERATOR_WITH_BODY, []);
|
| + reportError12(ParserErrorCode.EXTERNAL_OPERATOR_WITH_BODY, []);
|
| }
|
| return new MethodDeclaration(commentAndMetadata.comment, commentAndMetadata.metadata, externalKeyword, null, returnType, null, operatorKeyword, name, parameters, body);
|
| }
|
| @@ -5465,7 +5474,7 @@ class Parser {
|
| return operand;
|
| }
|
| if (operand is Literal || operand is FunctionExpressionInvocation) {
|
| - reportError11(ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR, []);
|
| + reportError12(ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR, []);
|
| }
|
| Token operator = andAdvance;
|
| return new PostfixExpression(operand, operator);
|
| @@ -5560,7 +5569,7 @@ class Parser {
|
| return parseFunctionExpression();
|
| }
|
| Token leftParenthesis = andAdvance;
|
| - Expression expression = parseExpression3();
|
| + Expression expression = parseExpression4();
|
| Token rightParenthesis = expect2(TokenType.CLOSE_PAREN);
|
| return new ParenthesizedExpression(leftParenthesis, expression, rightParenthesis);
|
| } else if (matches5(TokenType.LT)) {
|
| @@ -5572,13 +5581,13 @@ class Parser {
|
| // Recover from having a return type of "void" where a return type is not expected.
|
| //
|
| // TODO(brianwilkerson) Improve this error message.
|
| - reportError11(ParserErrorCode.UNEXPECTED_TOKEN, [_currentToken.lexeme]);
|
| + reportError12(ParserErrorCode.UNEXPECTED_TOKEN, [_currentToken.lexeme]);
|
| advance();
|
| return parsePrimaryExpression();
|
| } else if (matches5(TokenType.HASH)) {
|
| return parseSymbolLiteral();
|
| } else {
|
| - reportError11(ParserErrorCode.MISSING_IDENTIFIER, []);
|
| + reportError12(ParserErrorCode.MISSING_IDENTIFIER, []);
|
| return createSyntheticIdentifier();
|
| }
|
| }
|
| @@ -5668,7 +5677,7 @@ class Parser {
|
| if (matches5(TokenType.SEMICOLON)) {
|
| return new ReturnStatement(returnKeyword, null, andAdvance);
|
| }
|
| - Expression expression = parseExpression3();
|
| + Expression expression = parseExpression4();
|
| Token semicolon = expect2(TokenType.SEMICOLON);
|
| return new ReturnStatement(returnKeyword, expression, semicolon);
|
| }
|
| @@ -5699,7 +5708,7 @@ class Parser {
|
| validateFormalParameterList(parameters);
|
| FunctionBody body = parseFunctionBody(externalKeyword != null || staticKeyword == null, ParserErrorCode.STATIC_SETTER_WITHOUT_BODY, false);
|
| if (externalKeyword != null && body is! EmptyFunctionBody) {
|
| - reportError11(ParserErrorCode.EXTERNAL_SETTER_WITH_BODY, []);
|
| + reportError12(ParserErrorCode.EXTERNAL_SETTER_WITH_BODY, []);
|
| }
|
| return new MethodDeclaration(commentAndMetadata.comment, commentAndMetadata.metadata, externalKeyword, staticKeyword, returnType, propertyKeyword, null, name, parameters, body);
|
| }
|
| @@ -5745,7 +5754,7 @@ class Parser {
|
| while (!matches5(TokenType.EOF) && !matches5(TokenType.CLOSE_CURLY_BRACKET) && !isSwitchMember()) {
|
| statements.add(parseStatement2());
|
| if (identical(_currentToken, statementStart)) {
|
| - reportError12(ParserErrorCode.UNEXPECTED_TOKEN, _currentToken, [_currentToken.lexeme]);
|
| + reportError13(ParserErrorCode.UNEXPECTED_TOKEN, _currentToken, [_currentToken.lexeme]);
|
| advance();
|
| }
|
| statementStart = _currentToken;
|
| @@ -5765,7 +5774,7 @@ class Parser {
|
| while (hasMore) {
|
| if (matches5(TokenType.STRING_INTERPOLATION_EXPRESSION)) {
|
| Token openToken = andAdvance;
|
| - Expression expression = parseExpression3();
|
| + Expression expression = parseExpression4();
|
| Token rightBracket = expect2(TokenType.CLOSE_CURLY_BRACKET);
|
| elements.add(new InterpolationExpression(openToken, expression, rightBracket));
|
| } else {
|
| @@ -5832,7 +5841,7 @@ class Parser {
|
| Set<String> definedLabels = new Set<String>();
|
| Token keyword = expect(Keyword.SWITCH);
|
| Token leftParenthesis = expect2(TokenType.OPEN_PAREN);
|
| - Expression expression = parseExpression3();
|
| + Expression expression = parseExpression4();
|
| Token rightParenthesis = expect2(TokenType.CLOSE_PAREN);
|
| Token leftBracket = expect2(TokenType.OPEN_CURLY_BRACKET);
|
| Token defaultKeyword = null;
|
| @@ -5843,7 +5852,7 @@ class Parser {
|
| SimpleIdentifier identifier = parseSimpleIdentifier();
|
| String label = identifier.token.lexeme;
|
| if (definedLabels.contains(label)) {
|
| - reportError12(ParserErrorCode.DUPLICATE_LABEL_IN_SWITCH_STATEMENT, identifier.token, [label]);
|
| + reportError13(ParserErrorCode.DUPLICATE_LABEL_IN_SWITCH_STATEMENT, identifier.token, [label]);
|
| } else {
|
| definedLabels.add(label);
|
| }
|
| @@ -5852,15 +5861,15 @@ class Parser {
|
| }
|
| if (matches(Keyword.CASE)) {
|
| Token caseKeyword = andAdvance;
|
| - Expression caseExpression = parseExpression3();
|
| + Expression caseExpression = parseExpression4();
|
| Token colon = expect2(TokenType.COLON);
|
| members.add(new SwitchCase(labels, caseKeyword, caseExpression, colon, parseStatements2()));
|
| if (defaultKeyword != null) {
|
| - reportError12(ParserErrorCode.SWITCH_HAS_CASE_AFTER_DEFAULT_CASE, caseKeyword, []);
|
| + reportError13(ParserErrorCode.SWITCH_HAS_CASE_AFTER_DEFAULT_CASE, caseKeyword, []);
|
| }
|
| } else if (matches(Keyword.DEFAULT)) {
|
| if (defaultKeyword != null) {
|
| - reportError12(ParserErrorCode.SWITCH_HAS_MULTIPLE_DEFAULT_CASES, peek(), []);
|
| + reportError13(ParserErrorCode.SWITCH_HAS_MULTIPLE_DEFAULT_CASES, peek(), []);
|
| }
|
| defaultKeyword = andAdvance;
|
| Token colon = expect2(TokenType.COLON);
|
| @@ -5868,7 +5877,7 @@ class Parser {
|
| } else {
|
| // We need to advance, otherwise we could end up in an infinite loop, but this could be a
|
| // lot smarter about recovering from the error.
|
| - reportError11(ParserErrorCode.EXPECTED_CASE_OR_DEFAULT, []);
|
| + reportError12(ParserErrorCode.EXPECTED_CASE_OR_DEFAULT, []);
|
| while (!matches5(TokenType.EOF) && !matches5(TokenType.CLOSE_CURLY_BRACKET) && !matches(Keyword.CASE) && !matches(Keyword.DEFAULT)) {
|
| advance();
|
| }
|
| @@ -5901,7 +5910,7 @@ class Parser {
|
| if (matchesIdentifier()) {
|
| components.add(andAdvance);
|
| } else {
|
| - reportError11(ParserErrorCode.MISSING_IDENTIFIER, []);
|
| + reportError12(ParserErrorCode.MISSING_IDENTIFIER, []);
|
| components.add(createSyntheticToken2(TokenType.IDENTIFIER));
|
| break;
|
| }
|
| @@ -5909,7 +5918,7 @@ class Parser {
|
| } else if (_currentToken.isOperator) {
|
| components.add(andAdvance);
|
| } else {
|
| - reportError11(ParserErrorCode.MISSING_IDENTIFIER, []);
|
| + reportError12(ParserErrorCode.MISSING_IDENTIFIER, []);
|
| components.add(createSyntheticToken2(TokenType.IDENTIFIER));
|
| }
|
| return new SymbolLiteral(poundSign, new List.from(components));
|
| @@ -5928,10 +5937,10 @@ class Parser {
|
| Expression parseThrowExpression() {
|
| Token keyword = expect(Keyword.THROW);
|
| if (matches5(TokenType.SEMICOLON) || matches5(TokenType.CLOSE_PAREN)) {
|
| - reportError12(ParserErrorCode.MISSING_EXPRESSION_IN_THROW, _currentToken, []);
|
| + reportError13(ParserErrorCode.MISSING_EXPRESSION_IN_THROW, _currentToken, []);
|
| return new ThrowExpression(keyword, createSyntheticIdentifier());
|
| }
|
| - Expression expression = parseExpression3();
|
| + Expression expression = parseExpression4();
|
| return new ThrowExpression(keyword, expression);
|
| }
|
|
|
| @@ -5948,7 +5957,7 @@ class Parser {
|
| Expression parseThrowExpressionWithoutCascade() {
|
| Token keyword = expect(Keyword.THROW);
|
| if (matches5(TokenType.SEMICOLON) || matches5(TokenType.CLOSE_PAREN)) {
|
| - reportError12(ParserErrorCode.MISSING_EXPRESSION_IN_THROW, _currentToken, []);
|
| + reportError13(ParserErrorCode.MISSING_EXPRESSION_IN_THROW, _currentToken, []);
|
| return new ThrowExpression(keyword, createSyntheticIdentifier());
|
| }
|
| Expression expression = parseExpressionWithoutCascade();
|
| @@ -6012,7 +6021,7 @@ class Parser {
|
| finallyClause = parseBlock();
|
| } else {
|
| if (catchClauses.isEmpty) {
|
| - reportError11(ParserErrorCode.MISSING_CATCH_OR_FINALLY, []);
|
| + reportError12(ParserErrorCode.MISSING_CATCH_OR_FINALLY, []);
|
| }
|
| }
|
| return new TryStatement(tryKeyword, body, catchClauses, finallyKeyword, finallyClause);
|
| @@ -6053,12 +6062,12 @@ class Parser {
|
| next = skipTypeParameterList(next);
|
| if (next != null && matches4(next, TokenType.EQ)) {
|
| TypeAlias typeAlias = parseClassTypeAlias(commentAndMetadata, null, keyword);
|
| - reportError12(ParserErrorCode.DEPRECATED_CLASS_TYPE_ALIAS, keyword, []);
|
| + reportError13(ParserErrorCode.DEPRECATED_CLASS_TYPE_ALIAS, keyword, []);
|
| return typeAlias;
|
| }
|
| } else if (matches4(next, TokenType.EQ)) {
|
| TypeAlias typeAlias = parseClassTypeAlias(commentAndMetadata, null, keyword);
|
| - reportError12(ParserErrorCode.DEPRECATED_CLASS_TYPE_ALIAS, keyword, []);
|
| + reportError13(ParserErrorCode.DEPRECATED_CLASS_TYPE_ALIAS, keyword, []);
|
| return typeAlias;
|
| }
|
| }
|
| @@ -6115,13 +6124,13 @@ class Parser {
|
| return new PrefixExpression(firstOperator, new PrefixExpression(secondOperator, new SuperExpression(andAdvance)));
|
| } else {
|
| // Invalid operator before 'super'
|
| - reportError11(ParserErrorCode.INVALID_OPERATOR_FOR_SUPER, [operator.lexeme]);
|
| + reportError12(ParserErrorCode.INVALID_OPERATOR_FOR_SUPER, [operator.lexeme]);
|
| return new PrefixExpression(operator, new SuperExpression(andAdvance));
|
| }
|
| }
|
| return new PrefixExpression(operator, parseAssignableExpression(false));
|
| } else if (matches5(TokenType.PLUS)) {
|
| - reportError11(ParserErrorCode.MISSING_IDENTIFIER, []);
|
| + reportError12(ParserErrorCode.MISSING_IDENTIFIER, []);
|
| return createSyntheticIdentifier();
|
| }
|
| return parsePostfixExpression();
|
| @@ -6144,7 +6153,7 @@ class Parser {
|
| Expression initializer = null;
|
| if (matches5(TokenType.EQ)) {
|
| equals = andAdvance;
|
| - initializer = parseExpression3();
|
| + initializer = parseExpression4();
|
| }
|
| return new VariableDeclaration(commentAndMetadata.comment, commentAndMetadata.metadata, name, equals, initializer);
|
| }
|
| @@ -6182,7 +6191,7 @@ class Parser {
|
| */
|
| VariableDeclarationList parseVariableDeclarationList2(CommentAndMetadata commentAndMetadata, Token keyword, TypeName type) {
|
| if (type != null && keyword != null && matches3(keyword, Keyword.VAR)) {
|
| - reportError12(ParserErrorCode.VAR_AND_TYPE, keyword, []);
|
| + reportError13(ParserErrorCode.VAR_AND_TYPE, keyword, []);
|
| }
|
| List<VariableDeclaration> variables = new List<VariableDeclaration>();
|
| variables.add(parseVariableDeclaration());
|
| @@ -6255,7 +6264,7 @@ class Parser {
|
| try {
|
| Token keyword = expect(Keyword.WHILE);
|
| Token leftParenthesis = expect2(TokenType.OPEN_PAREN);
|
| - Expression condition = parseExpression3();
|
| + Expression condition = parseExpression4();
|
| Token rightParenthesis = expect2(TokenType.CLOSE_PAREN);
|
| Statement body = parseStatement2();
|
| return new WhileStatement(keyword, leftParenthesis, condition, rightParenthesis, body);
|
| @@ -6306,7 +6315,7 @@ class Parser {
|
| * @param node the node specifying the location of the error
|
| * @param arguments the arguments to the error, used to compose the error message
|
| */
|
| - void reportError10(ParserErrorCode errorCode, ASTNode node, List<Object> arguments) {
|
| + void reportError11(ParserErrorCode errorCode, ASTNode node, List<Object> arguments) {
|
| reportError(new AnalysisError.con2(_source, node.offset, node.length, errorCode, arguments));
|
| }
|
|
|
| @@ -6316,8 +6325,8 @@ class Parser {
|
| * @param errorCode the error code of the error to be reported
|
| * @param arguments the arguments to the error, used to compose the error message
|
| */
|
| - void reportError11(ParserErrorCode errorCode, List<Object> arguments) {
|
| - reportError12(errorCode, _currentToken, arguments);
|
| + void reportError12(ParserErrorCode errorCode, List<Object> arguments) {
|
| + reportError13(errorCode, _currentToken, arguments);
|
| }
|
|
|
| /**
|
| @@ -6327,7 +6336,7 @@ class Parser {
|
| * @param token the token specifying the location of the error
|
| * @param arguments the arguments to the error, used to compose the error message
|
| */
|
| - void reportError12(ParserErrorCode errorCode, Token token, List<Object> arguments) {
|
| + void reportError13(ParserErrorCode errorCode, Token token, List<Object> arguments) {
|
| reportError(new AnalysisError.con2(_source, token.offset, token.length, errorCode, arguments));
|
| }
|
|
|
| @@ -6808,14 +6817,14 @@ class Parser {
|
| } else if (currentChar == 0x78) {
|
| if (currentIndex + 2 >= length) {
|
| // Illegal escape sequence: not enough hex digits
|
| - reportError11(ParserErrorCode.INVALID_HEX_ESCAPE, []);
|
| + reportError12(ParserErrorCode.INVALID_HEX_ESCAPE, []);
|
| return length;
|
| }
|
| int firstDigit = lexeme.codeUnitAt(currentIndex + 1);
|
| int secondDigit = lexeme.codeUnitAt(currentIndex + 2);
|
| if (!isHexDigit(firstDigit) || !isHexDigit(secondDigit)) {
|
| // Illegal escape sequence: invalid hex digit
|
| - reportError11(ParserErrorCode.INVALID_HEX_ESCAPE, []);
|
| + reportError12(ParserErrorCode.INVALID_HEX_ESCAPE, []);
|
| } else {
|
| builder.appendChar(((Character.digit(firstDigit, 16) << 4) + Character.digit(secondDigit, 16)));
|
| }
|
| @@ -6824,7 +6833,7 @@ class Parser {
|
| currentIndex++;
|
| if (currentIndex >= length) {
|
| // Illegal escape sequence: not enough hex digits
|
| - reportError11(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
|
| + reportError12(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
|
| return length;
|
| }
|
| currentChar = lexeme.codeUnitAt(currentIndex);
|
| @@ -6832,7 +6841,7 @@ class Parser {
|
| currentIndex++;
|
| if (currentIndex >= length) {
|
| // Illegal escape sequence: incomplete escape
|
| - reportError11(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
|
| + reportError12(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
|
| return length;
|
| }
|
| currentChar = lexeme.codeUnitAt(currentIndex);
|
| @@ -6841,7 +6850,7 @@ class Parser {
|
| while (currentChar != 0x7D) {
|
| if (!isHexDigit(currentChar)) {
|
| // Illegal escape sequence: invalid hex digit
|
| - reportError11(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
|
| + reportError12(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
|
| currentIndex++;
|
| while (currentIndex < length && lexeme.codeUnitAt(currentIndex) != 0x7D) {
|
| currentIndex++;
|
| @@ -6853,21 +6862,21 @@ class Parser {
|
| currentIndex++;
|
| if (currentIndex >= length) {
|
| // Illegal escape sequence: incomplete escape
|
| - reportError11(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
|
| + reportError12(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
|
| return length;
|
| }
|
| currentChar = lexeme.codeUnitAt(currentIndex);
|
| }
|
| if (digitCount < 1 || digitCount > 6) {
|
| // Illegal escape sequence: not enough or too many hex digits
|
| - reportError11(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
|
| + reportError12(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
|
| }
|
| appendScalarValue(builder, lexeme.substring(index, currentIndex + 1), value, index, currentIndex);
|
| return currentIndex + 1;
|
| } else {
|
| if (currentIndex + 3 >= length) {
|
| // Illegal escape sequence: not enough hex digits
|
| - reportError11(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
|
| + reportError12(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
|
| return length;
|
| }
|
| int firstDigit = currentChar;
|
| @@ -6876,7 +6885,7 @@ class Parser {
|
| int fourthDigit = lexeme.codeUnitAt(currentIndex + 3);
|
| if (!isHexDigit(firstDigit) || !isHexDigit(secondDigit) || !isHexDigit(thirdDigit) || !isHexDigit(fourthDigit)) {
|
| // Illegal escape sequence: invalid hex digits
|
| - reportError11(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
|
| + reportError12(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
|
| } else {
|
| appendScalarValue(builder, lexeme.substring(index, currentIndex + 1), (((((Character.digit(firstDigit, 16) << 4) + Character.digit(secondDigit, 16)) << 4) + Character.digit(thirdDigit, 16)) << 4) + Character.digit(fourthDigit, 16), index, currentIndex + 3);
|
| }
|
| @@ -6907,7 +6916,7 @@ class Parser {
|
| void validateFormalParameterList(FormalParameterList parameterList) {
|
| for (FormalParameter parameter in parameterList.parameters) {
|
| if (parameter is FieldFormalParameter) {
|
| - reportError10(ParserErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR, parameter.identifier, []);
|
| + reportError11(ParserErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR, parameter.identifier, []);
|
| }
|
| }
|
| }
|
| @@ -6921,16 +6930,16 @@ class Parser {
|
| Token validateModifiersForClass(Modifiers modifiers) {
|
| validateModifiersForTopLevelDeclaration(modifiers);
|
| if (modifiers.constKeyword != null) {
|
| - reportError12(ParserErrorCode.CONST_CLASS, modifiers.constKeyword, []);
|
| + reportError13(ParserErrorCode.CONST_CLASS, modifiers.constKeyword, []);
|
| }
|
| if (modifiers.externalKeyword != null) {
|
| - reportError12(ParserErrorCode.EXTERNAL_CLASS, modifiers.externalKeyword, []);
|
| + reportError13(ParserErrorCode.EXTERNAL_CLASS, modifiers.externalKeyword, []);
|
| }
|
| if (modifiers.finalKeyword != null) {
|
| - reportError12(ParserErrorCode.FINAL_CLASS, modifiers.finalKeyword, []);
|
| + reportError13(ParserErrorCode.FINAL_CLASS, modifiers.finalKeyword, []);
|
| }
|
| if (modifiers.varKeyword != null) {
|
| - reportError12(ParserErrorCode.VAR_CLASS, modifiers.varKeyword, []);
|
| + reportError13(ParserErrorCode.VAR_CLASS, modifiers.varKeyword, []);
|
| }
|
| return modifiers.abstractKeyword;
|
| }
|
| @@ -6944,25 +6953,25 @@ class Parser {
|
| */
|
| Token validateModifiersForConstructor(Modifiers modifiers) {
|
| if (modifiers.abstractKeyword != null) {
|
| - reportError11(ParserErrorCode.ABSTRACT_CLASS_MEMBER, []);
|
| + reportError12(ParserErrorCode.ABSTRACT_CLASS_MEMBER, []);
|
| }
|
| if (modifiers.finalKeyword != null) {
|
| - reportError12(ParserErrorCode.FINAL_CONSTRUCTOR, modifiers.finalKeyword, []);
|
| + reportError13(ParserErrorCode.FINAL_CONSTRUCTOR, modifiers.finalKeyword, []);
|
| }
|
| if (modifiers.staticKeyword != null) {
|
| - reportError12(ParserErrorCode.STATIC_CONSTRUCTOR, modifiers.staticKeyword, []);
|
| + reportError13(ParserErrorCode.STATIC_CONSTRUCTOR, modifiers.staticKeyword, []);
|
| }
|
| if (modifiers.varKeyword != null) {
|
| - reportError12(ParserErrorCode.CONSTRUCTOR_WITH_RETURN_TYPE, modifiers.varKeyword, []);
|
| + reportError13(ParserErrorCode.CONSTRUCTOR_WITH_RETURN_TYPE, modifiers.varKeyword, []);
|
| }
|
| Token externalKeyword = modifiers.externalKeyword;
|
| Token constKeyword = modifiers.constKeyword;
|
| Token factoryKeyword = modifiers.factoryKeyword;
|
| if (externalKeyword != null && constKeyword != null && constKeyword.offset < externalKeyword.offset) {
|
| - reportError12(ParserErrorCode.EXTERNAL_AFTER_CONST, externalKeyword, []);
|
| + reportError13(ParserErrorCode.EXTERNAL_AFTER_CONST, externalKeyword, []);
|
| }
|
| if (externalKeyword != null && factoryKeyword != null && factoryKeyword.offset < externalKeyword.offset) {
|
| - reportError12(ParserErrorCode.EXTERNAL_AFTER_FACTORY, externalKeyword, []);
|
| + reportError13(ParserErrorCode.EXTERNAL_AFTER_FACTORY, externalKeyword, []);
|
| }
|
| return constKeyword;
|
| }
|
| @@ -6976,13 +6985,13 @@ class Parser {
|
| */
|
| Token validateModifiersForField(Modifiers modifiers) {
|
| if (modifiers.abstractKeyword != null) {
|
| - reportError11(ParserErrorCode.ABSTRACT_CLASS_MEMBER, []);
|
| + reportError12(ParserErrorCode.ABSTRACT_CLASS_MEMBER, []);
|
| }
|
| if (modifiers.externalKeyword != null) {
|
| - reportError12(ParserErrorCode.EXTERNAL_FIELD, modifiers.externalKeyword, []);
|
| + reportError13(ParserErrorCode.EXTERNAL_FIELD, modifiers.externalKeyword, []);
|
| }
|
| if (modifiers.factoryKeyword != null) {
|
| - reportError12(ParserErrorCode.NON_CONSTRUCTOR_FACTORY, modifiers.factoryKeyword, []);
|
| + reportError13(ParserErrorCode.NON_CONSTRUCTOR_FACTORY, modifiers.factoryKeyword, []);
|
| }
|
| Token staticKeyword = modifiers.staticKeyword;
|
| Token constKeyword = modifiers.constKeyword;
|
| @@ -6990,23 +6999,23 @@ class Parser {
|
| Token varKeyword = modifiers.varKeyword;
|
| if (constKeyword != null) {
|
| if (finalKeyword != null) {
|
| - reportError12(ParserErrorCode.CONST_AND_FINAL, finalKeyword, []);
|
| + reportError13(ParserErrorCode.CONST_AND_FINAL, finalKeyword, []);
|
| }
|
| if (varKeyword != null) {
|
| - reportError12(ParserErrorCode.CONST_AND_VAR, varKeyword, []);
|
| + reportError13(ParserErrorCode.CONST_AND_VAR, varKeyword, []);
|
| }
|
| if (staticKeyword != null && constKeyword.offset < staticKeyword.offset) {
|
| - reportError12(ParserErrorCode.STATIC_AFTER_CONST, staticKeyword, []);
|
| + reportError13(ParserErrorCode.STATIC_AFTER_CONST, staticKeyword, []);
|
| }
|
| } else if (finalKeyword != null) {
|
| if (varKeyword != null) {
|
| - reportError12(ParserErrorCode.FINAL_AND_VAR, varKeyword, []);
|
| + reportError13(ParserErrorCode.FINAL_AND_VAR, varKeyword, []);
|
| }
|
| if (staticKeyword != null && finalKeyword.offset < staticKeyword.offset) {
|
| - reportError12(ParserErrorCode.STATIC_AFTER_FINAL, staticKeyword, []);
|
| + reportError13(ParserErrorCode.STATIC_AFTER_FINAL, staticKeyword, []);
|
| }
|
| } else if (varKeyword != null && staticKeyword != null && varKeyword.offset < staticKeyword.offset) {
|
| - reportError12(ParserErrorCode.STATIC_AFTER_VAR, staticKeyword, []);
|
| + reportError13(ParserErrorCode.STATIC_AFTER_VAR, staticKeyword, []);
|
| }
|
| return lexicallyFirst([constKeyword, finalKeyword, varKeyword]);
|
| }
|
| @@ -7018,7 +7027,7 @@ class Parser {
|
| */
|
| void validateModifiersForFunctionDeclarationStatement(Modifiers modifiers) {
|
| if (modifiers.abstractKeyword != null || modifiers.constKeyword != null || modifiers.externalKeyword != null || modifiers.factoryKeyword != null || modifiers.finalKeyword != null || modifiers.staticKeyword != null || modifiers.varKeyword != null) {
|
| - reportError11(ParserErrorCode.LOCAL_FUNCTION_DECLARATION_MODIFIER, []);
|
| + reportError12(ParserErrorCode.LOCAL_FUNCTION_DECLARATION_MODIFIER, []);
|
| }
|
| }
|
|
|
| @@ -7029,24 +7038,24 @@ class Parser {
|
| */
|
| void validateModifiersForGetterOrSetterOrMethod(Modifiers modifiers) {
|
| if (modifiers.abstractKeyword != null) {
|
| - reportError11(ParserErrorCode.ABSTRACT_CLASS_MEMBER, []);
|
| + reportError12(ParserErrorCode.ABSTRACT_CLASS_MEMBER, []);
|
| }
|
| if (modifiers.constKeyword != null) {
|
| - reportError12(ParserErrorCode.CONST_METHOD, modifiers.constKeyword, []);
|
| + reportError13(ParserErrorCode.CONST_METHOD, modifiers.constKeyword, []);
|
| }
|
| if (modifiers.factoryKeyword != null) {
|
| - reportError12(ParserErrorCode.NON_CONSTRUCTOR_FACTORY, modifiers.factoryKeyword, []);
|
| + reportError13(ParserErrorCode.NON_CONSTRUCTOR_FACTORY, modifiers.factoryKeyword, []);
|
| }
|
| if (modifiers.finalKeyword != null) {
|
| - reportError12(ParserErrorCode.FINAL_METHOD, modifiers.finalKeyword, []);
|
| + reportError13(ParserErrorCode.FINAL_METHOD, modifiers.finalKeyword, []);
|
| }
|
| if (modifiers.varKeyword != null) {
|
| - reportError12(ParserErrorCode.VAR_RETURN_TYPE, modifiers.varKeyword, []);
|
| + reportError13(ParserErrorCode.VAR_RETURN_TYPE, modifiers.varKeyword, []);
|
| }
|
| Token externalKeyword = modifiers.externalKeyword;
|
| Token staticKeyword = modifiers.staticKeyword;
|
| if (externalKeyword != null && staticKeyword != null && staticKeyword.offset < externalKeyword.offset) {
|
| - reportError12(ParserErrorCode.EXTERNAL_AFTER_STATIC, externalKeyword, []);
|
| + reportError13(ParserErrorCode.EXTERNAL_AFTER_STATIC, externalKeyword, []);
|
| }
|
| }
|
|
|
| @@ -7057,22 +7066,22 @@ class Parser {
|
| */
|
| void validateModifiersForOperator(Modifiers modifiers) {
|
| if (modifiers.abstractKeyword != null) {
|
| - reportError11(ParserErrorCode.ABSTRACT_CLASS_MEMBER, []);
|
| + reportError12(ParserErrorCode.ABSTRACT_CLASS_MEMBER, []);
|
| }
|
| if (modifiers.constKeyword != null) {
|
| - reportError12(ParserErrorCode.CONST_METHOD, modifiers.constKeyword, []);
|
| + reportError13(ParserErrorCode.CONST_METHOD, modifiers.constKeyword, []);
|
| }
|
| if (modifiers.factoryKeyword != null) {
|
| - reportError12(ParserErrorCode.NON_CONSTRUCTOR_FACTORY, modifiers.factoryKeyword, []);
|
| + reportError13(ParserErrorCode.NON_CONSTRUCTOR_FACTORY, modifiers.factoryKeyword, []);
|
| }
|
| if (modifiers.finalKeyword != null) {
|
| - reportError12(ParserErrorCode.FINAL_METHOD, modifiers.finalKeyword, []);
|
| + reportError13(ParserErrorCode.FINAL_METHOD, modifiers.finalKeyword, []);
|
| }
|
| if (modifiers.staticKeyword != null) {
|
| - reportError12(ParserErrorCode.STATIC_OPERATOR, modifiers.staticKeyword, []);
|
| + reportError13(ParserErrorCode.STATIC_OPERATOR, modifiers.staticKeyword, []);
|
| }
|
| if (modifiers.varKeyword != null) {
|
| - reportError12(ParserErrorCode.VAR_RETURN_TYPE, modifiers.varKeyword, []);
|
| + reportError13(ParserErrorCode.VAR_RETURN_TYPE, modifiers.varKeyword, []);
|
| }
|
| }
|
|
|
| @@ -7083,10 +7092,10 @@ class Parser {
|
| */
|
| void validateModifiersForTopLevelDeclaration(Modifiers modifiers) {
|
| if (modifiers.factoryKeyword != null) {
|
| - reportError12(ParserErrorCode.FACTORY_TOP_LEVEL_DECLARATION, modifiers.factoryKeyword, []);
|
| + reportError13(ParserErrorCode.FACTORY_TOP_LEVEL_DECLARATION, modifiers.factoryKeyword, []);
|
| }
|
| if (modifiers.staticKeyword != null) {
|
| - reportError12(ParserErrorCode.STATIC_TOP_LEVEL_DECLARATION, modifiers.staticKeyword, []);
|
| + reportError13(ParserErrorCode.STATIC_TOP_LEVEL_DECLARATION, modifiers.staticKeyword, []);
|
| }
|
| }
|
|
|
| @@ -7098,16 +7107,16 @@ class Parser {
|
| void validateModifiersForTopLevelFunction(Modifiers modifiers) {
|
| validateModifiersForTopLevelDeclaration(modifiers);
|
| if (modifiers.abstractKeyword != null) {
|
| - reportError11(ParserErrorCode.ABSTRACT_TOP_LEVEL_FUNCTION, []);
|
| + reportError12(ParserErrorCode.ABSTRACT_TOP_LEVEL_FUNCTION, []);
|
| }
|
| if (modifiers.constKeyword != null) {
|
| - reportError12(ParserErrorCode.CONST_CLASS, modifiers.constKeyword, []);
|
| + reportError13(ParserErrorCode.CONST_CLASS, modifiers.constKeyword, []);
|
| }
|
| if (modifiers.finalKeyword != null) {
|
| - reportError12(ParserErrorCode.FINAL_CLASS, modifiers.finalKeyword, []);
|
| + reportError13(ParserErrorCode.FINAL_CLASS, modifiers.finalKeyword, []);
|
| }
|
| if (modifiers.varKeyword != null) {
|
| - reportError12(ParserErrorCode.VAR_RETURN_TYPE, modifiers.varKeyword, []);
|
| + reportError13(ParserErrorCode.VAR_RETURN_TYPE, modifiers.varKeyword, []);
|
| }
|
| }
|
|
|
| @@ -7121,24 +7130,24 @@ class Parser {
|
| Token validateModifiersForTopLevelVariable(Modifiers modifiers) {
|
| validateModifiersForTopLevelDeclaration(modifiers);
|
| if (modifiers.abstractKeyword != null) {
|
| - reportError11(ParserErrorCode.ABSTRACT_TOP_LEVEL_VARIABLE, []);
|
| + reportError12(ParserErrorCode.ABSTRACT_TOP_LEVEL_VARIABLE, []);
|
| }
|
| if (modifiers.externalKeyword != null) {
|
| - reportError12(ParserErrorCode.EXTERNAL_FIELD, modifiers.externalKeyword, []);
|
| + reportError13(ParserErrorCode.EXTERNAL_FIELD, modifiers.externalKeyword, []);
|
| }
|
| Token constKeyword = modifiers.constKeyword;
|
| Token finalKeyword = modifiers.finalKeyword;
|
| Token varKeyword = modifiers.varKeyword;
|
| if (constKeyword != null) {
|
| if (finalKeyword != null) {
|
| - reportError12(ParserErrorCode.CONST_AND_FINAL, finalKeyword, []);
|
| + reportError13(ParserErrorCode.CONST_AND_FINAL, finalKeyword, []);
|
| }
|
| if (varKeyword != null) {
|
| - reportError12(ParserErrorCode.CONST_AND_VAR, varKeyword, []);
|
| + reportError13(ParserErrorCode.CONST_AND_VAR, varKeyword, []);
|
| }
|
| } else if (finalKeyword != null) {
|
| if (varKeyword != null) {
|
| - reportError12(ParserErrorCode.FINAL_AND_VAR, varKeyword, []);
|
| + reportError13(ParserErrorCode.FINAL_AND_VAR, varKeyword, []);
|
| }
|
| }
|
| return lexicallyFirst([constKeyword, finalKeyword, varKeyword]);
|
| @@ -7153,19 +7162,19 @@ class Parser {
|
| void validateModifiersForTypedef(Modifiers modifiers) {
|
| validateModifiersForTopLevelDeclaration(modifiers);
|
| if (modifiers.abstractKeyword != null) {
|
| - reportError12(ParserErrorCode.ABSTRACT_TYPEDEF, modifiers.abstractKeyword, []);
|
| + reportError13(ParserErrorCode.ABSTRACT_TYPEDEF, modifiers.abstractKeyword, []);
|
| }
|
| if (modifiers.constKeyword != null) {
|
| - reportError12(ParserErrorCode.CONST_TYPEDEF, modifiers.constKeyword, []);
|
| + reportError13(ParserErrorCode.CONST_TYPEDEF, modifiers.constKeyword, []);
|
| }
|
| if (modifiers.externalKeyword != null) {
|
| - reportError12(ParserErrorCode.EXTERNAL_TYPEDEF, modifiers.externalKeyword, []);
|
| + reportError13(ParserErrorCode.EXTERNAL_TYPEDEF, modifiers.externalKeyword, []);
|
| }
|
| if (modifiers.finalKeyword != null) {
|
| - reportError12(ParserErrorCode.FINAL_TYPEDEF, modifiers.finalKeyword, []);
|
| + reportError13(ParserErrorCode.FINAL_TYPEDEF, modifiers.finalKeyword, []);
|
| }
|
| if (modifiers.varKeyword != null) {
|
| - reportError12(ParserErrorCode.VAR_TYPEDEF, modifiers.varKeyword, []);
|
| + reportError13(ParserErrorCode.VAR_TYPEDEF, modifiers.varKeyword, []);
|
| }
|
| }
|
| }
|
| @@ -7608,7 +7617,7 @@ class ParserErrorCode extends Enum<ParserErrorCode> implements ErrorCode {
|
| * The template used to create the correction to be displayed for this error, or `null` if
|
| * there is no correction information for this error.
|
| */
|
| - String correction9;
|
| + String correction8;
|
|
|
| /**
|
| * Initialize a newly created error code to have the given severity and message.
|
| @@ -7631,7 +7640,7 @@ class ParserErrorCode extends Enum<ParserErrorCode> implements ErrorCode {
|
| ParserErrorCode.con2(String name, int ordinal, ErrorSeverity severity, String message, String correction) : super(name, ordinal) {
|
| this._severity = severity;
|
| this._message = message;
|
| - this.correction9 = correction;
|
| + this.correction8 = correction;
|
| }
|
|
|
| /**
|
| @@ -7641,7 +7650,7 @@ class ParserErrorCode extends Enum<ParserErrorCode> implements ErrorCode {
|
| */
|
| ParserErrorCode.con3(String name, int ordinal, String message) : this.con1(name, ordinal, ErrorSeverity.ERROR, message);
|
|
|
| - String get correction => correction9;
|
| + String get correction => correction8;
|
|
|
| ErrorSeverity get errorSeverity => _severity;
|
|
|
|
|