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

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

Issue 18612009: New analyzer_experimental snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer_experimental/lib/src/generated/parser.dart
diff --git a/pkg/analyzer_experimental/lib/src/generated/parser.dart b/pkg/analyzer_experimental/lib/src/generated/parser.dart
index f2d2c160f994f1a5b1efbd04e1463bcf584271ee..00b33ac94a5a4b576bc4fca2ef23a968827625c6 100644
--- a/pkg/analyzer_experimental/lib/src/generated/parser.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/parser.dart
@@ -779,7 +779,11 @@ class Parser {
return true;
}
if (matches(Keyword.CONST)) {
- return !matchesAny(peek(), [TokenType.LT, TokenType.OPEN_CURLY_BRACKET, TokenType.OPEN_SQUARE_BRACKET, TokenType.INDEX]);
+ return !matchesAny(peek(), [
+ TokenType.LT,
+ TokenType.OPEN_CURLY_BRACKET,
+ TokenType.OPEN_SQUARE_BRACKET,
+ TokenType.INDEX]);
}
Token token = skipTypeName(_currentToken);
if (token == null) {
@@ -860,6 +864,25 @@ class Parser {
}
/**
+ * Return `true` if the given token appears to be the first token of a type name that is
+ * followed by a variable or field formal parameter.
+ *
+ * @param startToken the first token of the sequence being checked
+ * @return `true` if there is a type name and variable starting at the given token
+ */
+ bool isTypedIdentifier(Token startToken) {
+ Token token = skipReturnType(startToken);
+ if (token == null) {
+ return false;
+ } else if (matchesIdentifier2(token)) {
+ return true;
+ } else if (matches3(token, Keyword.THIS) && matches4(token.next, TokenType.PERIOD) && matchesIdentifier2(token.next.next)) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
* Compare the given tokens to find the token that appears first in the source being parsed. That
* is, return the left-most of all of the tokens. The arguments are allowed to be `null`.
* Return the token with the smallest offset, or `null` if there are no arguments or if all
@@ -1504,9 +1527,9 @@ class Parser {
if (withClause != null && extendsClause == null) {
reportError8(ParserErrorCode.WITH_WITHOUT_EXTENDS, withClause.withKeyword, []);
}
+ NativeClause nativeClause = null;
if (matches2(_NATIVE) && matches4(peek(), TokenType.STRING)) {
- advance();
- advance();
+ nativeClause = parseNativeClause();
}
Token leftBracket = null;
List<ClassMember> members = null;
@@ -1520,7 +1543,9 @@ class Parser {
rightBracket = createSyntheticToken2(TokenType.CLOSE_CURLY_BRACKET);
reportError7(ParserErrorCode.MISSING_CLASS_BODY, []);
}
- return new ClassDeclaration.full(commentAndMetadata.comment, commentAndMetadata.metadata, abstractKeyword, keyword, name, typeParameters, extendsClause, withClause, implementsClause, leftBracket, members, rightBracket);
+ ClassDeclaration classDeclaration = new ClassDeclaration.full(commentAndMetadata.comment, commentAndMetadata.metadata, abstractKeyword, keyword, name, typeParameters, extendsClause, withClause, implementsClause, leftBracket, members, rightBracket);
+ classDeclaration.nativeClause = nativeClause;
+ return classDeclaration;
}
/**
@@ -1550,7 +1575,10 @@ class Parser {
} else if (matches(Keyword.OPERATOR) && isOperator(peek())) {
validateModifiersForOperator(modifiers);
return parseOperator(commentAndMetadata, modifiers.externalKeyword, returnType);
- } else if (matchesIdentifier() && matchesAny(peek(), [TokenType.OPEN_PAREN, TokenType.OPEN_CURLY_BRACKET, TokenType.FUNCTION])) {
+ } else if (matchesIdentifier() && matchesAny(peek(), [
+ TokenType.OPEN_PAREN,
+ TokenType.OPEN_CURLY_BRACKET,
+ TokenType.FUNCTION])) {
validateModifiersForGetterOrSetterOrMethod(modifiers);
return parseMethodDeclaration(commentAndMetadata, modifiers.externalKeyword, modifiers.staticKeyword, returnType);
} else {
@@ -2008,7 +2036,10 @@ class Parser {
} else if (matches(Keyword.OPERATOR) && isOperator(peek())) {
reportError8(ParserErrorCode.TOP_LEVEL_OPERATOR, _currentToken, []);
return convertToFunctionDeclaration(parseOperator(commentAndMetadata, modifiers.externalKeyword, returnType));
- } else if (matchesIdentifier() && matchesAny(peek(), [TokenType.OPEN_PAREN, TokenType.OPEN_CURLY_BRACKET, TokenType.FUNCTION])) {
+ } else if (matchesIdentifier() && matchesAny(peek(), [
+ TokenType.OPEN_PAREN,
+ TokenType.OPEN_CURLY_BRACKET,
+ TokenType.FUNCTION])) {
validateModifiersForTopLevelFunction(modifiers);
return parseFunctionDeclaration(commentAndMetadata, modifiers.externalKeyword, returnType);
} else {
@@ -2040,7 +2071,7 @@ class Parser {
return new TopLevelVariableDeclaration.full(commentAndMetadata.comment, commentAndMetadata.metadata, parseVariableDeclarationList2(null, validateModifiersForTopLevelVariable(modifiers), null), expect2(TokenType.SEMICOLON));
}
TypeName returnType = parseReturnType();
- if (matches(Keyword.GET) || matches(Keyword.SET)) {
+ if ((matches(Keyword.GET) || matches(Keyword.SET)) && matchesIdentifier2(peek())) {
validateModifiersForTopLevelFunction(modifiers);
return parseFunctionDeclaration(commentAndMetadata, modifiers.externalKeyword, returnType);
} else if (matches(Keyword.OPERATOR) && isOperator(peek())) {
@@ -2060,7 +2091,10 @@ class Parser {
variables.add(new VariableDeclaration.full(null, null, createSyntheticIdentifier(), null, null));
return new TopLevelVariableDeclaration.full(commentAndMetadata.comment, commentAndMetadata.metadata, new VariableDeclarationList.full(null, null, null, returnType, variables), semicolon);
}
- if (matchesAny(peek(), [TokenType.OPEN_PAREN, TokenType.FUNCTION, TokenType.OPEN_CURLY_BRACKET])) {
+ if (matchesAny(peek(), [
+ TokenType.OPEN_PAREN,
+ TokenType.FUNCTION,
+ TokenType.OPEN_CURLY_BRACKET])) {
validateModifiersForTopLevelFunction(modifiers);
return parseFunctionDeclaration(commentAndMetadata, modifiers.externalKeyword, returnType);
}
@@ -2143,6 +2177,9 @@ class Parser {
separator = andAdvance;
redirectedConstructor = parseConstructorName();
body = new EmptyFunctionBody.full(expect2(TokenType.SEMICOLON));
+ if (factoryKeyword == null) {
+ reportError(ParserErrorCode.REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR, redirectedConstructor, []);
+ }
} else {
body = parseFunctionBody(true, ParserErrorCode.MISSING_FUNCTION_BODY, false);
if (constKeyword != null && factoryKeyword != null) {
@@ -2517,13 +2554,13 @@ class Parser {
TypeName type = null;
if (matches(Keyword.FINAL) || matches(Keyword.CONST)) {
keyword = andAdvance;
- if (matchesIdentifier2(peek()) || matches4(peek(), TokenType.LT) || matches3(peek(), Keyword.THIS) || (matches4(peek(), TokenType.PERIOD) && matchesIdentifier2(peek2(2)) && (matchesIdentifier2(peek2(3)) || matches4(peek2(3), TokenType.LT) || matches3(peek2(3), Keyword.THIS)))) {
+ if (isTypedIdentifier(_currentToken)) {
type = parseTypeName();
}
} else if (matches(Keyword.VAR)) {
keyword = andAdvance;
} else {
- if (matchesIdentifier2(peek()) || matches4(peek(), TokenType.LT) || matches3(peek(), Keyword.THIS) || (matches4(peek(), TokenType.PERIOD) && matchesIdentifier2(peek2(2)) && (matchesIdentifier2(peek2(3)) || matches4(peek2(3), TokenType.LT) || matches3(peek2(3), Keyword.THIS)))) {
+ if (isTypedIdentifier(_currentToken)) {
type = parseReturnType();
} else if (!optional) {
reportError7(ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE, []);
@@ -3528,6 +3565,22 @@ class Parser {
}
/**
+ * Parse a class native clause.
+ *
+ * <pre>
+ * classNativeClause ::=
+ * 'native' name
+ * </pre>
+ *
+ * @return the class native clause that was parsed
+ */
+ NativeClause parseNativeClause() {
+ Token keyword = andAdvance;
+ StringLiteral name = parseStringLiteral();
+ return new NativeClause.full(keyword, name);
+ }
+
+ /**
* Parse a new expression.
*
* <pre>
@@ -3602,7 +3655,10 @@ class Parser {
return parseVariableDeclarationStatement(commentAndMetadata);
} else if (identical(keyword, Keyword.VOID)) {
TypeName returnType = parseReturnType();
- if (matchesIdentifier() && matchesAny(peek(), [TokenType.OPEN_PAREN, TokenType.OPEN_CURLY_BRACKET, TokenType.FUNCTION])) {
+ if (matchesIdentifier() && matchesAny(peek(), [
+ TokenType.OPEN_PAREN,
+ TokenType.OPEN_CURLY_BRACKET,
+ TokenType.FUNCTION])) {
return parseFunctionDeclarationStatement2(commentAndMetadata, returnType);
} else {
if (matchesIdentifier()) {
@@ -3617,7 +3673,11 @@ class Parser {
return new EmptyStatement.full(createSyntheticToken2(TokenType.SEMICOLON));
}
} else if (identical(keyword, Keyword.CONST)) {
- if (matchesAny(peek(), [TokenType.LT, TokenType.OPEN_CURLY_BRACKET, TokenType.OPEN_SQUARE_BRACKET, TokenType.INDEX])) {
+ if (matchesAny(peek(), [
+ TokenType.LT,
+ TokenType.OPEN_CURLY_BRACKET,
+ TokenType.OPEN_SQUARE_BRACKET,
+ TokenType.INDEX])) {
return new ExpressionStatement.full(parseExpression2(), expect2(TokenType.SEMICOLON));
} else if (matches4(peek(), TokenType.IDENTIFIER)) {
Token afterType = skipTypeName(peek());
@@ -3692,8 +3752,12 @@ class Parser {
}
}
TypeName type = holder.type;
- if (type != null && matches3(type.name.beginToken, Keyword.VOID)) {
- reportError8(ParserErrorCode.VOID_PARAMETER, type.name.beginToken, []);
+ if (type != null) {
+ if (matches3(type.name.beginToken, Keyword.VOID)) {
+ reportError8(ParserErrorCode.VOID_PARAMETER, type.name.beginToken, []);
+ } else if (holder.keyword != null && matches3(holder.keyword, Keyword.VAR)) {
+ reportError8(ParserErrorCode.VAR_AND_TYPE, holder.keyword, []);
+ }
}
if (thisKeyword != null) {
return new FieldFormalParameter.full(commentAndMetadata.comment, commentAndMetadata.metadata, holder.keyword, holder.type, thisKeyword, period, identifier, null);
@@ -4714,6 +4778,9 @@ class Parser {
* @return the variable declaration list that was parsed
*/
VariableDeclarationList parseVariableDeclarationList2(CommentAndMetadata commentAndMetadata, Token keyword, TypeName type) {
+ if (type != null && keyword != null && matches3(keyword, Keyword.VAR)) {
+ reportError8(ParserErrorCode.VAR_AND_TYPE, keyword, []);
+ }
List<VariableDeclaration> variables = new List<VariableDeclaration>();
variables.add(parseVariableDeclaration());
while (matches5(TokenType.COMMA)) {
@@ -4941,7 +5008,10 @@ class Parser {
if (matches4(next, TokenType.CLOSE_PAREN)) {
return next.next;
}
- if (matchesAny(next, [TokenType.AT, TokenType.OPEN_SQUARE_BRACKET, TokenType.OPEN_CURLY_BRACKET]) || matches3(next, Keyword.VOID) || (matchesIdentifier2(next) && (matchesAny(next.next, [TokenType.COMMA, TokenType.CLOSE_PAREN])))) {
+ if (matchesAny(next, [
+ TokenType.AT,
+ TokenType.OPEN_SQUARE_BRACKET,
+ TokenType.OPEN_CURLY_BRACKET]) || matches3(next, Keyword.VOID) || (matchesIdentifier2(next) && (matchesAny(next.next, [TokenType.COMMA, TokenType.CLOSE_PAREN])))) {
return skipPastMatchingToken(startToken);
}
if (matchesIdentifier2(next) && matches4(next.next, TokenType.OPEN_PAREN)) {
@@ -5754,31 +5824,158 @@ class ParserErrorCode implements Comparable<ParserErrorCode>, ErrorCode {
static final ParserErrorCode NORMAL_BEFORE_OPTIONAL_PARAMETERS = new ParserErrorCode.con2('NORMAL_BEFORE_OPTIONAL_PARAMETERS', 96, "Normal parameters must occur before optional parameters");
static final ParserErrorCode POSITIONAL_AFTER_NAMED_ARGUMENT = new ParserErrorCode.con2('POSITIONAL_AFTER_NAMED_ARGUMENT', 97, "Positional arguments must occur before named arguments");
static final ParserErrorCode POSITIONAL_PARAMETER_OUTSIDE_GROUP = new ParserErrorCode.con2('POSITIONAL_PARAMETER_OUTSIDE_GROUP', 98, "Positional parameters must be enclosed in square brackets ('[' and ']')");
- static final ParserErrorCode STATIC_AFTER_CONST = new ParserErrorCode.con2('STATIC_AFTER_CONST', 99, "The modifier 'static' should be before the modifier 'const'");
- static final ParserErrorCode STATIC_AFTER_FINAL = new ParserErrorCode.con2('STATIC_AFTER_FINAL', 100, "The modifier 'static' should be before the modifier 'final'");
- static final ParserErrorCode STATIC_AFTER_VAR = new ParserErrorCode.con2('STATIC_AFTER_VAR', 101, "The modifier 'static' should be before the modifier 'var'");
- static final ParserErrorCode STATIC_CONSTRUCTOR = new ParserErrorCode.con2('STATIC_CONSTRUCTOR', 102, "Constructors cannot be static");
- static final ParserErrorCode STATIC_GETTER_WITHOUT_BODY = new ParserErrorCode.con2('STATIC_GETTER_WITHOUT_BODY', 103, "A 'static' getter must have a body");
- static final ParserErrorCode STATIC_OPERATOR = new ParserErrorCode.con2('STATIC_OPERATOR', 104, "Operators cannot be static");
- static final ParserErrorCode STATIC_SETTER_WITHOUT_BODY = new ParserErrorCode.con2('STATIC_SETTER_WITHOUT_BODY', 105, "A 'static' setter must have a body");
- static final ParserErrorCode STATIC_TOP_LEVEL_DECLARATION = new ParserErrorCode.con2('STATIC_TOP_LEVEL_DECLARATION', 106, "Top-level declarations cannot be declared to be 'static'");
- static final ParserErrorCode SWITCH_HAS_CASE_AFTER_DEFAULT_CASE = new ParserErrorCode.con2('SWITCH_HAS_CASE_AFTER_DEFAULT_CASE', 107, "The 'default' case should be the last case in a switch statement");
- static final ParserErrorCode SWITCH_HAS_MULTIPLE_DEFAULT_CASES = new ParserErrorCode.con2('SWITCH_HAS_MULTIPLE_DEFAULT_CASES', 108, "The 'default' case can only be declared once");
- static final ParserErrorCode TOP_LEVEL_OPERATOR = new ParserErrorCode.con2('TOP_LEVEL_OPERATOR', 109, "Operators must be declared within a class");
- static final ParserErrorCode UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP = new ParserErrorCode.con2('UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP', 110, "There is no '%s' to open a parameter group");
- static final ParserErrorCode UNEXPECTED_TOKEN = new ParserErrorCode.con2('UNEXPECTED_TOKEN', 111, "Unexpected token '%s'");
- static final ParserErrorCode WITH_BEFORE_EXTENDS = new ParserErrorCode.con2('WITH_BEFORE_EXTENDS', 112, "The extends clause must be before the with clause");
- static final ParserErrorCode WITH_WITHOUT_EXTENDS = new ParserErrorCode.con2('WITH_WITHOUT_EXTENDS', 113, "The with clause cannot be used without an extends clause");
- static final ParserErrorCode WRONG_SEPARATOR_FOR_NAMED_PARAMETER = new ParserErrorCode.con2('WRONG_SEPARATOR_FOR_NAMED_PARAMETER', 114, "The default value of a named parameter should be preceeded by ':'");
- static final ParserErrorCode WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER = new ParserErrorCode.con2('WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER', 115, "The default value of a positional parameter should be preceeded by '='");
- static final ParserErrorCode WRONG_TERMINATOR_FOR_PARAMETER_GROUP = new ParserErrorCode.con2('WRONG_TERMINATOR_FOR_PARAMETER_GROUP', 116, "Expected '%s' to close parameter group");
- static final ParserErrorCode VAR_AS_TYPE_NAME = new ParserErrorCode.con2('VAR_AS_TYPE_NAME', 117, "The keyword 'var' cannot be used as a type name");
- static final ParserErrorCode VAR_CLASS = new ParserErrorCode.con2('VAR_CLASS', 118, "Classes cannot be declared to be 'var'");
- static final ParserErrorCode VAR_RETURN_TYPE = new ParserErrorCode.con2('VAR_RETURN_TYPE', 119, "The return type cannot be 'var'");
- static final ParserErrorCode VAR_TYPEDEF = new ParserErrorCode.con2('VAR_TYPEDEF', 120, "Type aliases cannot be declared to be 'var'");
- static final ParserErrorCode VOID_PARAMETER = new ParserErrorCode.con2('VOID_PARAMETER', 121, "Parameters cannot have a type of 'void'");
- static final ParserErrorCode VOID_VARIABLE = new ParserErrorCode.con2('VOID_VARIABLE', 122, "Variables cannot have a type of 'void'");
- static final List<ParserErrorCode> values = [ABSTRACT_CLASS_MEMBER, ABSTRACT_STATIC_METHOD, ABSTRACT_TOP_LEVEL_FUNCTION, ABSTRACT_TOP_LEVEL_VARIABLE, ABSTRACT_TYPEDEF, BREAK_OUTSIDE_OF_LOOP, CONST_AND_FINAL, CONST_AND_VAR, CONST_CLASS, CONST_CONSTRUCTOR_WITH_BODY, CONST_FACTORY, CONST_METHOD, CONST_TYPEDEF, CONSTRUCTOR_WITH_RETURN_TYPE, CONTINUE_OUTSIDE_OF_LOOP, CONTINUE_WITHOUT_LABEL_IN_CASE, DEPRECATED_ARGUMENT_DEFINITION_TEST, DIRECTIVE_AFTER_DECLARATION, DUPLICATE_LABEL_IN_SWITCH_STATEMENT, DUPLICATED_MODIFIER, EQUALITY_CANNOT_BE_EQUALITY_OPERAND, EXPECTED_CASE_OR_DEFAULT, EXPECTED_CLASS_MEMBER, EXPECTED_EXECUTABLE, EXPECTED_LIST_OR_MAP_LITERAL, EXPECTED_STRING_LITERAL, EXPECTED_TOKEN, EXPECTED_TWO_MAP_TYPE_ARGUMENTS, EXPECTED_TYPE_NAME, EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE, EXTERNAL_AFTER_CONST, EXTERNAL_AFTER_FACTORY, EXTERNAL_AFTER_STATIC, EXTERNAL_CLASS, EXTERNAL_CONSTRUCTOR_WITH_BODY, EXTERNAL_FIELD, EXTERNAL_GETTER_WITH_BODY, EXTERNAL_METHOD_WITH_BODY, EXTERNAL_OPERATOR_WITH_BODY, EXTERNAL_SETTER_WITH_BODY, EXTERNAL_TYPEDEF, FACTORY_TOP_LEVEL_DECLARATION, FACTORY_WITHOUT_BODY, FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR, FINAL_AND_VAR, FINAL_CLASS, FINAL_CONSTRUCTOR, FINAL_METHOD, FINAL_TYPEDEF, FUNCTION_TYPED_PARAMETER_VAR, GETTER_WITH_PARAMETERS, ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE, IMPLEMENTS_BEFORE_EXTENDS, IMPLEMENTS_BEFORE_WITH, IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE, INITIALIZED_VARIABLE_IN_FOR_EACH, INVALID_CODE_POINT, INVALID_COMMENT_REFERENCE, INVALID_HEX_ESCAPE, INVALID_OPERATOR, INVALID_OPERATOR_FOR_SUPER, INVALID_UNICODE_ESCAPE, LIBRARY_DIRECTIVE_NOT_FIRST, LOCAL_FUNCTION_DECLARATION_MODIFIER, MISSING_ASSIGNABLE_SELECTOR, MISSING_CATCH_OR_FINALLY, MISSING_CLASS_BODY, MISSING_CLOSING_PARENTHESIS, MISSING_CONST_FINAL_VAR_OR_TYPE, MISSING_EXPRESSION_IN_THROW, MISSING_FUNCTION_BODY, MISSING_FUNCTION_PARAMETERS, MISSING_IDENTIFIER, MISSING_KEYWORD_OPERATOR, MISSING_NAME_IN_LIBRARY_DIRECTIVE, MISSING_NAME_IN_PART_OF_DIRECTIVE, MISSING_STATEMENT, MISSING_TERMINATOR_FOR_PARAMETER_GROUP, MISSING_TYPEDEF_PARAMETERS, MISSING_VARIABLE_IN_FOR_EACH, MIXED_PARAMETER_GROUPS, MULTIPLE_EXTENDS_CLAUSES, MULTIPLE_IMPLEMENTS_CLAUSES, MULTIPLE_LIBRARY_DIRECTIVES, MULTIPLE_NAMED_PARAMETER_GROUPS, MULTIPLE_PART_OF_DIRECTIVES, MULTIPLE_POSITIONAL_PARAMETER_GROUPS, MULTIPLE_VARIABLES_IN_FOR_EACH, MULTIPLE_WITH_CLAUSES, NAMED_FUNCTION_EXPRESSION, NAMED_PARAMETER_OUTSIDE_GROUP, NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE, NON_CONSTRUCTOR_FACTORY, NON_IDENTIFIER_LIBRARY_NAME, NON_PART_OF_DIRECTIVE_IN_PART, NON_USER_DEFINABLE_OPERATOR, NORMAL_BEFORE_OPTIONAL_PARAMETERS, POSITIONAL_AFTER_NAMED_ARGUMENT, POSITIONAL_PARAMETER_OUTSIDE_GROUP, STATIC_AFTER_CONST, STATIC_AFTER_FINAL, STATIC_AFTER_VAR, STATIC_CONSTRUCTOR, STATIC_GETTER_WITHOUT_BODY, STATIC_OPERATOR, STATIC_SETTER_WITHOUT_BODY, STATIC_TOP_LEVEL_DECLARATION, SWITCH_HAS_CASE_AFTER_DEFAULT_CASE, SWITCH_HAS_MULTIPLE_DEFAULT_CASES, TOP_LEVEL_OPERATOR, UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP, UNEXPECTED_TOKEN, WITH_BEFORE_EXTENDS, WITH_WITHOUT_EXTENDS, WRONG_SEPARATOR_FOR_NAMED_PARAMETER, WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER, WRONG_TERMINATOR_FOR_PARAMETER_GROUP, VAR_AS_TYPE_NAME, VAR_CLASS, VAR_RETURN_TYPE, VAR_TYPEDEF, VOID_PARAMETER, VOID_VARIABLE];
+ static final ParserErrorCode REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR = new ParserErrorCode.con2('REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR', 99, "Only factory constructor can specify '=' redirection.");
+ static final ParserErrorCode STATIC_AFTER_CONST = new ParserErrorCode.con2('STATIC_AFTER_CONST', 100, "The modifier 'static' should be before the modifier 'const'");
+ static final ParserErrorCode STATIC_AFTER_FINAL = new ParserErrorCode.con2('STATIC_AFTER_FINAL', 101, "The modifier 'static' should be before the modifier 'final'");
+ static final ParserErrorCode STATIC_AFTER_VAR = new ParserErrorCode.con2('STATIC_AFTER_VAR', 102, "The modifier 'static' should be before the modifier 'var'");
+ static final ParserErrorCode STATIC_CONSTRUCTOR = new ParserErrorCode.con2('STATIC_CONSTRUCTOR', 103, "Constructors cannot be static");
+ static final ParserErrorCode STATIC_GETTER_WITHOUT_BODY = new ParserErrorCode.con2('STATIC_GETTER_WITHOUT_BODY', 104, "A 'static' getter must have a body");
+ static final ParserErrorCode STATIC_OPERATOR = new ParserErrorCode.con2('STATIC_OPERATOR', 105, "Operators cannot be static");
+ static final ParserErrorCode STATIC_SETTER_WITHOUT_BODY = new ParserErrorCode.con2('STATIC_SETTER_WITHOUT_BODY', 106, "A 'static' setter must have a body");
+ static final ParserErrorCode STATIC_TOP_LEVEL_DECLARATION = new ParserErrorCode.con2('STATIC_TOP_LEVEL_DECLARATION', 107, "Top-level declarations cannot be declared to be 'static'");
+ static final ParserErrorCode SWITCH_HAS_CASE_AFTER_DEFAULT_CASE = new ParserErrorCode.con2('SWITCH_HAS_CASE_AFTER_DEFAULT_CASE', 108, "The 'default' case should be the last case in a switch statement");
+ static final ParserErrorCode SWITCH_HAS_MULTIPLE_DEFAULT_CASES = new ParserErrorCode.con2('SWITCH_HAS_MULTIPLE_DEFAULT_CASES', 109, "The 'default' case can only be declared once");
+ static final ParserErrorCode TOP_LEVEL_OPERATOR = new ParserErrorCode.con2('TOP_LEVEL_OPERATOR', 110, "Operators must be declared within a class");
+ static final ParserErrorCode UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP = new ParserErrorCode.con2('UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP', 111, "There is no '%s' to open a parameter group");
+ static final ParserErrorCode UNEXPECTED_TOKEN = new ParserErrorCode.con2('UNEXPECTED_TOKEN', 112, "Unexpected token '%s'");
+ static final ParserErrorCode WITH_BEFORE_EXTENDS = new ParserErrorCode.con2('WITH_BEFORE_EXTENDS', 113, "The extends clause must be before the with clause");
+ static final ParserErrorCode WITH_WITHOUT_EXTENDS = new ParserErrorCode.con2('WITH_WITHOUT_EXTENDS', 114, "The with clause cannot be used without an extends clause");
+ static final ParserErrorCode WRONG_SEPARATOR_FOR_NAMED_PARAMETER = new ParserErrorCode.con2('WRONG_SEPARATOR_FOR_NAMED_PARAMETER', 115, "The default value of a named parameter should be preceeded by ':'");
+ static final ParserErrorCode WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER = new ParserErrorCode.con2('WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER', 116, "The default value of a positional parameter should be preceeded by '='");
+ static final ParserErrorCode WRONG_TERMINATOR_FOR_PARAMETER_GROUP = new ParserErrorCode.con2('WRONG_TERMINATOR_FOR_PARAMETER_GROUP', 117, "Expected '%s' to close parameter group");
+ static final ParserErrorCode VAR_AND_TYPE = new ParserErrorCode.con2('VAR_AND_TYPE', 118, "Variables cannot be declared using both 'var' and a type name; remove the 'var'");
+ static final ParserErrorCode VAR_AS_TYPE_NAME = new ParserErrorCode.con2('VAR_AS_TYPE_NAME', 119, "The keyword 'var' cannot be used as a type name");
+ static final ParserErrorCode VAR_CLASS = new ParserErrorCode.con2('VAR_CLASS', 120, "Classes cannot be declared to be 'var'");
+ static final ParserErrorCode VAR_RETURN_TYPE = new ParserErrorCode.con2('VAR_RETURN_TYPE', 121, "The return type cannot be 'var'");
+ static final ParserErrorCode VAR_TYPEDEF = new ParserErrorCode.con2('VAR_TYPEDEF', 122, "Type aliases cannot be declared to be 'var'");
+ static final ParserErrorCode VOID_PARAMETER = new ParserErrorCode.con2('VOID_PARAMETER', 123, "Parameters cannot have a type of 'void'");
+ static final ParserErrorCode VOID_VARIABLE = new ParserErrorCode.con2('VOID_VARIABLE', 124, "Variables cannot have a type of 'void'");
+ static final List<ParserErrorCode> values = [
+ ABSTRACT_CLASS_MEMBER,
+ ABSTRACT_STATIC_METHOD,
+ ABSTRACT_TOP_LEVEL_FUNCTION,
+ ABSTRACT_TOP_LEVEL_VARIABLE,
+ ABSTRACT_TYPEDEF,
+ BREAK_OUTSIDE_OF_LOOP,
+ CONST_AND_FINAL,
+ CONST_AND_VAR,
+ CONST_CLASS,
+ CONST_CONSTRUCTOR_WITH_BODY,
+ CONST_FACTORY,
+ CONST_METHOD,
+ CONST_TYPEDEF,
+ CONSTRUCTOR_WITH_RETURN_TYPE,
+ CONTINUE_OUTSIDE_OF_LOOP,
+ CONTINUE_WITHOUT_LABEL_IN_CASE,
+ DEPRECATED_ARGUMENT_DEFINITION_TEST,
+ DIRECTIVE_AFTER_DECLARATION,
+ DUPLICATE_LABEL_IN_SWITCH_STATEMENT,
+ DUPLICATED_MODIFIER,
+ EQUALITY_CANNOT_BE_EQUALITY_OPERAND,
+ EXPECTED_CASE_OR_DEFAULT,
+ EXPECTED_CLASS_MEMBER,
+ EXPECTED_EXECUTABLE,
+ EXPECTED_LIST_OR_MAP_LITERAL,
+ EXPECTED_STRING_LITERAL,
+ EXPECTED_TOKEN,
+ EXPECTED_TWO_MAP_TYPE_ARGUMENTS,
+ EXPECTED_TYPE_NAME,
+ EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE,
+ EXTERNAL_AFTER_CONST,
+ EXTERNAL_AFTER_FACTORY,
+ EXTERNAL_AFTER_STATIC,
+ EXTERNAL_CLASS,
+ EXTERNAL_CONSTRUCTOR_WITH_BODY,
+ EXTERNAL_FIELD,
+ EXTERNAL_GETTER_WITH_BODY,
+ EXTERNAL_METHOD_WITH_BODY,
+ EXTERNAL_OPERATOR_WITH_BODY,
+ EXTERNAL_SETTER_WITH_BODY,
+ EXTERNAL_TYPEDEF,
+ FACTORY_TOP_LEVEL_DECLARATION,
+ FACTORY_WITHOUT_BODY,
+ FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR,
+ FINAL_AND_VAR,
+ FINAL_CLASS,
+ FINAL_CONSTRUCTOR,
+ FINAL_METHOD,
+ FINAL_TYPEDEF,
+ FUNCTION_TYPED_PARAMETER_VAR,
+ GETTER_WITH_PARAMETERS,
+ ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE,
+ IMPLEMENTS_BEFORE_EXTENDS,
+ IMPLEMENTS_BEFORE_WITH,
+ IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE,
+ INITIALIZED_VARIABLE_IN_FOR_EACH,
+ INVALID_CODE_POINT,
+ INVALID_COMMENT_REFERENCE,
+ INVALID_HEX_ESCAPE,
+ INVALID_OPERATOR,
+ INVALID_OPERATOR_FOR_SUPER,
+ INVALID_UNICODE_ESCAPE,
+ LIBRARY_DIRECTIVE_NOT_FIRST,
+ LOCAL_FUNCTION_DECLARATION_MODIFIER,
+ MISSING_ASSIGNABLE_SELECTOR,
+ MISSING_CATCH_OR_FINALLY,
+ MISSING_CLASS_BODY,
+ MISSING_CLOSING_PARENTHESIS,
+ MISSING_CONST_FINAL_VAR_OR_TYPE,
+ MISSING_EXPRESSION_IN_THROW,
+ MISSING_FUNCTION_BODY,
+ MISSING_FUNCTION_PARAMETERS,
+ MISSING_IDENTIFIER,
+ MISSING_KEYWORD_OPERATOR,
+ MISSING_NAME_IN_LIBRARY_DIRECTIVE,
+ MISSING_NAME_IN_PART_OF_DIRECTIVE,
+ MISSING_STATEMENT,
+ MISSING_TERMINATOR_FOR_PARAMETER_GROUP,
+ MISSING_TYPEDEF_PARAMETERS,
+ MISSING_VARIABLE_IN_FOR_EACH,
+ MIXED_PARAMETER_GROUPS,
+ MULTIPLE_EXTENDS_CLAUSES,
+ MULTIPLE_IMPLEMENTS_CLAUSES,
+ MULTIPLE_LIBRARY_DIRECTIVES,
+ MULTIPLE_NAMED_PARAMETER_GROUPS,
+ MULTIPLE_PART_OF_DIRECTIVES,
+ MULTIPLE_POSITIONAL_PARAMETER_GROUPS,
+ MULTIPLE_VARIABLES_IN_FOR_EACH,
+ MULTIPLE_WITH_CLAUSES,
+ NAMED_FUNCTION_EXPRESSION,
+ NAMED_PARAMETER_OUTSIDE_GROUP,
+ NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE,
+ NON_CONSTRUCTOR_FACTORY,
+ NON_IDENTIFIER_LIBRARY_NAME,
+ NON_PART_OF_DIRECTIVE_IN_PART,
+ NON_USER_DEFINABLE_OPERATOR,
+ NORMAL_BEFORE_OPTIONAL_PARAMETERS,
+ POSITIONAL_AFTER_NAMED_ARGUMENT,
+ POSITIONAL_PARAMETER_OUTSIDE_GROUP,
+ REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR,
+ STATIC_AFTER_CONST,
+ STATIC_AFTER_FINAL,
+ STATIC_AFTER_VAR,
+ STATIC_CONSTRUCTOR,
+ STATIC_GETTER_WITHOUT_BODY,
+ STATIC_OPERATOR,
+ STATIC_SETTER_WITHOUT_BODY,
+ STATIC_TOP_LEVEL_DECLARATION,
+ SWITCH_HAS_CASE_AFTER_DEFAULT_CASE,
+ SWITCH_HAS_MULTIPLE_DEFAULT_CASES,
+ TOP_LEVEL_OPERATOR,
+ UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP,
+ UNEXPECTED_TOKEN,
+ WITH_BEFORE_EXTENDS,
+ WITH_WITHOUT_EXTENDS,
+ WRONG_SEPARATOR_FOR_NAMED_PARAMETER,
+ WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER,
+ WRONG_TERMINATOR_FOR_PARAMETER_GROUP,
+ VAR_AND_TYPE,
+ VAR_AS_TYPE_NAME,
+ VAR_CLASS,
+ VAR_RETURN_TYPE,
+ VAR_TYPEDEF,
+ VOID_PARAMETER,
+ VOID_VARIABLE];
/// The name of this enum constant, as declared in the enum declaration.
final String name;
@@ -6312,7 +6509,17 @@ class ToFormattedSourceVisitor implements ASTVisitor<Object> {
}
visit6(node.typeArguments, " ");
_writer.print("[");
- visitList5(node.elements, ", ");
+ {
+ NodeList<Expression> elements = node.elements;
+ if (elements.length < 2 || elements.toString().length < 60) {
+ visitList5(elements, ", ");
+ } else {
+ String elementIndent = "${_indentString} ";
+ _writer.print("\n");
+ _writer.print(elementIndent);
+ visitList5(elements, ",\n${elementIndent}");
+ }
+ }
_writer.print("]");
return null;
}
@@ -6365,6 +6572,11 @@ class ToFormattedSourceVisitor implements ASTVisitor<Object> {
visit7(" ", node.expression);
return null;
}
+ Object visitNativeClause(NativeClause node) {
+ _writer.print("native ");
+ visit(node.name);
+ return null;
+ }
Object visitNativeFunctionBody(NativeFunctionBody node) {
_writer.print("native ");
visit(node.stringLiteral);
« no previous file with comments | « pkg/analyzer_experimental/lib/src/generated/html.dart ('k') | pkg/analyzer_experimental/lib/src/generated/resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698