Version 0.5.0.0 .
svn merge -r 21520:21754 https://dart.googlecode.com/svn/branches/bleeding_edge trunk
git-svn-id: http://dart.googlecode.com/svn/trunk@21768 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/compiler/build.xml b/compiler/build.xml
index 99e2bb6..7e77b0e 100644
--- a/compiler/build.xml
+++ b/compiler/build.xml
@@ -79,7 +79,8 @@
fork="true"
debug="true"
source="1.6"
- target="1.6">
+ target="1.6"
+ encoding="UTF-8">
<classpath refid="classpath.compile"/>
</javac>
<!--
@@ -101,7 +102,8 @@
fork="true"
debug="true"
source="1.6"
- target="1.6">
+ target="1.6"
+ encoding="UTF-8">
<classpath refid="classpath.compile.tests"/>
</javac>
<!--
diff --git a/pkg/analyzer_experimental/example/resolver_driver.dart b/pkg/analyzer_experimental/example/resolver_driver.dart
index d28d964..c3a9ef7 100644
--- a/pkg/analyzer_experimental/example/resolver_driver.dart
+++ b/pkg/analyzer_experimental/example/resolver_driver.dart
@@ -7,7 +7,8 @@
import 'package:analyzer_experimental/src/generated/java_io.dart';
import 'package:analyzer_experimental/src/generated/source_io.dart';
import 'package:analyzer_experimental/src/generated/ast.dart';
-import 'package:analyzer_experimental/src/generated/sdk.dart';
+import 'package:analyzer_experimental/src/generated/sdk.dart' show DartSdk;
+import 'package:analyzer_experimental/src/generated/sdk_io.dart' show DirectoryBasedDartSdk;
import 'package:analyzer_experimental/src/generated/element.dart';
import 'package:analyzer_experimental/src/generated/engine.dart';
@@ -23,7 +24,7 @@
}
JavaSystemIO.setProperty("com.google.dart.sdk", args[0]);
- DartSdk sdk = DartSdk.defaultSdk;
+ DartSdk sdk = DirectoryBasedDartSdk.defaultSdk;
AnalysisContext context = AnalysisEngine.instance.createAnalysisContext();
context.sourceFactory = new SourceFactory.con2([new DartUriResolver(sdk), new FileUriResolver()]);
diff --git a/pkg/analyzer_experimental/lib/src/generated/ast.dart b/pkg/analyzer_experimental/lib/src/generated/ast.dart
index 96e7662..6f7fd37 100644
--- a/pkg/analyzer_experimental/lib/src/generated/ast.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/ast.dart
@@ -89,8 +89,8 @@
* range
*/
int get offset {
- Token beginToken3 = beginToken;
- if (beginToken3 == null) {
+ Token beginToken2 = beginToken;
+ if (beginToken2 == null) {
return -1;
}
return beginToken.offset;
@@ -275,6 +275,7 @@
R visitMethodDeclaration(MethodDeclaration node);
R visitMethodInvocation(MethodInvocation node);
R visitNamedExpression(NamedExpression node);
+ R visitNativeFunctionBody(NativeFunctionBody node);
R visitNullLiteral(NullLiteral node);
R visitParenthesizedExpression(ParenthesizedExpression node);
R visitPartDirective(PartDirective node);
@@ -474,7 +475,7 @@
* metadata ::=
* annotation
* annotation ::=
- * '@' {@link Identifier qualified} (‘.’ {@link SimpleIdentifier identifier})? {@link ArgumentList arguments}?
+ * '@' {@link Identifier qualified} ('.' {@link SimpleIdentifier identifier})? {@link ArgumentList arguments}?
* </pre>
* @coverage dart.engine.ast
*/
@@ -664,8 +665,8 @@
* Set the identifier representing the argument being tested to the given identifier.
* @param identifier the identifier representing the argument being tested
*/
- void set identifier(SimpleIdentifier identifier7) {
- this._identifier = becomeParentOf(identifier7);
+ void set identifier(SimpleIdentifier identifier2) {
+ this._identifier = becomeParentOf(identifier2);
}
/**
* Set the token representing the question mark to the given token.
@@ -974,8 +975,8 @@
* Set the token representing the 'assert' keyword to the given token.
* @param keyword the token representing the 'assert' keyword
*/
- void set keyword(Token keyword3) {
- this._keyword = keyword3;
+ void set keyword(Token keyword2) {
+ this._keyword = keyword2;
}
/**
* Set the left parenthesis to the given token.
@@ -1074,8 +1075,8 @@
* Set the element associated with the operator to the given element.
* @param element the element associated with the operator
*/
- void set element(MethodElement element3) {
- this._element = element3;
+ void set element(MethodElement element2) {
+ this._element = element2;
}
/**
* Return the expression used to compute the left hand side.
@@ -1175,8 +1176,8 @@
* Set the element associated with the operator to the given element.
* @param element the element associated with the operator
*/
- void set element(MethodElement element4) {
- this._element = element4;
+ void set element(MethodElement element2) {
+ this._element = element2;
}
/**
* Set the expression used to compute the left operand to the given expression.
@@ -1189,8 +1190,8 @@
* Set the binary operator being applied to the given operator.
* @return the binary operator being applied
*/
- void set operator(Token operator3) {
- this._operator = operator3;
+ void set operator(Token operator2) {
+ this._operator = operator2;
}
/**
* Set the expression used to compute the right operand to the given expression.
@@ -1380,8 +1381,8 @@
* Set the value of the literal to the given value.
* @param value the value of the literal
*/
- void set value(bool value4) {
- this._value = value4;
+ void set value(bool value2) {
+ this._value = value2;
}
void visitChildren(ASTVisitor<Object> visitor) {
}
@@ -1447,8 +1448,8 @@
* Set the token representing the 'break' keyword to the given token.
* @param keyword the token representing the 'break' keyword
*/
- void set keyword(Token keyword4) {
- this._keyword = keyword4;
+ void set keyword(Token keyword2) {
+ this._keyword = keyword2;
}
/**
* Set the label associated with the statement to the given identifier.
@@ -1461,8 +1462,8 @@
* Set the semicolon terminating the statement to the given token.
* @param semicolon the semicolon terminating the statement
*/
- void set semicolon(Token semicolon3) {
- this._semicolon = semicolon3;
+ void set semicolon(Token semicolon2) {
+ this._semicolon = semicolon2;
}
void visitChildren(ASTVisitor<Object> visitor) {
safelyVisitChild(_label, visitor);
@@ -1913,22 +1914,22 @@
* Set the extends clause for this class to the given clause.
* @param extendsClause the extends clause for this class
*/
- void set extendsClause(ExtendsClause extendsClause3) {
- this._extendsClause = becomeParentOf(extendsClause3);
+ void set extendsClause(ExtendsClause extendsClause2) {
+ this._extendsClause = becomeParentOf(extendsClause2);
}
/**
* Set the implements clause for the class to the given clause.
* @param implementsClause the implements clause for the class
*/
- void set implementsClause(ImplementsClause implementsClause4) {
- this._implementsClause = becomeParentOf(implementsClause4);
+ void set implementsClause(ImplementsClause implementsClause2) {
+ this._implementsClause = becomeParentOf(implementsClause2);
}
/**
* Set the left curly bracket to the given token.
* @param leftBracket the left curly bracket
*/
- void set leftBracket(Token leftBracket3) {
- this._leftBracket = leftBracket3;
+ void set leftBracket(Token leftBracket2) {
+ this._leftBracket = leftBracket2;
}
/**
* Set the name of the class being declared to the given identifier.
@@ -1941,8 +1942,8 @@
* Set the right curly bracket to the given token.
* @param rightBracket the right curly bracket
*/
- void set rightBracket(Token rightBracket3) {
- this._rightBracket = rightBracket3;
+ void set rightBracket(Token rightBracket2) {
+ this._rightBracket = rightBracket2;
}
/**
* Set the type parameters for the class to the given list of type parameters.
@@ -1955,8 +1956,8 @@
* Set the with clause for the class to the given clause.
* @param withClause the with clause for the class
*/
- void set withClause(WithClause withClause4) {
- this._withClause = becomeParentOf(withClause4);
+ void set withClause(WithClause withClause2) {
+ this._withClause = becomeParentOf(withClause2);
}
void visitChildren(ASTVisitor<Object> visitor) {
safelyVisitChild(documentationComment, visitor);
@@ -2114,29 +2115,29 @@
* Set the token for the 'abstract' keyword to the given token.
* @param abstractKeyword the token for the 'abstract' keyword
*/
- void set abstractKeyword(Token abstractKeyword3) {
- this._abstractKeyword = abstractKeyword3;
+ void set abstractKeyword(Token abstractKeyword2) {
+ this._abstractKeyword = abstractKeyword2;
}
/**
* Set the token for the '=' separating the name from the definition to the given token.
* @param equals the token for the '=' separating the name from the definition
*/
- void set equals(Token equals4) {
- this._equals = equals4;
+ void set equals(Token equals2) {
+ this._equals = equals2;
}
/**
* Set the implements clause for this class to the given implements clause.
* @param implementsClause the implements clause for this class
*/
- void set implementsClause(ImplementsClause implementsClause5) {
- this._implementsClause = becomeParentOf(implementsClause5);
+ void set implementsClause(ImplementsClause implementsClause2) {
+ this._implementsClause = becomeParentOf(implementsClause2);
}
/**
* Set the name of the class being declared to the given identifier.
* @param name the name of the class being declared
*/
- void set name(SimpleIdentifier name3) {
- this._name = becomeParentOf(name3);
+ void set name(SimpleIdentifier name2) {
+ this._name = becomeParentOf(name2);
}
/**
* Set the name of the superclass of the class being declared to the given name.
@@ -2149,15 +2150,15 @@
* Set the type parameters for the class to the given list of parameters.
* @param typeParameters the type parameters for the class
*/
- void set typeParameters(TypeParameterList typeParameters3) {
- this._typeParameters = becomeParentOf(typeParameters3);
+ void set typeParameters(TypeParameterList typeParameters2) {
+ this._typeParameters = becomeParentOf(typeParameters2);
}
/**
* Set the with clause for this class to the given with clause.
* @param withClause the with clause for this class
*/
- void set withClause(WithClause withClause5) {
- this._withClause = becomeParentOf(withClause5);
+ void set withClause(WithClause withClause2) {
+ this._withClause = becomeParentOf(withClause2);
}
void visitChildren(ASTVisitor<Object> visitor) {
super.visitChildren(visitor);
@@ -2206,8 +2207,8 @@
* @param keyword the keyword specifying what kind of processing is to be done on the imported
* names
*/
- void set keyword(Token keyword5) {
- this._keyword = keyword5;
+ void set keyword(Token keyword2) {
+ this._keyword = keyword2;
}
}
/**
@@ -2294,6 +2295,11 @@
*/
NodeList<CommentReference> get references => _references;
/**
+ * Return the tokens representing the comment.
+ * @return the tokens representing the comment
+ */
+ List<Token> get tokens => _tokens;
+ /**
* Return {@code true} if this is a block comment.
* @return {@code true} if this is a block comment
*/
@@ -2316,7 +2322,7 @@
* The enumeration {@code CommentType} encodes all the different types of comments that are
* recognized by the parser.
*/
-class CommentType {
+class CommentType implements Comparable<CommentType> {
/**
* An end-of-line comment.
*/
@@ -2335,6 +2341,7 @@
int get ordinal => __ordinal;
CommentType(this.__name, this.__ordinal) {
}
+ int compareTo(CommentType other) => __ordinal - other.__ordinal;
String toString() => __name;
}
/**
@@ -2387,8 +2394,8 @@
* Set the identifier being referenced to the given identifier.
* @param identifier the identifier being referenced
*/
- void set identifier(Identifier identifier24) {
- identifier24 = becomeParentOf(identifier24);
+ void set identifier(Identifier identifier2) {
+ identifier2 = becomeParentOf(identifier2);
}
/**
* Set the token representing the 'new' keyword to the given token.
@@ -2520,11 +2527,11 @@
}
}
int get length {
- Token endToken3 = endToken;
- if (endToken3 == null) {
+ Token endToken2 = endToken;
+ if (endToken2 == null) {
return 0;
}
- return endToken3.offset + endToken3.length;
+ return endToken2.offset + endToken2.length;
}
/**
* Get the {@link LineInfo} object for this compilation unit.
@@ -2554,8 +2561,8 @@
* Set the element associated with this compilation unit to the given element.
* @param element the element associated with this compilation unit
*/
- void set element(CompilationUnitElement element5) {
- this._element = element5;
+ void set element(CompilationUnitElement element2) {
+ this._element = element2;
}
/**
* Set the {@link LineInfo} object for this compilation unit.
@@ -2566,16 +2573,16 @@
}
/**
* Called to cache the parsing errors when the unit is parsed.
- * @param errors an array of parsing errors, if <code>null</code> is passed, the error array is
- * set to an empty array, {@link AnalysisError#NO_ERRORS}
+ * @param errors an array of parsing errors, if {@code null} is passed, the error array is set to
+ * an empty array, {@link AnalysisError#NO_ERRORS}
*/
void set parsingErrors(List<AnalysisError> errors) {
_parsingErrors = errors == null ? AnalysisError.NO_ERRORS : errors;
}
/**
* Called to cache the resolution errors when the unit is resolved.
- * @param errors an array of resolution errors, if <code>null</code> is passed, the error array is
- * set to an empty array, {@link AnalysisError#NO_ERRORS}
+ * @param errors an array of resolution errors, if {@code null} is passed, the error array is set
+ * to an empty array, {@link AnalysisError#NO_ERRORS}
*/
void set resolutionErrors(List<AnalysisError> errors) {
_resolutionErrors = errors == null ? AnalysisError.NO_ERRORS : errors;
@@ -2753,8 +2760,8 @@
* Set the token used to separate the condition from the then expression to the given token.
* @param question the token used to separate the condition from the then expression
*/
- void set question(Token question3) {
- this._question = question3;
+ void set question(Token question2) {
+ this._question = question2;
}
/**
* Set the expression that is executed if the condition evaluates to {@code true} to the given
@@ -2980,8 +2987,8 @@
* Set the element associated with this constructor to the given element.
* @param element the element associated with this constructor
*/
- void set element(ConstructorElement element6) {
- this._element = element6;
+ void set element(ConstructorElement element2) {
+ this._element = element2;
}
/**
* Set the token for the 'external' keyword to the given token.
@@ -3015,8 +3022,8 @@
* Set the token for the period before the constructor name to the given token.
* @param period the token for the period before the constructor name
*/
- void set period(Token period3) {
- this._period = period3;
+ void set period(Token period2) {
+ this._period = period2;
}
/**
* Set the name of the constructor to which this constructor will be redirected to the given
@@ -3168,16 +3175,16 @@
* Set the token for the equal sign between the field name and the expression to the given token.
* @param equals the token for the equal sign between the field name and the expression
*/
- void set equals(Token equals5) {
- this._equals = equals5;
+ void set equals(Token equals2) {
+ this._equals = equals2;
}
/**
* Set the expression computing the value to which the field will be initialized to the given
* expression.
* @param expression the expression computing the value to which the field will be initialized
*/
- void set expression(Expression expression3) {
- this._expression = becomeParentOf(expression3);
+ void set expression(Expression expression2) {
+ this._expression = becomeParentOf(expression2);
}
/**
* Set the name of the field being initialized to the given identifier.
@@ -3190,15 +3197,15 @@
* Set the token for the 'this' keyword to the given token.
* @param keyword the token for the 'this' keyword
*/
- void set keyword(Token keyword6) {
- this._keyword = keyword6;
+ void set keyword(Token keyword2) {
+ this._keyword = keyword2;
}
/**
* Set the token for the period after the 'this' keyword to the given token.
* @param period the token for the period after the 'this' keyword
*/
- void set period(Token period4) {
- this._period = period4;
+ void set period(Token period2) {
+ this._period = period2;
}
void visitChildren(ASTVisitor<Object> visitor) {
safelyVisitChild(_fieldName, visitor);
@@ -3295,22 +3302,22 @@
* Set the element associated with this constructor name to the given element.
* @param element the element associated with this constructor name
*/
- void set element(ConstructorElement element7) {
- this._element = element7;
+ void set element(ConstructorElement element2) {
+ this._element = element2;
}
/**
* Set the name of the constructor to the given name.
* @param name the name of the constructor
*/
- void set name(SimpleIdentifier name4) {
- this._name = becomeParentOf(name4);
+ void set name(SimpleIdentifier name2) {
+ this._name = becomeParentOf(name2);
}
/**
* Return the token for the period before the constructor name to the given token.
* @param period the token for the period before the constructor name
*/
- void set period(Token period5) {
- this._period = period5;
+ void set period(Token period2) {
+ this._period = period2;
}
/**
* Set the name of the type defining the constructor to the given type name.
@@ -3385,8 +3392,8 @@
* Set the token representing the 'continue' keyword to the given token.
* @param keyword the token representing the 'continue' keyword
*/
- void set keyword(Token keyword7) {
- this._keyword = keyword7;
+ void set keyword(Token keyword2) {
+ this._keyword = keyword2;
}
/**
* Set the label associated with the statement to the given label.
@@ -3399,8 +3406,8 @@
* Set the semicolon terminating the statement to the given token.
* @param semicolon the semicolon terminating the statement
*/
- void set semicolon(Token semicolon4) {
- this._semicolon = semicolon4;
+ void set semicolon(Token semicolon2) {
+ this._semicolon = semicolon2;
}
void visitChildren(ASTVisitor<Object> visitor) {
safelyVisitChild(_label, visitor);
@@ -3479,11 +3486,11 @@
DeclaredIdentifier({Comment comment, List<Annotation> metadata, Token keyword, TypeName type, SimpleIdentifier identifier}) : this.full(comment, metadata, keyword, type, identifier);
accept(ASTVisitor visitor) => visitor.visitDeclaredIdentifier(this);
LocalVariableElement get element {
- SimpleIdentifier identifier11 = identifier;
- if (identifier11 == null) {
+ SimpleIdentifier identifier2 = identifier;
+ if (identifier2 == null) {
return null;
}
- return identifier11.element as LocalVariableElement;
+ return identifier2.element as LocalVariableElement;
}
Token get endToken => _identifier.endToken;
/**
@@ -3518,8 +3525,8 @@
* Set the token representing either the 'final', 'const' or 'var' keyword to the given token.
* @param keyword the token representing either the 'final', 'const' or 'var' keyword
*/
- void set keyword(Token keyword8) {
- this._keyword = keyword8;
+ void set keyword(Token keyword2) {
+ this._keyword = keyword2;
}
/**
* Set the name of the declared type of the parameter to the given type name.
@@ -3656,8 +3663,8 @@
* Set the token separating the parameter from the default value to the given token.
* @param separator the token separating the parameter from the default value
*/
- void set separator(Token separator3) {
- this._separator = separator3;
+ void set separator(Token separator2) {
+ this._separator = separator2;
}
void visitChildren(ASTVisitor<Object> visitor) {
safelyVisitChild(_parameter, visitor);
@@ -3707,8 +3714,8 @@
* Set the element associated with this directive to the given element.
* @param element the element associated with this directive
*/
- void set element(Element element8) {
- this._element = element8;
+ void set element(Element element2) {
+ this._element = element2;
}
}
/**
@@ -3855,8 +3862,8 @@
* Set the semicolon terminating the statement to the given token.
* @param semicolon the semicolon terminating the statement
*/
- void set semicolon(Token semicolon5) {
- this._semicolon = semicolon5;
+ void set semicolon(Token semicolon2) {
+ this._semicolon = semicolon2;
}
/**
* Set the token representing the 'while' keyword to the given token.
@@ -3922,15 +3929,15 @@
* Set the token representing the literal to the given token.
* @param literal the token representing the literal
*/
- void set literal(Token literal3) {
- this._literal = literal3;
+ void set literal(Token literal2) {
+ this._literal = literal2;
}
/**
* Set the value of the literal to the given value.
* @param value the value of the literal
*/
- void set value(double value5) {
- this._value = value5;
+ void set value(double value2) {
+ this._value = value2;
}
void visitChildren(ASTVisitor<Object> visitor) {
}
@@ -3974,8 +3981,8 @@
* token.
* @param semicolon the token representing the semicolon that marks the end of the function body
*/
- void set semicolon(Token semicolon6) {
- this._semicolon = semicolon6;
+ void set semicolon(Token semicolon2) {
+ this._semicolon = semicolon2;
}
void visitChildren(ASTVisitor<Object> visitor) {
}
@@ -4017,8 +4024,8 @@
* Set the semicolon terminating the statement to the given token.
* @param semicolon the semicolon terminating the statement
*/
- void set semicolon(Token semicolon7) {
- this._semicolon = semicolon7;
+ void set semicolon(Token semicolon2) {
+ this._semicolon = semicolon2;
}
void visitChildren(ASTVisitor<Object> visitor) {
}
@@ -4095,9 +4102,9 @@
* will be bound
*/
ParameterElement get parameterElement {
- ASTNode parent3 = parent;
- if (parent3 is ArgumentList) {
- return ((parent3 as ArgumentList)).getParameterElementFor(this);
+ ASTNode parent2 = parent;
+ if (parent2 is ArgumentList) {
+ return ((parent2 as ArgumentList)).getParameterElementFor(this);
}
return null;
}
@@ -4202,8 +4209,8 @@
* Set the expression representing the body of the function to the given expression.
* @param expression the expression representing the body of the function
*/
- void set expression(Expression expression4) {
- this._expression = becomeParentOf(expression4);
+ void set expression(Expression expression2) {
+ this._expression = becomeParentOf(expression2);
}
/**
* Set the token introducing the expression that represents the body of the function to the given
@@ -4217,8 +4224,8 @@
* Set the semicolon terminating the statement to the given token.
* @param semicolon the semicolon terminating the statement
*/
- void set semicolon(Token semicolon8) {
- this._semicolon = semicolon8;
+ void set semicolon(Token semicolon2) {
+ this._semicolon = semicolon2;
}
void visitChildren(ASTVisitor<Object> visitor) {
safelyVisitChild(_expression, visitor);
@@ -4279,15 +4286,15 @@
* Set the expression that comprises the statement to the given expression.
* @param expression the expression that comprises the statement
*/
- void set expression(Expression expression5) {
- this._expression = becomeParentOf(expression5);
+ void set expression(Expression expression2) {
+ this._expression = becomeParentOf(expression2);
}
/**
* Set the semicolon terminating the statement to the given token.
* @param semicolon the semicolon terminating the statement
*/
- void set semicolon(Token semicolon9) {
- this._semicolon = semicolon9;
+ void set semicolon(Token semicolon2) {
+ this._semicolon = semicolon2;
}
void visitChildren(ASTVisitor<Object> visitor) {
safelyVisitChild(_expression, visitor);
@@ -4342,8 +4349,8 @@
* Set the token representing the 'extends' keyword to the given token.
* @param keyword the token representing the 'extends' keyword
*/
- void set keyword(Token keyword9) {
- this._keyword = keyword9;
+ void set keyword(Token keyword2) {
+ this._keyword = keyword2;
}
/**
* Set the name of the class that is being extended to the given name.
@@ -4430,15 +4437,15 @@
* Set the token representing the 'static' keyword to the given token.
* @param keyword the token representing the 'static' keyword
*/
- void set keyword(Token keyword10) {
- this._keyword = keyword10;
+ void set keyword(Token keyword2) {
+ this._keyword = keyword2;
}
/**
* Set the semicolon terminating the declaration to the given token.
* @param semicolon the semicolon terminating the declaration
*/
- void set semicolon(Token semicolon10) {
- this._semicolon = semicolon10;
+ void set semicolon(Token semicolon2) {
+ this._semicolon = semicolon2;
}
void visitChildren(ASTVisitor<Object> visitor) {
super.visitChildren(visitor);
@@ -4541,15 +4548,15 @@
* Set the token representing either the 'final', 'const' or 'var' keyword to the given token.
* @param keyword the token representing either the 'final', 'const' or 'var' keyword
*/
- void set keyword(Token keyword11) {
- this._keyword = keyword11;
+ void set keyword(Token keyword2) {
+ this._keyword = keyword2;
}
/**
* Set the token representing the period to the given token.
* @param period the token representing the period
*/
- void set period(Token period6) {
- this._period = period6;
+ void set period(Token period2) {
+ this._period = period2;
}
/**
* Set the token representing the 'this' keyword to the given token.
@@ -4705,8 +4712,8 @@
* Set the left parenthesis to the given token.
* @param leftParenthesis the left parenthesis
*/
- void set leftParenthesis(Token leftParenthesis3) {
- this._leftParenthesis = leftParenthesis3;
+ void set leftParenthesis(Token leftParenthesis2) {
+ this._leftParenthesis = leftParenthesis2;
}
/**
* Set the declaration of the loop variable to the given variable.
@@ -4719,8 +4726,8 @@
* Set the right parenthesis to the given token.
* @param rightParenthesis the right parenthesis
*/
- void set rightParenthesis(Token rightParenthesis3) {
- this._rightParenthesis = rightParenthesis3;
+ void set rightParenthesis(Token rightParenthesis2) {
+ this._rightParenthesis = rightParenthesis2;
}
void visitChildren(ASTVisitor<Object> visitor) {
safelyVisitChild(_loopVariable, visitor);
@@ -4880,8 +4887,8 @@
* Set the body of the loop to the given statement.
* @param body the body of the loop
*/
- void set body(Statement body3) {
- this._body = becomeParentOf(body3);
+ void set body(Statement body2) {
+ this._body = becomeParentOf(body2);
}
/**
* Set the condition used to determine when to terminate the loop to the given expression.
@@ -4894,8 +4901,8 @@
* Set the token representing the 'for' keyword to the given token.
* @param forKeyword the token representing the 'for' keyword
*/
- void set forKeyword(Token forKeyword3) {
- this._forKeyword = forKeyword3;
+ void set forKeyword(Token forKeyword2) {
+ this._forKeyword = forKeyword2;
}
/**
* Set the initialization expression to the given expression.
@@ -4908,8 +4915,8 @@
* Set the left parenthesis to the given token.
* @param leftParenthesis the left parenthesis
*/
- void set leftParenthesis(Token leftParenthesis4) {
- this._leftParenthesis = leftParenthesis4;
+ void set leftParenthesis(Token leftParenthesis2) {
+ this._leftParenthesis = leftParenthesis2;
}
/**
* Set the semicolon separating the initializer and the condition to the given token.
@@ -4922,8 +4929,8 @@
* Set the right parenthesis to the given token.
* @param rightParenthesis the right parenthesis
*/
- void set rightParenthesis(Token rightParenthesis4) {
- this._rightParenthesis = rightParenthesis4;
+ void set rightParenthesis(Token rightParenthesis2) {
+ this._rightParenthesis = rightParenthesis2;
}
/**
* Set the semicolon separating the condition and the updater to the given token.
@@ -4961,11 +4968,11 @@
* @return the element representing this parameter
*/
ParameterElement get element {
- SimpleIdentifier identifier12 = identifier;
- if (identifier12 == null) {
+ SimpleIdentifier identifier2 = identifier;
+ if (identifier2 == null) {
return null;
}
- return identifier12.element as ParameterElement;
+ return identifier2.element as ParameterElement;
}
/**
* Return the name of the parameter being declared.
@@ -5230,15 +5237,15 @@
* Set the token representing the 'external' keyword to the given token.
* @param externalKeyword the token representing the 'external' keyword
*/
- void set externalKeyword(Token externalKeyword3) {
- this._externalKeyword = externalKeyword3;
+ void set externalKeyword(Token externalKeyword2) {
+ this._externalKeyword = externalKeyword2;
}
/**
* Set the function expression being wrapped to the given function expression.
* @param functionExpression the function expression being wrapped
*/
- void set functionExpression(FunctionExpression functionExpression3) {
- functionExpression3 = becomeParentOf(functionExpression3);
+ void set functionExpression(FunctionExpression functionExpression2) {
+ functionExpression2 = becomeParentOf(functionExpression2);
}
/**
* Set the name of the function to the given identifier.
@@ -5400,15 +5407,15 @@
* Set the element associated with this function to the given element.
* @param element the element associated with this function
*/
- void set element(ExecutableElement element9) {
- this._element = element9;
+ void set element(ExecutableElement element2) {
+ this._element = element2;
}
/**
* Set the parameters associated with the function to the given list of parameters.
* @param parameters the parameters associated with the function
*/
- void set parameters(FormalParameterList parameters3) {
- this._parameters = becomeParentOf(parameters3);
+ void set parameters(FormalParameterList parameters2) {
+ this._parameters = becomeParentOf(parameters2);
}
void visitChildren(ASTVisitor<Object> visitor) {
safelyVisitChild(_parameters, visitor);
@@ -5477,15 +5484,15 @@
* Set the list of arguments to the method to the given list.
* @param argumentList the list of arguments to the method
*/
- void set argumentList(ArgumentList argumentList5) {
- this._argumentList = becomeParentOf(argumentList5);
+ void set argumentList(ArgumentList argumentList2) {
+ this._argumentList = becomeParentOf(argumentList2);
}
/**
* Set the element associated with the function being invoked to the given element.
* @param element the element associated with the function being invoked
*/
- void set element(ExecutableElement element10) {
- this._element = element10;
+ void set element(ExecutableElement element2) {
+ this._element = element2;
}
/**
* Set the expression producing the function being invoked to the given expression.
@@ -5583,15 +5590,15 @@
* Set the name of the function type being declared to the given identifier.
* @param name the name of the function type being declared
*/
- void set name(SimpleIdentifier name5) {
- this._name = becomeParentOf(name5);
+ void set name(SimpleIdentifier name2) {
+ this._name = becomeParentOf(name2);
}
/**
* Set the parameters associated with the function type to the given list of parameters.
* @param parameters the parameters associated with the function type
*/
- void set parameters(FormalParameterList parameters4) {
- this._parameters = becomeParentOf(parameters4);
+ void set parameters(FormalParameterList parameters2) {
+ this._parameters = becomeParentOf(parameters2);
}
/**
* Set the name of the return type of the function type being defined to the given type name.
@@ -5604,8 +5611,8 @@
* Set the type parameters for the function type to the given list of parameters.
* @param typeParameters the type parameters for the function type
*/
- void set typeParameters(TypeParameterList typeParameters4) {
- this._typeParameters = becomeParentOf(typeParameters4);
+ void set typeParameters(TypeParameterList typeParameters2) {
+ this._typeParameters = becomeParentOf(typeParameters2);
}
void visitChildren(ASTVisitor<Object> visitor) {
super.visitChildren(visitor);
@@ -5679,8 +5686,8 @@
* Set the parameters of the function-typed parameter to the given parameters.
* @param parameters the parameters of the function-typed parameter
*/
- void set parameters(FormalParameterList parameters5) {
- this._parameters = becomeParentOf(parameters5);
+ void set parameters(FormalParameterList parameters2) {
+ this._parameters = becomeParentOf(parameters2);
}
/**
* Set the return type of the function to the given type.
@@ -5910,15 +5917,15 @@
* Set the left parenthesis to the given token.
* @param leftParenthesis the left parenthesis
*/
- void set leftParenthesis(Token leftParenthesis5) {
- this._leftParenthesis = leftParenthesis5;
+ void set leftParenthesis(Token leftParenthesis2) {
+ this._leftParenthesis = leftParenthesis2;
}
/**
* Set the right parenthesis to the given token.
* @param rightParenthesis the right parenthesis
*/
- void set rightParenthesis(Token rightParenthesis5) {
- this._rightParenthesis = rightParenthesis5;
+ void set rightParenthesis(Token rightParenthesis2) {
+ this._rightParenthesis = rightParenthesis2;
}
/**
* Set the statement that is executed if the condition evaluates to {@code true} to the given
@@ -5985,8 +5992,8 @@
* Set the token representing the 'implements' keyword to the given token.
* @param keyword the token representing the 'implements' keyword
*/
- void set keyword(Token keyword12) {
- this._keyword = keyword12;
+ void set keyword(Token keyword2) {
+ this._keyword = keyword2;
}
void visitChildren(ASTVisitor<Object> visitor) {
_interfaces.accept(visitor);
@@ -6111,8 +6118,8 @@
* @param index the expression used to compute the index
* @param rightBracket the right square bracket
*/
- IndexExpression.forTarget_full(Expression target3, Token leftBracket4, Expression index2, Token rightBracket4) {
- _jtd_constructor_58_impl(target3, leftBracket4, index2, rightBracket4);
+ IndexExpression.forTarget_full(Expression target2, Token leftBracket2, Expression index2, Token rightBracket2) {
+ _jtd_constructor_58_impl(target2, leftBracket2, index2, rightBracket2);
}
/**
* Initialize a newly created index expression.
@@ -6121,12 +6128,12 @@
* @param index the expression used to compute the index
* @param rightBracket the right square bracket
*/
- IndexExpression.forTarget({Expression target3, Token leftBracket4, Expression index2, Token rightBracket4}) : this.forTarget_full(target3, leftBracket4, index2, rightBracket4);
- _jtd_constructor_58_impl(Expression target3, Token leftBracket4, Expression index2, Token rightBracket4) {
- this._target = becomeParentOf(target3);
- this._leftBracket = leftBracket4;
+ IndexExpression.forTarget({Expression target2, Token leftBracket2, Expression index2, Token rightBracket2}) : this.forTarget_full(target2, leftBracket2, index2, rightBracket2);
+ _jtd_constructor_58_impl(Expression target2, Token leftBracket2, Expression index2, Token rightBracket2) {
+ this._target = becomeParentOf(target2);
+ this._leftBracket = leftBracket2;
this._index = becomeParentOf(index2);
- this._rightBracket = rightBracket4;
+ this._rightBracket = rightBracket2;
}
/**
* Initialize a newly created index expression.
@@ -6135,8 +6142,8 @@
* @param index the expression used to compute the index
* @param rightBracket the right square bracket
*/
- IndexExpression.forCascade_full(Token period7, Token leftBracket5, Expression index3, Token rightBracket5) {
- _jtd_constructor_59_impl(period7, leftBracket5, index3, rightBracket5);
+ IndexExpression.forCascade_full(Token period2, Token leftBracket2, Expression index2, Token rightBracket2) {
+ _jtd_constructor_59_impl(period2, leftBracket2, index2, rightBracket2);
}
/**
* Initialize a newly created index expression.
@@ -6145,12 +6152,12 @@
* @param index the expression used to compute the index
* @param rightBracket the right square bracket
*/
- IndexExpression.forCascade({Token period7, Token leftBracket5, Expression index3, Token rightBracket5}) : this.forCascade_full(period7, leftBracket5, index3, rightBracket5);
- _jtd_constructor_59_impl(Token period7, Token leftBracket5, Expression index3, Token rightBracket5) {
- this._period = period7;
- this._leftBracket = leftBracket5;
- this._index = becomeParentOf(index3);
- this._rightBracket = rightBracket5;
+ IndexExpression.forCascade({Token period2, Token leftBracket2, Expression index2, Token rightBracket2}) : this.forCascade_full(period2, leftBracket2, index2, rightBracket2);
+ _jtd_constructor_59_impl(Token period2, Token leftBracket2, Expression index2, Token rightBracket2) {
+ this._period = period2;
+ this._leftBracket = leftBracket2;
+ this._index = becomeParentOf(index2);
+ this._rightBracket = rightBracket2;
}
accept(ASTVisitor visitor) => visitor.visitIndexExpression(this);
/**
@@ -6224,9 +6231,9 @@
* @return {@code true} if this expression is in a context where the operator '[]' will be invoked
*/
bool inGetterContext() {
- ASTNode parent4 = parent;
- if (parent4 is AssignmentExpression) {
- AssignmentExpression assignment = parent4 as AssignmentExpression;
+ ASTNode parent2 = parent;
+ if (parent2 is AssignmentExpression) {
+ AssignmentExpression assignment = parent2 as AssignmentExpression;
if (identical(assignment.leftHandSide, this) && identical(assignment.operator.type, TokenType.EQ)) {
return false;
}
@@ -6242,13 +6249,13 @@
* invoked
*/
bool inSetterContext() {
- ASTNode parent5 = parent;
- if (parent5 is PrefixExpression) {
- return ((parent5 as PrefixExpression)).operator.type.isIncrementOperator();
- } else if (parent5 is PostfixExpression) {
+ ASTNode parent2 = parent;
+ if (parent2 is PrefixExpression) {
+ return ((parent2 as PrefixExpression)).operator.type.isIncrementOperator();
+ } else if (parent2 is PostfixExpression) {
return true;
- } else if (parent5 is AssignmentExpression) {
- return identical(((parent5 as AssignmentExpression)).leftHandSide, this);
+ } else if (parent2 is AssignmentExpression) {
+ return identical(((parent2 as AssignmentExpression)).leftHandSide, this);
}
return false;
}
@@ -6270,8 +6277,8 @@
* Set the element associated with the operator to the given element.
* @param element the element associated with this operator
*/
- void set element(MethodElement element11) {
- this._element = element11;
+ void set element(MethodElement element2) {
+ this._element = element2;
}
/**
* Set the expression used to compute the index to the given expression.
@@ -6291,8 +6298,8 @@
* Set the period ("..") before a cascaded index expression to the given token.
* @param period the period ("..") before a cascaded index expression
*/
- void set period(Token period8) {
- this._period = period8;
+ void set period(Token period2) {
+ this._period = period2;
}
/**
* Set the right square bracket to the given token.
@@ -6383,29 +6390,29 @@
* Set the list of arguments to the constructor to the given list.
* @param argumentList the list of arguments to the constructor
*/
- void set argumentList(ArgumentList argumentList6) {
- this._argumentList = becomeParentOf(argumentList6);
+ void set argumentList(ArgumentList argumentList2) {
+ this._argumentList = becomeParentOf(argumentList2);
}
/**
* Set the name of the constructor to be invoked to the given name.
* @param constructorName the name of the constructor to be invoked
*/
- void set constructorName(ConstructorName constructorName3) {
- this._constructorName = constructorName3;
+ void set constructorName(ConstructorName constructorName2) {
+ this._constructorName = constructorName2;
}
/**
* Set the element associated with the constructor to the given element.
* @param element the element associated with the constructor
*/
- void set element(ConstructorElement element12) {
- this._element = element12;
+ void set element(ConstructorElement element2) {
+ this._element = element2;
}
/**
* Set the keyword used to indicate how an object should be created to the given keyword.
* @param keyword the keyword used to indicate how an object should be created
*/
- void set keyword(Token keyword13) {
- this._keyword = keyword13;
+ void set keyword(Token keyword2) {
+ this._keyword = keyword2;
}
void visitChildren(ASTVisitor<Object> visitor) {
safelyVisitChild(_constructorName, visitor);
@@ -6467,15 +6474,15 @@
* Set the token representing the literal to the given token.
* @param literal the token representing the literal
*/
- void set literal(Token literal4) {
- this._literal = literal4;
+ void set literal(Token literal2) {
+ this._literal = literal2;
}
/**
* Set the value of the literal to the given value.
* @param value the value of the literal
*/
- void set value(int value6) {
- this._value = value6;
+ void set value(int value2) {
+ this._value = value2;
}
void visitChildren(ASTVisitor<Object> visitor) {
}
@@ -6557,22 +6564,22 @@
* expression.
* @param expression the expression to be evaluated for the value to be converted into a string
*/
- void set expression(Expression expression6) {
- this._expression = becomeParentOf(expression6);
+ void set expression(Expression expression2) {
+ this._expression = becomeParentOf(expression2);
}
/**
* Set the left curly bracket to the given token.
* @param leftBracket the left curly bracket
*/
- void set leftBracket(Token leftBracket6) {
- this._leftBracket = leftBracket6;
+ void set leftBracket(Token leftBracket2) {
+ this._leftBracket = leftBracket2;
}
/**
* Set the right curly bracket to the given token.
* @param rightBracket the right curly bracket
*/
- void set rightBracket(Token rightBracket6) {
- this._rightBracket = rightBracket6;
+ void set rightBracket(Token rightBracket2) {
+ this._rightBracket = rightBracket2;
}
void visitChildren(ASTVisitor<Object> visitor) {
safelyVisitChild(_expression, visitor);
@@ -6713,8 +6720,8 @@
* expression.
* @param expression the expression used to compute the value whose type is being tested
*/
- void set expression(Expression expression7) {
- this._expression = becomeParentOf(expression7);
+ void set expression(Expression expression2) {
+ this._expression = becomeParentOf(expression2);
}
/**
* Set the is operator being applied to the given operator.
@@ -6790,15 +6797,15 @@
* Set the colon that separates the label from the statement to the given token.
* @param colon the colon that separates the label from the statement
*/
- void set colon(Token colon3) {
- this._colon = colon3;
+ void set colon(Token colon2) {
+ this._colon = colon2;
}
/**
* Set the label being associated with the statement to the given label.
* @param label the label being associated with the statement
*/
- void set label(SimpleIdentifier label3) {
- this._label = becomeParentOf(label3);
+ void set label(SimpleIdentifier label2) {
+ this._label = becomeParentOf(label2);
}
void visitChildren(ASTVisitor<Object> visitor) {
safelyVisitChild(_label, visitor);
@@ -6937,15 +6944,15 @@
* Set the name of the library being defined to the given name.
* @param name the name of the library being defined
*/
- void set name(LibraryIdentifier name6) {
- this._name = becomeParentOf(name6);
+ void set name(LibraryIdentifier name2) {
+ this._name = becomeParentOf(name2);
}
/**
* Set the semicolon terminating the directive to the given token.
* @param semicolon the semicolon terminating the directive
*/
- void set semicolon(Token semicolon11) {
- this._semicolon = semicolon11;
+ void set semicolon(Token semicolon2) {
+ this._semicolon = semicolon2;
}
void visitChildren(ASTVisitor<Object> visitor) {
super.visitChildren(visitor);
@@ -7056,9 +7063,9 @@
if (token != null) {
return token;
}
- TypeArgumentList typeArguments6 = typeArguments;
- if (typeArguments6 != null) {
- return typeArguments6.beginToken;
+ TypeArgumentList typeArguments2 = typeArguments;
+ if (typeArguments2 != null) {
+ return typeArguments2.beginToken;
}
return _leftBracket;
}
@@ -7110,7 +7117,7 @@
* Instances of the class {@code MapLiteral} represent a literal map.
* <pre>
* mapLiteral ::=
- * 'const'? ('<' {@link TypeName type} '>')? '{' ({@link MapLiteralEntry entry} (',' {@link MapLiteralEntry entry})* ','?)? '}'
+ * 'const'? ('<' {@link TypeName type} (',' {@link TypeName type})* '>')? '{' ({@link MapLiteralEntry entry} (',' {@link MapLiteralEntry entry})* ','?)? '}'
* </pre>
* @coverage dart.engine.ast
*/
@@ -7158,9 +7165,9 @@
if (token != null) {
return token;
}
- TypeArgumentList typeArguments7 = typeArguments;
- if (typeArguments7 != null) {
- return typeArguments7.beginToken;
+ TypeArgumentList typeArguments2 = typeArguments;
+ if (typeArguments2 != null) {
+ return typeArguments2.beginToken;
}
return _leftBracket;
}
@@ -7266,8 +7273,8 @@
* Set the colon that separates the key from the value to the given token.
* @param separator the colon that separates the key from the value
*/
- void set separator(Token separator4) {
- this._separator = separator4;
+ void set separator(Token separator2) {
+ this._separator = separator2;
}
/**
* Set the expression computing the value that will be associated with the key to the given
@@ -7456,8 +7463,8 @@
* Set the token for the 'external' keyword to the given token.
* @param externalKeyword the token for the 'external' keyword
*/
- void set externalKeyword(Token externalKeyword4) {
- this._externalKeyword = externalKeyword4;
+ void set externalKeyword(Token externalKeyword2) {
+ this._externalKeyword = externalKeyword2;
}
/**
* Set the token representing the 'abstract' or 'static' keyword to the given token.
@@ -7484,15 +7491,15 @@
* Set the parameters associated with the method to the given list of parameters.
* @param parameters the parameters associated with the method
*/
- void set parameters(FormalParameterList parameters6) {
- this._parameters = becomeParentOf(parameters6);
+ void set parameters(FormalParameterList parameters2) {
+ this._parameters = becomeParentOf(parameters2);
}
/**
* Set the token representing the 'get' or 'set' keyword to the given token.
* @param propertyKeyword the token representing the 'get' or 'set' keyword
*/
- void set propertyKeyword(Token propertyKeyword3) {
- this._propertyKeyword = propertyKeyword3;
+ void set propertyKeyword(Token propertyKeyword2) {
+ this._propertyKeyword = propertyKeyword2;
}
/**
* Set the return type of the method to the given type name.
@@ -7635,8 +7642,8 @@
* Set the list of arguments to the method to the given list.
* @param argumentList the list of arguments to the method
*/
- void set argumentList(ArgumentList argumentList7) {
- this._argumentList = becomeParentOf(argumentList7);
+ void set argumentList(ArgumentList argumentList2) {
+ this._argumentList = becomeParentOf(argumentList2);
}
/**
* Set the name of the method being invoked to the given identifier.
@@ -7649,8 +7656,8 @@
* Set the period that separates the target from the method name to the given token.
* @param period the period that separates the target from the method name
*/
- void set period(Token period9) {
- this._period = period9;
+ void set period(Token period2) {
+ this._period = period2;
}
/**
* Set the expression producing the object on which the method is defined to the given expression.
@@ -7704,9 +7711,9 @@
* @return the element representing the parameter being named by this expression
*/
ParameterElement get element {
- Element element22 = _name.label.element;
- if (element22 is ParameterElement) {
- return element22 as ParameterElement;
+ Element element2 = _name.label.element;
+ if (element2 is ParameterElement) {
+ return element2 as ParameterElement;
}
return null;
}
@@ -7725,8 +7732,8 @@
* Set the expression with which the name is associated to the given expression.
* @param expression the expression with which the name is associated
*/
- void set expression(Expression expression8) {
- this._expression = becomeParentOf(expression8);
+ void set expression(Expression expression2) {
+ this._expression = becomeParentOf(expression2);
}
/**
* Set the name associated with the expression to the given identifier.
@@ -7808,12 +7815,76 @@
* Set the semicolon terminating the directive to the given token.
* @param semicolon the semicolon terminating the directive
*/
- void set semicolon(Token semicolon12) {
- this._semicolon = semicolon12;
+ void set semicolon(Token semicolon2) {
+ this._semicolon = semicolon2;
}
Token get firstTokenAfterCommentAndMetadata => _keyword;
}
/**
+ * Instances of the class {@code NativeFunctionBody} represent a function body that consists of a
+ * native keyword followed by a string literal.
+ * <pre>
+ * nativeFunctionBody ::=
+ * 'native' {@link SimpleStringLiteral simpleStringLiteral} ';'
+ * </pre>
+ * @coverage dart.engine.ast
+ */
+class NativeFunctionBody extends FunctionBody {
+ /**
+ * The token representing 'native' that marks the start of the function body.
+ */
+ Token _nativeToken;
+ /**
+ * The string literal, after the 'native' token.
+ */
+ StringLiteral _stringLiteral;
+ /**
+ * The token representing the semicolon that marks the end of the function body.
+ */
+ Token _semicolon;
+ /**
+ * Initialize a newly created function body consisting of the 'native' token, a string literal,
+ * and a semicolon.
+ * @param nativeToken the token representing 'native' that marks the start of the function body
+ * @param stringLiteral the string literal
+ * @param semicolon the token representing the semicolon that marks the end of the function body
+ */
+ NativeFunctionBody.full(Token nativeToken, StringLiteral stringLiteral, Token semicolon) {
+ this._nativeToken = nativeToken;
+ this._stringLiteral = becomeParentOf(stringLiteral);
+ this._semicolon = semicolon;
+ }
+ /**
+ * Initialize a newly created function body consisting of the 'native' token, a string literal,
+ * and a semicolon.
+ * @param nativeToken the token representing 'native' that marks the start of the function body
+ * @param stringLiteral the string literal
+ * @param semicolon the token representing the semicolon that marks the end of the function body
+ */
+ NativeFunctionBody({Token nativeToken, StringLiteral stringLiteral, Token semicolon}) : this.full(nativeToken, stringLiteral, semicolon);
+ accept(ASTVisitor visitor) => visitor.visitNativeFunctionBody(this);
+ Token get beginToken => _nativeToken;
+ Token get endToken => _semicolon;
+ /**
+ * Return the simple identifier representing the 'native' token.
+ * @return the simple identifier representing the 'native' token
+ */
+ Token get nativeToken => _nativeToken;
+ /**
+ * Return the token representing the semicolon that marks the end of the function body.
+ * @return the token representing the semicolon that marks the end of the function body
+ */
+ Token get semicolon => _semicolon;
+ /**
+ * Return the string literal representing the string after the 'native' token.
+ * @return the string literal representing the string after the 'native' token
+ */
+ StringLiteral get stringLiteral => _stringLiteral;
+ void visitChildren(ASTVisitor<Object> visitor) {
+ safelyVisitChild(_stringLiteral, visitor);
+ }
+}
+/**
* The abstract class {@code NormalFormalParameter} defines the behavior common to formal parameters
* that are required (are not optional).
* <pre>
@@ -7861,9 +7932,9 @@
Comment get documentationComment => _comment;
SimpleIdentifier get identifier => _identifier;
ParameterKind get kind {
- ASTNode parent6 = parent;
- if (parent6 is DefaultFormalParameter) {
- return ((parent6 as DefaultFormalParameter)).kind;
+ ASTNode parent2 = parent;
+ if (parent2 is DefaultFormalParameter) {
+ return ((parent2 as DefaultFormalParameter)).kind;
}
return ParameterKind.REQUIRED;
}
@@ -7888,15 +7959,15 @@
* Set the documentation comment associated with this parameter to the given comment
* @param comment the documentation comment to be associated with this parameter
*/
- void set documentationComment(Comment comment3) {
- this._comment = becomeParentOf(comment3);
+ void set documentationComment(Comment comment2) {
+ this._comment = becomeParentOf(comment2);
}
/**
* Set the name of the parameter being declared to the given identifier.
* @param identifier the name of the parameter being declared
*/
- void set identifier(SimpleIdentifier identifier8) {
- this._identifier = becomeParentOf(identifier8);
+ void set identifier(SimpleIdentifier identifier2) {
+ this._identifier = becomeParentOf(identifier2);
}
void visitChildren(ASTVisitor<Object> visitor) {
if (commentIsBeforeAnnotations()) {
@@ -7971,8 +8042,8 @@
* Set the token representing the literal to the given token.
* @param literal the token representing the literal
*/
- void set literal(Token literal5) {
- this._literal = literal5;
+ void set literal(Token literal2) {
+ this._literal = literal2;
}
void visitChildren(ASTVisitor<Object> visitor) {
}
@@ -8038,8 +8109,8 @@
* Set the expression within the parentheses to the given expression.
* @param expression the expression within the parentheses
*/
- void set expression(Expression expression9) {
- this._expression = becomeParentOf(expression9);
+ void set expression(Expression expression2) {
+ this._expression = becomeParentOf(expression2);
}
/**
* Set the left parenthesis to the given token.
@@ -8120,8 +8191,8 @@
* Set the semicolon terminating the directive to the given token.
* @param semicolon the semicolon terminating the directive
*/
- void set semicolon(Token semicolon13) {
- this._semicolon = semicolon13;
+ void set semicolon(Token semicolon2) {
+ this._semicolon = semicolon2;
}
Token get firstTokenAfterCommentAndMetadata => _partToken;
}
@@ -8215,15 +8286,15 @@
* Set the token representing the 'part' token to the given token.
* @param partToken the token representing the 'part' token
*/
- void set partToken(Token partToken3) {
- this._partToken = partToken3;
+ void set partToken(Token partToken2) {
+ this._partToken = partToken2;
}
/**
* Set the semicolon terminating the directive to the given token.
* @param semicolon the semicolon terminating the directive
*/
- void set semicolon(Token semicolon14) {
- this._semicolon = semicolon14;
+ void set semicolon(Token semicolon2) {
+ this._semicolon = semicolon2;
}
void visitChildren(ASTVisitor<Object> visitor) {
super.visitChildren(visitor);
@@ -8290,8 +8361,8 @@
* Set the element associated with the operator to the given element.
* @param element the element associated with the operator
*/
- void set element(MethodElement element13) {
- this._element = element13;
+ void set element(MethodElement element2) {
+ this._element = element2;
}
/**
* Set the expression computing the operand for the operator to the given expression.
@@ -8304,8 +8375,8 @@
* Set the postfix operator being applied to the operand to the given operator.
* @param operator the postfix operator being applied to the operand
*/
- void set operator(Token operator4) {
- this._operator = operator4;
+ void set operator(Token operator2) {
+ this._operator = operator2;
}
void visitChildren(ASTVisitor<Object> visitor) {
safelyVisitChild(_operand, visitor);
@@ -8370,8 +8441,8 @@
* Set the element associated with the operator to the given element.
* @param element the element associated with the operator
*/
- void set element(MethodElement element14) {
- this._element = element14;
+ void set element(MethodElement element2) {
+ this._element = element2;
}
/**
* Set the expression computing the operand for the operator to the given expression.
@@ -8384,8 +8455,8 @@
* Set the prefix operator being applied to the operand to the given operator.
* @param operator the prefix operator being applied to the operand
*/
- void set operator(Token operator5) {
- this._operator = operator5;
+ void set operator(Token operator2) {
+ this._operator = operator2;
}
void visitChildren(ASTVisitor<Object> visitor) {
safelyVisitChild(_operand, visitor);
@@ -8459,15 +8530,15 @@
* Set the identifier being prefixed to the given identifier.
* @param identifier the identifier being prefixed
*/
- void set identifier(SimpleIdentifier identifier9) {
- this._identifier = becomeParentOf(identifier9);
+ void set identifier(SimpleIdentifier identifier2) {
+ this._identifier = becomeParentOf(identifier2);
}
/**
* Set the period used to separate the prefix from the identifier to the given token.
* @param period the period used to separate the prefix from the identifier
*/
- void set period(Token period10) {
- this._period = period10;
+ void set period(Token period2) {
+ this._period = period2;
}
/**
* Set the prefix associated with the library in which the identifier is defined to the given
@@ -8578,8 +8649,8 @@
* Set the property access operator to the given token.
* @param operator the property access operator
*/
- void set operator(Token operator6) {
- this._operator = operator6;
+ void set operator(Token operator2) {
+ this._operator = operator2;
}
/**
* Set the name of the property being accessed to the given identifier.
@@ -8690,8 +8761,8 @@
* Set the list of arguments to the constructor to the given list.
* @param argumentList the list of arguments to the constructor
*/
- void set argumentList(ArgumentList argumentList8) {
- this._argumentList = becomeParentOf(argumentList8);
+ void set argumentList(ArgumentList argumentList2) {
+ this._argumentList = becomeParentOf(argumentList2);
}
/**
* Set the name of the constructor that is being invoked to the given identifier.
@@ -8704,23 +8775,23 @@
* Set the element associated with the constructor to the given element.
* @param element the element associated with the constructor
*/
- void set element(ConstructorElement element15) {
- this._element = element15;
+ void set element(ConstructorElement element2) {
+ this._element = element2;
}
/**
* Set the token for the 'this' keyword to the given token.
* @param keyword the token for the 'this' keyword
*/
- void set keyword(Token keyword14) {
- this._keyword = keyword14;
+ void set keyword(Token keyword2) {
+ this._keyword = keyword2;
}
/**
* Set the token for the period before the name of the constructor that is being invoked to the
* given token.
* @param period the token for the period before the name of the constructor that is being invoked
*/
- void set period(Token period11) {
- this._period = period11;
+ void set period(Token period2) {
+ this._period = period2;
}
void visitChildren(ASTVisitor<Object> visitor) {
safelyVisitChild(_constructorName, visitor);
@@ -8764,8 +8835,8 @@
* Set the token representing the 'rethrow' keyword to the given token.
* @param keyword the token representing the 'rethrow' keyword
*/
- void set keyword(Token keyword15) {
- this._keyword = keyword15;
+ void set keyword(Token keyword2) {
+ this._keyword = keyword2;
}
void visitChildren(ASTVisitor<Object> visitor) {
}
@@ -8833,22 +8904,22 @@
* Set the expression computing the value to be returned to the given expression.
* @param expression the expression computing the value to be returned
*/
- void set expression(Expression expression10) {
- this._expression = becomeParentOf(expression10);
+ void set expression(Expression expression2) {
+ this._expression = becomeParentOf(expression2);
}
/**
* Set the token representing the 'return' keyword to the given token.
* @param keyword the token representing the 'return' keyword
*/
- void set keyword(Token keyword16) {
- this._keyword = keyword16;
+ void set keyword(Token keyword2) {
+ this._keyword = keyword2;
}
/**
* Set the semicolon terminating the statement to the given token.
* @param semicolon the semicolon terminating the statement
*/
- void set semicolon(Token semicolon15) {
- this._semicolon = semicolon15;
+ void set semicolon(Token semicolon2) {
+ this._semicolon = semicolon2;
}
void visitChildren(ASTVisitor<Object> visitor) {
safelyVisitChild(_expression, visitor);
@@ -8892,8 +8963,8 @@
* Set the token representing this script tag to the given script tag.
* @param scriptTag the token representing this script tag
*/
- void set scriptTag(Token scriptTag3) {
- this._scriptTag = scriptTag3;
+ void set scriptTag(Token scriptTag2) {
+ this._scriptTag = scriptTag2;
}
void visitChildren(ASTVisitor<Object> visitor) {
}
@@ -9004,8 +9075,8 @@
* Set the token representing either the 'final', 'const' or 'var' keyword to the given token.
* @param keyword the token representing either the 'final', 'const' or 'var' keyword
*/
- void set keyword(Token keyword17) {
- this._keyword = keyword17;
+ void set keyword(Token keyword2) {
+ this._keyword = keyword2;
}
/**
* Set the name of the declared type of the parameter to the given type name.
@@ -9067,30 +9138,30 @@
* @return {@code true} if this identifier is the name being declared in a declaration
*/
bool inDeclarationContext() {
- ASTNode parent7 = parent;
- if (parent7 is CatchClause) {
- CatchClause clause = parent7 as CatchClause;
+ ASTNode parent2 = parent;
+ if (parent2 is CatchClause) {
+ CatchClause clause = parent2 as CatchClause;
return identical(this, clause.exceptionParameter) || identical(this, clause.stackTraceParameter);
- } else if (parent7 is ClassDeclaration) {
- return identical(this, ((parent7 as ClassDeclaration)).name);
- } else if (parent7 is ClassTypeAlias) {
- return identical(this, ((parent7 as ClassTypeAlias)).name);
- } else if (parent7 is ConstructorDeclaration) {
- return identical(this, ((parent7 as ConstructorDeclaration)).name);
- } else if (parent7 is FunctionDeclaration) {
- return identical(this, ((parent7 as FunctionDeclaration)).name);
- } else if (parent7 is FunctionTypeAlias) {
- return identical(this, ((parent7 as FunctionTypeAlias)).name);
- } else if (parent7 is Label) {
- return identical(this, ((parent7 as Label)).label) && (parent7.parent is LabeledStatement);
- } else if (parent7 is MethodDeclaration) {
- return identical(this, ((parent7 as MethodDeclaration)).name);
- } else if (parent7 is NormalFormalParameter) {
- return identical(this, ((parent7 as NormalFormalParameter)).identifier);
- } else if (parent7 is TypeParameter) {
- return identical(this, ((parent7 as TypeParameter)).name);
- } else if (parent7 is VariableDeclaration) {
- return identical(this, ((parent7 as VariableDeclaration)).name);
+ } else if (parent2 is ClassDeclaration) {
+ return identical(this, ((parent2 as ClassDeclaration)).name);
+ } else if (parent2 is ClassTypeAlias) {
+ return identical(this, ((parent2 as ClassTypeAlias)).name);
+ } else if (parent2 is ConstructorDeclaration) {
+ return identical(this, ((parent2 as ConstructorDeclaration)).name);
+ } else if (parent2 is FunctionDeclaration) {
+ return identical(this, ((parent2 as FunctionDeclaration)).name);
+ } else if (parent2 is FunctionTypeAlias) {
+ return identical(this, ((parent2 as FunctionTypeAlias)).name);
+ } else if (parent2 is Label) {
+ return identical(this, ((parent2 as Label)).label) && (parent2.parent is LabeledStatement);
+ } else if (parent2 is MethodDeclaration) {
+ return identical(this, ((parent2 as MethodDeclaration)).name);
+ } else if (parent2 is FunctionTypedFormalParameter || parent2 is SimpleFormalParameter) {
+ return identical(this, ((parent2 as NormalFormalParameter)).identifier);
+ } else if (parent2 is TypeParameter) {
+ return identical(this, ((parent2 as TypeParameter)).name);
+ } else if (parent2 is VariableDeclaration) {
+ return identical(this, ((parent2 as VariableDeclaration)).name);
}
return false;
}
@@ -9102,25 +9173,28 @@
* @return {@code true} if this expression is in a context where a getter will be invoked
*/
bool inGetterContext() {
- ASTNode parent8 = parent;
+ ASTNode parent2 = parent;
ASTNode target = this;
- if (parent8 is PrefixedIdentifier) {
- PrefixedIdentifier prefixed = parent8 as PrefixedIdentifier;
+ if (parent2 is PrefixedIdentifier) {
+ PrefixedIdentifier prefixed = parent2 as PrefixedIdentifier;
if (identical(prefixed.prefix, this)) {
return true;
}
- parent8 = prefixed.parent;
+ parent2 = prefixed.parent;
target = prefixed;
- } else if (parent8 is PropertyAccess) {
- PropertyAccess access = parent8 as PropertyAccess;
+ } else if (parent2 is PropertyAccess) {
+ PropertyAccess access = parent2 as PropertyAccess;
if (identical(access.target, this)) {
return true;
}
- parent8 = access.parent;
+ parent2 = access.parent;
target = access;
}
- if (parent8 is AssignmentExpression) {
- AssignmentExpression expr = parent8 as AssignmentExpression;
+ if (parent2 is Label) {
+ return false;
+ }
+ if (parent2 is AssignmentExpression) {
+ AssignmentExpression expr = parent2 as AssignmentExpression;
if (identical(expr.leftHandSide, target) && identical(expr.operator.type, TokenType.EQ)) {
return false;
}
@@ -9135,29 +9209,29 @@
* @return {@code true} if this expression is in a context where a setter will be invoked
*/
bool inSetterContext() {
- ASTNode parent9 = parent;
+ ASTNode parent2 = parent;
ASTNode target = this;
- if (parent9 is PrefixedIdentifier) {
- PrefixedIdentifier prefixed = parent9 as PrefixedIdentifier;
+ if (parent2 is PrefixedIdentifier) {
+ PrefixedIdentifier prefixed = parent2 as PrefixedIdentifier;
if (identical(prefixed.prefix, this)) {
return false;
}
- parent9 = prefixed.parent;
+ parent2 = prefixed.parent;
target = prefixed;
- } else if (parent9 is PropertyAccess) {
- PropertyAccess access = parent9 as PropertyAccess;
+ } else if (parent2 is PropertyAccess) {
+ PropertyAccess access = parent2 as PropertyAccess;
if (identical(access.target, this)) {
return false;
}
- parent9 = access.parent;
+ parent2 = access.parent;
target = access;
}
- if (parent9 is PrefixExpression) {
- return ((parent9 as PrefixExpression)).operator.type.isIncrementOperator();
- } else if (parent9 is PostfixExpression) {
+ if (parent2 is PrefixExpression) {
+ return ((parent2 as PrefixExpression)).operator.type.isIncrementOperator();
+ } else if (parent2 is PostfixExpression) {
return true;
- } else if (parent9 is AssignmentExpression) {
- return identical(((parent9 as AssignmentExpression)).leftHandSide, target);
+ } else if (parent2 is AssignmentExpression) {
+ return identical(((parent2 as AssignmentExpression)).leftHandSide, target);
}
return false;
}
@@ -9166,15 +9240,15 @@
* Set the element associated with this identifier to the given element.
* @param element the element associated with this identifier
*/
- void set element(Element element16) {
- this._element = element16;
+ void set element(Element element2) {
+ this._element = element2;
}
/**
* Set the token representing the identifier to the given token.
* @param token the token representing the literal
*/
- void set token(Token token12) {
- this._token = token12;
+ void set token(Token token2) {
+ this._token = token2;
}
void visitChildren(ASTVisitor<Object> visitor) {
}
@@ -9216,7 +9290,7 @@
*/
SimpleStringLiteral.full(Token literal, String value) {
this._literal = literal;
- this._value = value;
+ this._value = StringUtilities.intern(value);
}
/**
* Initialize a newly created simple string literal.
@@ -9257,15 +9331,15 @@
* Set the token representing the literal to the given token.
* @param literal the token representing the literal
*/
- void set literal(Token literal6) {
- this._literal = literal6;
+ void set literal(Token literal2) {
+ this._literal = literal2;
}
/**
* Set the value of the literal to the given string.
* @param string the value of the literal
*/
void set value(String string) {
- _value = string;
+ _value = StringUtilities.intern(_value);
}
void visitChildren(ASTVisitor<Object> visitor) {
}
@@ -9414,8 +9488,8 @@
* Set the list of arguments to the constructor to the given list.
* @param argumentList the list of arguments to the constructor
*/
- void set argumentList(ArgumentList argumentList9) {
- this._argumentList = becomeParentOf(argumentList9);
+ void set argumentList(ArgumentList argumentList2) {
+ this._argumentList = becomeParentOf(argumentList2);
}
/**
* Set the name of the constructor that is being invoked to the given identifier.
@@ -9428,23 +9502,23 @@
* Set the element associated with the constructor to the given element.
* @param element the element associated with the constructor
*/
- void set element(ConstructorElement element17) {
- this._element = element17;
+ void set element(ConstructorElement element2) {
+ this._element = element2;
}
/**
* Set the token for the 'super' keyword to the given token.
* @param keyword the token for the 'super' keyword
*/
- void set keyword(Token keyword18) {
- this._keyword = keyword18;
+ void set keyword(Token keyword2) {
+ this._keyword = keyword2;
}
/**
* Set the token for the period before the name of the constructor that is being invoked to the
* given token.
* @param period the token for the period before the name of the constructor that is being invoked
*/
- void set period(Token period12) {
- this._period = period12;
+ void set period(Token period2) {
+ this._period = period2;
}
void visitChildren(ASTVisitor<Object> visitor) {
safelyVisitChild(_constructorName, visitor);
@@ -9488,8 +9562,8 @@
* Set the token representing the keyword to the given token.
* @param keyword the token representing the keyword
*/
- void set keyword(Token keyword19) {
- this._keyword = keyword19;
+ void set keyword(Token keyword2) {
+ this._keyword = keyword2;
}
void visitChildren(ASTVisitor<Object> visitor) {
}
@@ -9535,8 +9609,8 @@
* Set the expression controlling whether the statements will be executed to the given expression.
* @param expression the expression controlling whether the statements will be executed
*/
- void set expression(Expression expression11) {
- this._expression = becomeParentOf(expression11);
+ void set expression(Expression expression2) {
+ this._expression = becomeParentOf(expression2);
}
void visitChildren(ASTVisitor<Object> visitor) {
labels.accept(visitor);
@@ -9660,15 +9734,15 @@
* Set the colon separating the keyword or the expression from the statements to the given token.
* @param colon the colon separating the keyword or the expression from the statements
*/
- void set colon(Token colon4) {
- this._colon = colon4;
+ void set colon(Token colon2) {
+ this._colon = colon2;
}
/**
* Set the token representing the 'case' or 'default' keyword to the given token.
* @param keyword the token representing the 'case' or 'default' keyword
*/
- void set keyword(Token keyword20) {
- this._keyword = keyword20;
+ void set keyword(Token keyword2) {
+ this._keyword = keyword2;
}
}
/**
@@ -9782,43 +9856,43 @@
* expression.
* @param expression the expression used to determine which of the switch members will be selected
*/
- void set expression(Expression expression12) {
- this._expression = becomeParentOf(expression12);
+ void set expression(Expression expression2) {
+ this._expression = becomeParentOf(expression2);
}
/**
* Set the token representing the 'switch' keyword to the given token.
* @param keyword the token representing the 'switch' keyword
*/
- void set keyword(Token keyword21) {
- this._keyword = keyword21;
+ void set keyword(Token keyword2) {
+ this._keyword = keyword2;
}
/**
* Set the left curly bracket to the given token.
* @param leftBracket the left curly bracket
*/
- void set leftBracket(Token leftBracket7) {
- this._leftBracket = leftBracket7;
+ void set leftBracket(Token leftBracket2) {
+ this._leftBracket = leftBracket2;
}
/**
* Set the left parenthesis to the given token.
* @param leftParenthesis the left parenthesis
*/
- void set leftParenthesis(Token leftParenthesis6) {
- this._leftParenthesis = leftParenthesis6;
+ void set leftParenthesis(Token leftParenthesis2) {
+ this._leftParenthesis = leftParenthesis2;
}
/**
* Set the right curly bracket to the given token.
* @param rightBracket the right curly bracket
*/
- void set rightBracket(Token rightBracket7) {
- this._rightBracket = rightBracket7;
+ void set rightBracket(Token rightBracket2) {
+ this._rightBracket = rightBracket2;
}
/**
* Set the right parenthesis to the given token.
* @param rightParenthesis the right parenthesis
*/
- void set rightParenthesis(Token rightParenthesis6) {
- this._rightParenthesis = rightParenthesis6;
+ void set rightParenthesis(Token rightParenthesis2) {
+ this._rightParenthesis = rightParenthesis2;
}
void visitChildren(ASTVisitor<Object> visitor) {
safelyVisitChild(_expression, visitor);
@@ -9862,8 +9936,8 @@
* Set the token representing the keyword to the given token.
* @param keyword the token representing the keyword
*/
- void set keyword(Token keyword22) {
- this._keyword = keyword22;
+ void set keyword(Token keyword2) {
+ this._keyword = keyword2;
}
void visitChildren(ASTVisitor<Object> visitor) {
}
@@ -9921,15 +9995,15 @@
* Set the expression computing the exception to be thrown to the given expression.
* @param expression the expression computing the exception to be thrown
*/
- void set expression(Expression expression13) {
- this._expression = becomeParentOf(expression13);
+ void set expression(Expression expression2) {
+ this._expression = becomeParentOf(expression2);
}
/**
* Set the token representing the 'throw' keyword to the given token.
* @param keyword the token representing the 'throw' keyword
*/
- void set keyword(Token keyword23) {
- this._keyword = keyword23;
+ void set keyword(Token keyword2) {
+ this._keyword = keyword2;
}
void visitChildren(ASTVisitor<Object> visitor) {
safelyVisitChild(_expression, visitor);
@@ -9990,8 +10064,8 @@
* Set the semicolon terminating the declaration to the given token.
* @param semicolon the semicolon terminating the declaration
*/
- void set semicolon(Token semicolon16) {
- this._semicolon = semicolon16;
+ void set semicolon(Token semicolon2) {
+ this._semicolon = semicolon2;
}
/**
* Set the top-level variables being declared to the given list of variables.
@@ -10190,15 +10264,15 @@
* Set the token representing the 'typedef' keyword to the given token.
* @param keyword the token representing the 'typedef' keyword
*/
- void set keyword(Token keyword24) {
- this._keyword = keyword24;
+ void set keyword(Token keyword2) {
+ this._keyword = keyword2;
}
/**
* Set the semicolon terminating the declaration to the given token.
* @param semicolon the semicolon terminating the declaration
*/
- void set semicolon(Token semicolon17) {
- this._semicolon = semicolon17;
+ void set semicolon(Token semicolon2) {
+ this._semicolon = semicolon2;
}
Token get firstTokenAfterCommentAndMetadata => _keyword;
}
@@ -10264,15 +10338,15 @@
* Set the left bracket to the given token.
* @param leftBracket the left bracket
*/
- void set leftBracket(Token leftBracket8) {
- this._leftBracket = leftBracket8;
+ void set leftBracket(Token leftBracket2) {
+ this._leftBracket = leftBracket2;
}
/**
* Set the right bracket to the given token.
* @param rightBracket the right bracket
*/
- void set rightBracket(Token rightBracket8) {
- this._rightBracket = rightBracket8;
+ void set rightBracket(Token rightBracket2) {
+ this._rightBracket = rightBracket2;
}
void visitChildren(ASTVisitor<Object> visitor) {
_arguments.accept(visitor);
@@ -10352,8 +10426,8 @@
* Set the type being named to the given type.
* @param type the type being named
*/
- void set type(Type2 type3) {
- this._type = type3;
+ void set type(Type2 type2) {
+ this._type = type2;
}
/**
* Set the type arguments associated with the type to the given type arguments.
@@ -10446,8 +10520,8 @@
* Set the token representing the 'assert' keyword to the given token.
* @param keyword the token representing the 'assert' keyword
*/
- void set keyword(Token keyword25) {
- this._keyword = keyword25;
+ void set keyword(Token keyword2) {
+ this._keyword = keyword2;
}
/**
* Set the name of the type parameter to the given identifier.
@@ -10582,8 +10656,8 @@
* Set the type argument associated with this literal to the given arguments.
* @param typeArguments the type argument associated with this literal
*/
- void set typeArguments(TypeArgumentList typeArguments3) {
- this._typeArguments = typeArguments3;
+ void set typeArguments(TypeArgumentList typeArguments2) {
+ this._typeArguments = typeArguments2;
}
void visitChildren(ASTVisitor<Object> visitor) {
safelyVisitChild(_typeArguments, visitor);
@@ -10709,8 +10783,8 @@
* @return {@code true} if this variable was declared with the 'const' modifier
*/
bool isConst() {
- ASTNode parent10 = parent;
- return parent10 is VariableDeclarationList && ((parent10 as VariableDeclarationList)).isConst();
+ ASTNode parent2 = parent;
+ return parent2 is VariableDeclarationList && ((parent2 as VariableDeclarationList)).isConst();
}
/**
* Return {@code true} if this variable was declared with the 'final' modifier. Variables that are
@@ -10719,15 +10793,15 @@
* @return {@code true} if this variable was declared with the 'final' modifier
*/
bool isFinal() {
- ASTNode parent11 = parent;
- return parent11 is VariableDeclarationList && ((parent11 as VariableDeclarationList)).isFinal();
+ ASTNode parent2 = parent;
+ return parent2 is VariableDeclarationList && ((parent2 as VariableDeclarationList)).isFinal();
}
/**
* Set the equal sign separating the variable name from the initial value to the given token.
* @param equals the equal sign separating the variable name from the initial value
*/
- void set equals(Token equals6) {
- this._equals = equals6;
+ void set equals(Token equals2) {
+ this._equals = equals2;
}
/**
* Set the expression used to compute the initial value for the variable to the given expression.
@@ -10740,8 +10814,8 @@
* Set the name of the variable being declared to the given identifier.
* @param name the name of the variable being declared
*/
- void set name(SimpleIdentifier name7) {
- this._name = becomeParentOf(name7);
+ void set name(SimpleIdentifier name2) {
+ this._name = becomeParentOf(name2);
}
void visitChildren(ASTVisitor<Object> visitor) {
super.visitChildren(visitor);
@@ -10834,8 +10908,8 @@
* Set the token representing the 'final', 'const' or 'var' keyword to the given token.
* @param keyword the token representing the 'final', 'const' or 'var' keyword
*/
- void set keyword(Token keyword26) {
- this._keyword = keyword26;
+ void set keyword(Token keyword2) {
+ this._keyword = keyword2;
}
/**
* Set the type of the variables being declared to the given type name.
@@ -10906,8 +10980,8 @@
* Set the semicolon terminating the statement to the given token.
* @param semicolon the semicolon terminating the statement
*/
- void set semicolon(Token semicolon18) {
- this._semicolon = semicolon18;
+ void set semicolon(Token semicolon2) {
+ this._semicolon = semicolon2;
}
/**
* Set the variables being declared to the given list of variables.
@@ -11019,22 +11093,22 @@
* Set the token representing the 'while' keyword to the given token.
* @param keyword the token representing the 'while' keyword
*/
- void set keyword(Token keyword27) {
- this._keyword = keyword27;
+ void set keyword(Token keyword2) {
+ this._keyword = keyword2;
}
/**
* Set the left parenthesis to the given token.
* @param leftParenthesis the left parenthesis
*/
- void set leftParenthesis(Token leftParenthesis7) {
- this._leftParenthesis = leftParenthesis7;
+ void set leftParenthesis(Token leftParenthesis2) {
+ this._leftParenthesis = leftParenthesis2;
}
/**
* Set the right parenthesis to the given token.
* @param rightParenthesis the right parenthesis
*/
- void set rightParenthesis(Token rightParenthesis7) {
- this._rightParenthesis = rightParenthesis7;
+ void set rightParenthesis(Token rightParenthesis2) {
+ this._rightParenthesis = rightParenthesis2;
}
void visitChildren(ASTVisitor<Object> visitor) {
safelyVisitChild(_condition, visitor);
@@ -11137,15 +11211,9 @@
*/
static Object NOT_A_CONSTANT = new Object();
/**
- * The error reporter by which errors will be reported.
- */
- ErrorReporter _errorReporter;
- /**
* Initialize a newly created constant evaluator.
- * @param errorReporter the error reporter by which errors will be reported
*/
- ConstantEvaluator(ErrorReporter errorReporter) {
- this._errorReporter = errorReporter;
+ ConstantEvaluator() {
}
Object visitAdjacentStrings(AdjacentStrings node) {
JavaStringBuilder builder = new JavaStringBuilder();
@@ -11269,32 +11337,20 @@
if (rightOperand2 != 0) {
return ((leftOperand2 as int)) ~/ (rightOperand2 as int);
} else {
- reportDivideByZeroError(node);
- return 0;
+ return ((leftOperand2 as int)).toDouble() / ((rightOperand2 as int)).toDouble();
}
} else if (leftOperand2 is double && rightOperand2 is double) {
- if (rightOperand2 != 0) {
- return ((leftOperand2 as double)) / ((rightOperand2 as double));
- } else {
- reportDivideByZeroError(node);
- return 0;
- }
+ return ((leftOperand2 as double)) / ((rightOperand2 as double));
}
} else if (node.operator.type == TokenType.TILDE_SLASH) {
if (leftOperand2 is int && rightOperand2 is int) {
if (rightOperand2 != 0) {
return ((leftOperand2 as int)) ~/ (rightOperand2 as int);
} else {
- reportDivideByZeroError(node);
return 0;
}
} else if (leftOperand2 is double && rightOperand2 is double) {
- if (rightOperand2 != 0) {
- return ((leftOperand2 as double)) ~/ ((rightOperand2 as double));
- } else {
- reportDivideByZeroError(node);
- return 0;
- }
+ return ((leftOperand2 as double)) ~/ ((rightOperand2 as double));
}
}
break;
@@ -11327,11 +11383,11 @@
Map<String, Object> map = new Map<String, Object>();
for (MapLiteralEntry entry in node.entries) {
Object key2 = entry.key.accept(this);
- Object value8 = entry.value.accept(this);
- if (key2 is! String || identical(value8, NOT_A_CONSTANT)) {
+ Object value2 = entry.value.accept(this);
+ if (key2 is! String || identical(value2, NOT_A_CONSTANT)) {
return NOT_A_CONSTANT;
}
- map[(key2 as String)] = value8;
+ map[(key2 as String)] = value2;
}
return map;
}
@@ -11396,9 +11452,6 @@
}
return NOT_A_CONSTANT;
}
- void reportDivideByZeroError(BinaryExpression node) {
- _errorReporter.reportError(CompileTimeErrorCode.COMPILE_TIME_CONSTANT_RAISES_EXCEPTION_DIVIDE_BY_ZERO, node, []);
- }
}
/**
* Instances of the class {@code ElementLocator} locate the {@link Element Dart model element}associated with a given {@link ASTNode AST node}.
@@ -11427,19 +11480,23 @@
class ElementLocator_ElementMapper extends GeneralizingASTVisitor<Element> {
Element visitBinaryExpression(BinaryExpression node) => node.element;
Element visitClassDeclaration(ClassDeclaration node) => node.element;
+ Element visitCompilationUnit(CompilationUnit node) => node.element;
+ Element visitConstructorDeclaration(ConstructorDeclaration node) => node.element;
Element visitFunctionDeclaration(FunctionDeclaration node) => node.element;
Element visitIdentifier(Identifier node) => node.element;
Element visitImportDirective(ImportDirective node) => node.element;
Element visitIndexExpression(IndexExpression node) => node.element;
+ Element visitInstanceCreationExpression(InstanceCreationExpression node) => node.element;
Element visitLibraryDirective(LibraryDirective node) => node.element;
Element visitMethodDeclaration(MethodDeclaration node) => node.element;
+ Element visitMethodInvocation(MethodInvocation node) => node.methodName.element;
Element visitPostfixExpression(PostfixExpression node) => node.element;
Element visitPrefixedIdentifier(PrefixedIdentifier node) => node.element;
Element visitPrefixExpression(PrefixExpression node) => node.element;
Element visitStringLiteral(StringLiteral node) {
- ASTNode parent12 = node.parent;
- if (parent12 is UriBasedDirective) {
- return ((parent12 as UriBasedDirective)).element;
+ ASTNode parent2 = node.parent;
+ if (parent2 is UriBasedDirective) {
+ return ((parent2 as UriBasedDirective)).element;
}
return null;
}
@@ -11541,6 +11598,7 @@
R visitMethodInvocation(MethodInvocation node) => visitExpression(node);
R visitNamedExpression(NamedExpression node) => visitExpression(node);
R visitNamespaceDirective(NamespaceDirective node) => visitUriBasedDirective(node);
+ R visitNativeFunctionBody(NativeFunctionBody node) => visitFunctionBody(node);
R visitNode(ASTNode node) {
node.visitChildren(this);
return null;
@@ -11615,10 +11673,10 @@
* @param offset the offset used to identify the node
*/
NodeLocator.con1(int offset) {
- _jtd_constructor_119_impl(offset);
+ _jtd_constructor_120_impl(offset);
}
- _jtd_constructor_119_impl(int offset) {
- _jtd_constructor_120_impl(offset, offset);
+ _jtd_constructor_120_impl(int offset) {
+ _jtd_constructor_121_impl(offset, offset);
}
/**
* Initialize a newly created locator to locate one or more {@link ASTNode AST nodes} by locating
@@ -11628,9 +11686,9 @@
* @param end the end offset of the range used to identify the node
*/
NodeLocator.con2(int start, int end) {
- _jtd_constructor_120_impl(start, end);
+ _jtd_constructor_121_impl(start, end);
}
- _jtd_constructor_120_impl(int start, int end) {
+ _jtd_constructor_121_impl(int start, int end) {
this._startOffset = start;
this._endOffset = end;
}
@@ -11658,6 +11716,14 @@
return _foundNode;
}
Object visitNode(ASTNode node) {
+ int start = node.offset;
+ int end = start + node.length;
+ if (end < _startOffset) {
+ return null;
+ }
+ if (start > _endOffset) {
+ return null;
+ }
try {
node.visitChildren(this);
} on NodeLocator_NodeFoundException catch (exception) {
@@ -11665,8 +11731,6 @@
} catch (exception) {
AnalysisEngine.instance.logger.logInformation2("Exception caught while traversing an AST structure.", exception);
}
- int start = node.offset;
- int end = start + node.length;
if (start <= _startOffset && _endOffset <= end) {
_foundNode = node;
throw new NodeLocator_NodeFoundException();
@@ -11952,6 +12016,10 @@
node.visitChildren(this);
return null;
}
+ R visitNativeFunctionBody(NativeFunctionBody node) {
+ node.visitChildren(this);
+ return null;
+ }
R visitNullLiteral(NullLiteral node) {
node.visitChildren(this);
return null;
@@ -12166,6 +12234,7 @@
R visitMethodDeclaration(MethodDeclaration node) => null;
R visitMethodInvocation(MethodInvocation node) => null;
R visitNamedExpression(NamedExpression node) => null;
+ R visitNativeFunctionBody(NativeFunctionBody node) => null;
R visitNullLiteral(NullLiteral node) => null;
R visitParenthesizedExpression(ParenthesizedExpression node) => null;
R visitPartDirective(PartDirective node) => null;
@@ -12341,12 +12410,12 @@
Object visitComment(Comment node) => null;
Object visitCommentReference(CommentReference node) => null;
Object visitCompilationUnit(CompilationUnit node) {
- ScriptTag scriptTag6 = node.scriptTag;
+ ScriptTag scriptTag2 = node.scriptTag;
NodeList<Directive> directives2 = node.directives;
- visit(scriptTag6);
- String prefix = scriptTag6 == null ? "" : " ";
+ visit(scriptTag2);
+ String prefix = scriptTag2 == null ? "" : " ";
visitList4(prefix, directives2, " ");
- prefix = scriptTag6 == null && directives2.isEmpty ? "" : " ";
+ prefix = scriptTag2 == null && directives2.isEmpty ? "" : " ";
visitList4(prefix, node.declarations, " ");
return null;
}
@@ -12473,10 +12542,10 @@
Object visitFormalParameterList(FormalParameterList node) {
String groupEnd = null;
_writer.print('(');
- NodeList<FormalParameter> parameters9 = node.parameters;
- int size2 = parameters9.length;
+ NodeList<FormalParameter> parameters2 = node.parameters;
+ int size2 = parameters2.length;
for (int i = 0; i < size2; i++) {
- FormalParameter parameter = parameters9[i];
+ FormalParameter parameter = parameters2[i];
if (i > 0) {
_writer.print(", ");
}
@@ -12498,10 +12567,10 @@
return null;
}
Object visitForStatement(ForStatement node) {
- Expression initialization3 = node.initialization;
+ Expression initialization2 = node.initialization;
_writer.print("for (");
- if (initialization3 != null) {
- visit(initialization3);
+ if (initialization2 != null) {
+ visit(initialization2);
} else {
visit(node.variables);
}
@@ -12699,6 +12768,12 @@
visit3(" ", node.expression);
return null;
}
+ Object visitNativeFunctionBody(NativeFunctionBody node) {
+ _writer.print("native ");
+ visit(node.stringLiteral);
+ _writer.print(';');
+ return null;
+ }
Object visitNullLiteral(NullLiteral node) {
_writer.print("null");
return null;
@@ -12758,12 +12833,12 @@
return null;
}
Object visitReturnStatement(ReturnStatement node) {
- Expression expression14 = node.expression;
- if (expression14 == null) {
+ Expression expression2 = node.expression;
+ if (expression2 == null) {
_writer.print("return;");
} else {
_writer.print("return ");
- expression14.accept(this);
+ expression2.accept(this);
_writer.print(";");
}
return null;
@@ -12965,8 +13040,8 @@
*/
void visitList2(NodeList<ASTNode> nodes, String separator) {
if (nodes != null) {
- int size3 = nodes.length;
- for (int i = 0; i < size3; i++) {
+ int size2 = nodes.length;
+ for (int i = 0; i < size2; i++) {
if (i > 0) {
_writer.print(separator);
}
@@ -12982,9 +13057,9 @@
*/
void visitList3(NodeList<ASTNode> nodes, String separator, String suffix) {
if (nodes != null) {
- int size4 = nodes.length;
- if (size4 > 0) {
- for (int i = 0; i < size4; i++) {
+ int size2 = nodes.length;
+ if (size2 > 0) {
+ for (int i = 0; i < size2; i++) {
if (i > 0) {
_writer.print(separator);
}
@@ -13002,10 +13077,10 @@
*/
void visitList4(String prefix, NodeList<ASTNode> nodes, String separator) {
if (nodes != null) {
- int size5 = nodes.length;
- if (size5 > 0) {
+ int size2 = nodes.length;
+ if (size2 > 0) {
_writer.print(prefix);
- for (int i = 0; i < size5; i++) {
+ for (int i = 0; i < size2; i++) {
if (i > 0) {
_writer.print(separator);
}
@@ -13016,6 +13091,147 @@
}
}
/**
+ * Instances of the class {@code ASTCloner} implement an object that will clone any AST structure
+ * that it visits. The cloner will only clone the structure, it will not preserve any resolution
+ * results or properties associated with the nodes.
+ */
+class ASTCloner implements ASTVisitor<ASTNode> {
+ AdjacentStrings visitAdjacentStrings(AdjacentStrings node) => new AdjacentStrings.full(clone2(node.strings));
+ Annotation visitAnnotation(Annotation node) => new Annotation.full(node.atSign, clone(node.name), node.period, clone(node.constructorName), clone(node.arguments));
+ ArgumentDefinitionTest visitArgumentDefinitionTest(ArgumentDefinitionTest node) => new ArgumentDefinitionTest.full(node.question, clone(node.identifier));
+ ArgumentList visitArgumentList(ArgumentList node) => new ArgumentList.full(node.leftParenthesis, clone2(node.arguments), node.rightParenthesis);
+ AsExpression visitAsExpression(AsExpression node) => new AsExpression.full(clone(node.expression), node.asOperator, clone(node.type));
+ ASTNode visitAssertStatement(AssertStatement node) => new AssertStatement.full(node.keyword, node.leftParenthesis, clone(node.condition), node.rightParenthesis, node.semicolon);
+ AssignmentExpression visitAssignmentExpression(AssignmentExpression node) => new AssignmentExpression.full(clone(node.leftHandSide), node.operator, clone(node.rightHandSide));
+ BinaryExpression visitBinaryExpression(BinaryExpression node) => new BinaryExpression.full(clone(node.leftOperand), node.operator, clone(node.rightOperand));
+ Block visitBlock(Block node) => new Block.full(node.leftBracket, clone2(node.statements), node.rightBracket);
+ BlockFunctionBody visitBlockFunctionBody(BlockFunctionBody node) => new BlockFunctionBody.full(clone(node.block));
+ BooleanLiteral visitBooleanLiteral(BooleanLiteral node) => new BooleanLiteral.full(node.literal, node.value);
+ BreakStatement visitBreakStatement(BreakStatement node) => new BreakStatement.full(node.keyword, clone(node.label), node.semicolon);
+ CascadeExpression visitCascadeExpression(CascadeExpression node) => new CascadeExpression.full(clone(node.target), clone2(node.cascadeSections));
+ CatchClause visitCatchClause(CatchClause node) => new CatchClause.full(node.onKeyword, clone(node.exceptionType), node.catchKeyword, node.leftParenthesis, clone(node.exceptionParameter), node.comma, clone(node.stackTraceParameter), node.rightParenthesis, clone(node.body));
+ ClassDeclaration visitClassDeclaration(ClassDeclaration node) => new ClassDeclaration.full(clone(node.documentationComment), clone2(node.metadata), node.abstractKeyword, node.classKeyword, clone(node.name), clone(node.typeParameters), clone(node.extendsClause), clone(node.withClause), clone(node.implementsClause), node.leftBracket, clone2(node.members), node.rightBracket);
+ ClassTypeAlias visitClassTypeAlias(ClassTypeAlias node) => new ClassTypeAlias.full(clone(node.documentationComment), clone2(node.metadata), node.keyword, clone(node.name), clone(node.typeParameters), node.equals, node.abstractKeyword, clone(node.superclass), clone(node.withClause), clone(node.implementsClause), node.semicolon);
+ Comment visitComment(Comment node) {
+ if (node.isDocumentation()) {
+ return Comment.createDocumentationComment2(node.tokens, clone2(node.references));
+ } else if (node.isBlock()) {
+ return Comment.createBlockComment(node.tokens);
+ }
+ return Comment.createEndOfLineComment(node.tokens);
+ }
+ CommentReference visitCommentReference(CommentReference node) => new CommentReference.full(node.newKeyword, clone(node.identifier));
+ CompilationUnit visitCompilationUnit(CompilationUnit node) {
+ CompilationUnit clone22 = new CompilationUnit.full(node.beginToken, clone(node.scriptTag), clone2(node.directives), clone2(node.declarations), node.endToken);
+ clone22.lineInfo = node.lineInfo;
+ clone22.parsingErrors = node.parsingErrors;
+ clone22.resolutionErrors = node.resolutionErrors;
+ return clone22;
+ }
+ ConditionalExpression visitConditionalExpression(ConditionalExpression node) => new ConditionalExpression.full(clone(node.condition), node.question, clone(node.thenExpression), node.colon, clone(node.elseExpression));
+ ConstructorDeclaration visitConstructorDeclaration(ConstructorDeclaration node) => new ConstructorDeclaration.full(clone(node.documentationComment), clone2(node.metadata), node.externalKeyword, node.constKeyword, node.factoryKeyword, clone(node.returnType), node.period, clone(node.name), clone(node.parameters), node.separator, clone2(node.initializers), clone(node.redirectedConstructor), clone(node.body));
+ ConstructorFieldInitializer visitConstructorFieldInitializer(ConstructorFieldInitializer node) => new ConstructorFieldInitializer.full(node.keyword, node.period, clone(node.fieldName), node.equals, clone(node.expression));
+ ConstructorName visitConstructorName(ConstructorName node) => new ConstructorName.full(clone(node.type), node.period, clone(node.name));
+ ContinueStatement visitContinueStatement(ContinueStatement node) => new ContinueStatement.full(node.keyword, clone(node.label), node.semicolon);
+ DeclaredIdentifier visitDeclaredIdentifier(DeclaredIdentifier node) => new DeclaredIdentifier.full(clone(node.documentationComment), clone2(node.metadata), node.keyword, clone(node.type), clone(node.identifier));
+ DefaultFormalParameter visitDefaultFormalParameter(DefaultFormalParameter node) => new DefaultFormalParameter.full(clone(node.parameter), node.kind, node.separator, clone(node.defaultValue));
+ DoStatement visitDoStatement(DoStatement node) => new DoStatement.full(node.doKeyword, clone(node.body), node.whileKeyword, node.leftParenthesis, clone(node.condition), node.rightParenthesis, node.semicolon);
+ DoubleLiteral visitDoubleLiteral(DoubleLiteral node) => new DoubleLiteral.full(node.literal, node.value);
+ EmptyFunctionBody visitEmptyFunctionBody(EmptyFunctionBody node) => new EmptyFunctionBody.full(node.semicolon);
+ EmptyStatement visitEmptyStatement(EmptyStatement node) => new EmptyStatement.full(node.semicolon);
+ ExportDirective visitExportDirective(ExportDirective node) => new ExportDirective.full(clone(node.documentationComment), clone2(node.metadata), node.keyword, clone(node.uri), clone2(node.combinators), node.semicolon);
+ ExpressionFunctionBody visitExpressionFunctionBody(ExpressionFunctionBody node) => new ExpressionFunctionBody.full(node.functionDefinition, clone(node.expression), node.semicolon);
+ ExpressionStatement visitExpressionStatement(ExpressionStatement node) => new ExpressionStatement.full(clone(node.expression), node.semicolon);
+ ExtendsClause visitExtendsClause(ExtendsClause node) => new ExtendsClause.full(node.keyword, clone(node.superclass));
+ FieldDeclaration visitFieldDeclaration(FieldDeclaration node) => new FieldDeclaration.full(clone(node.documentationComment), clone2(node.metadata), node.keyword, clone(node.fields), node.semicolon);
+ FieldFormalParameter visitFieldFormalParameter(FieldFormalParameter node) => new FieldFormalParameter.full(clone(node.documentationComment), clone2(node.metadata), node.keyword, clone(node.type), node.thisToken, node.period, clone(node.identifier));
+ ForEachStatement visitForEachStatement(ForEachStatement node) => new ForEachStatement.full(node.forKeyword, node.leftParenthesis, clone(node.loopVariable), node.inKeyword, clone(node.iterator), node.rightParenthesis, clone(node.body));
+ FormalParameterList visitFormalParameterList(FormalParameterList node) => new FormalParameterList.full(node.leftParenthesis, clone2(node.parameters), node.leftDelimiter, node.rightDelimiter, node.rightParenthesis);
+ ForStatement visitForStatement(ForStatement node) => new ForStatement.full(node.forKeyword, node.leftParenthesis, clone(node.variables), clone(node.initialization), node.leftSeparator, clone(node.condition), node.rightSeparator, clone2(node.updaters), node.rightParenthesis, clone(node.body));
+ FunctionDeclaration visitFunctionDeclaration(FunctionDeclaration node) => new FunctionDeclaration.full(clone(node.documentationComment), clone2(node.metadata), node.externalKeyword, clone(node.returnType), node.propertyKeyword, clone(node.name), clone(node.functionExpression));
+ FunctionDeclarationStatement visitFunctionDeclarationStatement(FunctionDeclarationStatement node) => new FunctionDeclarationStatement.full(clone(node.functionDeclaration));
+ FunctionExpression visitFunctionExpression(FunctionExpression node) => new FunctionExpression.full(clone(node.parameters), clone(node.body));
+ FunctionExpressionInvocation visitFunctionExpressionInvocation(FunctionExpressionInvocation node) => new FunctionExpressionInvocation.full(clone(node.function), clone(node.argumentList));
+ FunctionTypeAlias visitFunctionTypeAlias(FunctionTypeAlias node) => new FunctionTypeAlias.full(clone(node.documentationComment), clone2(node.metadata), node.keyword, clone(node.returnType), clone(node.name), clone(node.typeParameters), clone(node.parameters), node.semicolon);
+ FunctionTypedFormalParameter visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) => new FunctionTypedFormalParameter.full(clone(node.documentationComment), clone2(node.metadata), clone(node.returnType), clone(node.identifier), clone(node.parameters));
+ HideCombinator visitHideCombinator(HideCombinator node) => new HideCombinator.full(node.keyword, clone2(node.hiddenNames));
+ IfStatement visitIfStatement(IfStatement node) => new IfStatement.full(node.ifKeyword, node.leftParenthesis, clone(node.condition), node.rightParenthesis, clone(node.thenStatement), node.elseKeyword, clone(node.elseStatement));
+ ImplementsClause visitImplementsClause(ImplementsClause node) => new ImplementsClause.full(node.keyword, clone2(node.interfaces));
+ ImportDirective visitImportDirective(ImportDirective node) => new ImportDirective.full(clone(node.documentationComment), clone2(node.metadata), node.keyword, clone(node.uri), node.asToken, clone(node.prefix), clone2(node.combinators), node.semicolon);
+ IndexExpression visitIndexExpression(IndexExpression node) {
+ Token period2 = node.period;
+ if (period2 == null) {
+ return new IndexExpression.forTarget_full(clone(node.array), node.leftBracket, clone(node.index), node.rightBracket);
+ } else {
+ return new IndexExpression.forCascade_full(period2, node.leftBracket, clone(node.index), node.rightBracket);
+ }
+ }
+ InstanceCreationExpression visitInstanceCreationExpression(InstanceCreationExpression node) => new InstanceCreationExpression.full(node.keyword, clone(node.constructorName), clone(node.argumentList));
+ IntegerLiteral visitIntegerLiteral(IntegerLiteral node) => new IntegerLiteral.full(node.literal, node.value);
+ InterpolationExpression visitInterpolationExpression(InterpolationExpression node) => new InterpolationExpression.full(node.leftBracket, clone(node.expression), node.rightBracket);
+ InterpolationString visitInterpolationString(InterpolationString node) => new InterpolationString.full(node.contents, node.value);
+ IsExpression visitIsExpression(IsExpression node) => new IsExpression.full(clone(node.expression), node.isOperator, node.notOperator, clone(node.type));
+ Label visitLabel(Label node) => new Label.full(clone(node.label), node.colon);
+ LabeledStatement visitLabeledStatement(LabeledStatement node) => new LabeledStatement.full(clone2(node.labels), clone(node.statement));
+ LibraryDirective visitLibraryDirective(LibraryDirective node) => new LibraryDirective.full(clone(node.documentationComment), clone2(node.metadata), node.libraryToken, clone(node.name), node.semicolon);
+ LibraryIdentifier visitLibraryIdentifier(LibraryIdentifier node) => new LibraryIdentifier.full(clone2(node.components));
+ ListLiteral visitListLiteral(ListLiteral node) => new ListLiteral.full(node.modifier, clone(node.typeArguments), node.leftBracket, clone2(node.elements), node.rightBracket);
+ MapLiteral visitMapLiteral(MapLiteral node) => new MapLiteral.full(node.modifier, clone(node.typeArguments), node.leftBracket, clone2(node.entries), node.rightBracket);
+ MapLiteralEntry visitMapLiteralEntry(MapLiteralEntry node) => new MapLiteralEntry.full(clone(node.key), node.separator, clone(node.value));
+ MethodDeclaration visitMethodDeclaration(MethodDeclaration node) => new MethodDeclaration.full(clone(node.documentationComment), clone2(node.metadata), node.externalKeyword, node.modifierKeyword, clone(node.returnType), node.propertyKeyword, node.operatorKeyword, clone(node.name), clone(node.parameters), clone(node.body));
+ MethodInvocation visitMethodInvocation(MethodInvocation node) => new MethodInvocation.full(clone(node.target), node.period, clone(node.methodName), clone(node.argumentList));
+ NamedExpression visitNamedExpression(NamedExpression node) => new NamedExpression.full(clone(node.name), clone(node.expression));
+ NativeFunctionBody visitNativeFunctionBody(NativeFunctionBody node) => new NativeFunctionBody.full(node.nativeToken, clone(node.stringLiteral), node.semicolon);
+ NullLiteral visitNullLiteral(NullLiteral node) => new NullLiteral.full(node.literal);
+ ParenthesizedExpression visitParenthesizedExpression(ParenthesizedExpression node) => new ParenthesizedExpression.full(node.leftParenthesis, clone(node.expression), node.rightParenthesis);
+ PartDirective visitPartDirective(PartDirective node) => new PartDirective.full(clone(node.documentationComment), clone2(node.metadata), node.partToken, clone(node.uri), node.semicolon);
+ PartOfDirective visitPartOfDirective(PartOfDirective node) => new PartOfDirective.full(clone(node.documentationComment), clone2(node.metadata), node.partToken, node.ofToken, clone(node.libraryName), node.semicolon);
+ PostfixExpression visitPostfixExpression(PostfixExpression node) => new PostfixExpression.full(clone(node.operand), node.operator);
+ PrefixedIdentifier visitPrefixedIdentifier(PrefixedIdentifier node) => new PrefixedIdentifier.full(clone(node.prefix), node.period, clone(node.identifier));
+ PrefixExpression visitPrefixExpression(PrefixExpression node) => new PrefixExpression.full(node.operator, clone(node.operand));
+ PropertyAccess visitPropertyAccess(PropertyAccess node) => new PropertyAccess.full(clone(node.target), node.operator, clone(node.propertyName));
+ RedirectingConstructorInvocation visitRedirectingConstructorInvocation(RedirectingConstructorInvocation node) => new RedirectingConstructorInvocation.full(node.keyword, node.period, clone(node.constructorName), clone(node.argumentList));
+ RethrowExpression visitRethrowExpression(RethrowExpression node) => new RethrowExpression.full(node.keyword);
+ ReturnStatement visitReturnStatement(ReturnStatement node) => new ReturnStatement.full(node.keyword, clone(node.expression), node.semicolon);
+ ScriptTag visitScriptTag(ScriptTag node) => new ScriptTag.full(node.scriptTag);
+ ShowCombinator visitShowCombinator(ShowCombinator node) => new ShowCombinator.full(node.keyword, clone2(node.shownNames));
+ SimpleFormalParameter visitSimpleFormalParameter(SimpleFormalParameter node) => new SimpleFormalParameter.full(clone(node.documentationComment), clone2(node.metadata), node.keyword, clone(node.type), clone(node.identifier));
+ SimpleIdentifier visitSimpleIdentifier(SimpleIdentifier node) => new SimpleIdentifier.full(node.token);
+ SimpleStringLiteral visitSimpleStringLiteral(SimpleStringLiteral node) => new SimpleStringLiteral.full(node.literal, node.value);
+ StringInterpolation visitStringInterpolation(StringInterpolation node) => new StringInterpolation.full(clone2(node.elements));
+ SuperConstructorInvocation visitSuperConstructorInvocation(SuperConstructorInvocation node) => new SuperConstructorInvocation.full(node.keyword, node.period, clone(node.constructorName), clone(node.argumentList));
+ SuperExpression visitSuperExpression(SuperExpression node) => new SuperExpression.full(node.keyword);
+ SwitchCase visitSwitchCase(SwitchCase node) => new SwitchCase.full(clone2(node.labels), node.keyword, clone(node.expression), node.colon, clone2(node.statements));
+ SwitchDefault visitSwitchDefault(SwitchDefault node) => new SwitchDefault.full(clone2(node.labels), node.keyword, node.colon, clone2(node.statements));
+ SwitchStatement visitSwitchStatement(SwitchStatement node) => new SwitchStatement.full(node.keyword, node.leftParenthesis, clone(node.expression), node.rightParenthesis, node.leftBracket, clone2(node.members), node.rightBracket);
+ ThisExpression visitThisExpression(ThisExpression node) => new ThisExpression.full(node.keyword);
+ ThrowExpression visitThrowExpression(ThrowExpression node) => new ThrowExpression.full(node.keyword, clone(node.expression));
+ TopLevelVariableDeclaration visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) => new TopLevelVariableDeclaration.full(clone(node.documentationComment), clone2(node.metadata), clone(node.variables), node.semicolon);
+ TryStatement visitTryStatement(TryStatement node) => new TryStatement.full(node.tryKeyword, clone(node.body), clone2(node.catchClauses), node.finallyKeyword, clone(node.finallyClause));
+ TypeArgumentList visitTypeArgumentList(TypeArgumentList node) => new TypeArgumentList.full(node.leftBracket, clone2(node.arguments), node.rightBracket);
+ TypeName visitTypeName(TypeName node) => new TypeName.full(clone(node.name), clone(node.typeArguments));
+ TypeParameter visitTypeParameter(TypeParameter node) => new TypeParameter.full(clone(node.documentationComment), clone2(node.metadata), clone(node.name), node.keyword, clone(node.bound));
+ TypeParameterList visitTypeParameterList(TypeParameterList node) => new TypeParameterList.full(node.leftBracket, clone2(node.typeParameters), node.rightBracket);
+ VariableDeclaration visitVariableDeclaration(VariableDeclaration node) => new VariableDeclaration.full(clone(node.documentationComment), clone2(node.metadata), clone(node.name), node.equals, clone(node.initializer));
+ VariableDeclarationList visitVariableDeclarationList(VariableDeclarationList node) => new VariableDeclarationList.full(clone(node.documentationComment), clone2(node.metadata), node.keyword, clone(node.type), clone2(node.variables));
+ VariableDeclarationStatement visitVariableDeclarationStatement(VariableDeclarationStatement node) => new VariableDeclarationStatement.full(clone(node.variables), node.semicolon);
+ WhileStatement visitWhileStatement(WhileStatement node) => new WhileStatement.full(node.keyword, node.leftParenthesis, clone(node.condition), node.rightParenthesis, clone(node.body));
+ WithClause visitWithClause(WithClause node) => new WithClause.full(node.withKeyword, clone2(node.mixinTypes));
+ ASTNode clone(ASTNode node) {
+ if (node == null) {
+ return null;
+ }
+ return node.accept(this) as ASTNode;
+ }
+ List clone2(NodeList nodes) {
+ List clonedNodes = new List();
+ for (ASTNode node in nodes) {
+ clonedNodes.add((node.accept(this) as ASTNode));
+ }
+ return clonedNodes;
+ }
+}
+/**
* Instances of the class {@code NodeList} represent a list of AST nodes that have a common parent.
*/
class NodeList<E extends ASTNode> extends ListWrapper<E> {
diff --git a/pkg/analyzer_experimental/lib/src/generated/constant.dart b/pkg/analyzer_experimental/lib/src/generated/constant.dart
index 6dfbb47..67dfbdb 100644
--- a/pkg/analyzer_experimental/lib/src/generated/constant.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/constant.dart
@@ -9,6 +9,7 @@
import 'scanner.dart' show TokenType;
import 'ast.dart';
import 'element.dart';
+import 'engine.dart' show AnalysisEngine;
/**
* Instances of the class {@code ConstantEvaluator} evaluate constant expressions to produce their
@@ -124,6 +125,131 @@
bool isValid() => _errors == null;
}
/**
+ * Instances of the class {@code ConstantFinder} are used to traverse the AST structures of all of
+ * the compilation units being resolved and build a table mapping constant variable elements to the
+ * declarations of those variables.
+ */
+class ConstantFinder extends RecursiveASTVisitor<Object> {
+ /**
+ * A table mapping constant variable elements to the declarations of those variables.
+ */
+ Map<VariableElement, VariableDeclaration> _variableMap = new Map<VariableElement, VariableDeclaration>();
+ /**
+ * Initialize a newly created constant finder.
+ */
+ ConstantFinder() : super() {
+ }
+ /**
+ * Return a table mapping constant variable elements to the declarations of those variables.
+ * @return a table mapping constant variable elements to the declarations of those variables
+ */
+ Map<VariableElement, VariableDeclaration> get variableMap => _variableMap;
+ Object visitVariableDeclaration(VariableDeclaration node) {
+ super.visitVariableDeclaration(node);
+ Expression initializer2 = node.initializer;
+ if (initializer2 != null && node.isConst()) {
+ VariableElement element2 = node.element;
+ if (element2 != null) {
+ _variableMap[element2] = node;
+ }
+ }
+ return null;
+ }
+}
+/**
+ * Instances of the class {@code ConstantValueComputer} compute the values of constant variables in
+ * one or more compilation units. The expected usage pattern is for the compilation units to be
+ * added to this computer using the method {@link #add(CompilationUnit)} and then for the method{@link #computeValues()} to invoked exactly once. Any use of an instance after invoking the
+ * method {@link #computeValues()} will result in unpredictable behavior.
+ */
+class ConstantValueComputer {
+ /**
+ * The object used to find constant variables in the compilation units that were added.
+ */
+ ConstantFinder _constantFinder = new ConstantFinder();
+ /**
+ * A graph in which the nodes are the constant variables and the edges are from each variable to
+ * the other constant variables that are referenced in the head's initializer.
+ */
+ DirectedGraph<VariableElement> _referenceGraph = new DirectedGraph<VariableElement>();
+ /**
+ * A table mapping constant variables to the declarations of those variables.
+ */
+ Map<VariableElement, VariableDeclaration> _declarationMap;
+ /**
+ * Initialize a newly created constant value computer.
+ */
+ ConstantValueComputer() : super() {
+ }
+ /**
+ * Add the constant variables in the given compilation unit to the list of constant variables
+ * whose value needs to be computed.
+ * @param unit the compilation unit defining the constant variables to be added
+ */
+ void add(CompilationUnit unit) {
+ unit.accept(_constantFinder);
+ }
+ /**
+ * Compute values for all of the constant variables in the compilation units that were added.
+ */
+ void computeValues() {
+ _declarationMap = _constantFinder.variableMap;
+ for (MapEntry<VariableElement, VariableDeclaration> entry in getMapEntrySet(_declarationMap)) {
+ VariableElement element = entry.getKey();
+ ReferenceFinder referenceFinder = new ReferenceFinder(element, _referenceGraph);
+ _referenceGraph.addNode(element);
+ entry.getValue().initializer.accept(referenceFinder);
+ }
+ while (!_referenceGraph.isEmpty()) {
+ VariableElement element = _referenceGraph.removeSink();
+ while (element != null) {
+ computeValueFor(element);
+ element = _referenceGraph.removeSink();
+ }
+ if (!_referenceGraph.isEmpty()) {
+ List<VariableElement> variablesInCycle = _referenceGraph.findCycle();
+ if (variablesInCycle == null) {
+ AnalysisEngine.instance.logger.logError("Exiting constant value computer with ${_referenceGraph.nodeCount} variables that are neither sinks no in a cycle");
+ return;
+ }
+ for (VariableElement variable in variablesInCycle) {
+ generateCycleError(variablesInCycle, variable);
+ }
+ _referenceGraph.removeAllNodes(variablesInCycle);
+ }
+ }
+ }
+ /**
+ * Compute a value for the given variable.
+ * @param variable the variable for which a value is to be computed
+ */
+ void computeValueFor(VariableElement variable) {
+ VariableDeclaration declaration = _declarationMap[variable];
+ if (declaration == null) {
+ return;
+ }
+ EvaluationResultImpl result = declaration.initializer.accept(new ConstantVisitor());
+ ((variable as VariableElementImpl)).evaluationResult = result;
+ if (result is ErrorResult) {
+ List<AnalysisError> errors = new List<AnalysisError>();
+ for (ErrorResult_ErrorData data in ((result as ErrorResult)).errorData) {
+ ASTNode node2 = data.node;
+ Source source2 = variable.getAncestor(CompilationUnitElement).source;
+ errors.add(new AnalysisError.con2(source2, node2.offset, node2.length, data.errorCode, []));
+ }
+ }
+ }
+ /**
+ * Generate an error indicating that the given variable is not a valid compile-time constant
+ * because it references at least one of the variables in the given cycle, each of which directly
+ * or indirectly references the variable.
+ * @param variablesInCycle the variables in the cycle that includes the given variable
+ * @param variable the variable that is not a valid compile-time constant
+ */
+ void generateCycleError(List<VariableElement> variablesInCycle, VariableElement variable) {
+ }
+}
+/**
* Instances of the class {@code ConstantVisitor} evaluate constant expressions to produce their
* compile-time value. According to the Dart Language Specification: <blockquote> A constant
* expression is one of the following:
@@ -251,18 +377,18 @@
return ValidResult.RESULT_OBJECT;
}
EvaluationResultImpl visitMethodInvocation(MethodInvocation node) {
- Element element23 = node.methodName.element;
- if (element23 is FunctionElement) {
- FunctionElement function = element23 as FunctionElement;
+ Element element2 = node.methodName.element;
+ if (element2 is FunctionElement) {
+ FunctionElement function = element2 as FunctionElement;
if (function.name == "identical") {
- NodeList<Expression> arguments3 = node.argumentList.arguments;
- if (arguments3.length == 2) {
+ NodeList<Expression> arguments2 = node.argumentList.arguments;
+ if (arguments2.length == 2) {
Element enclosingElement2 = function.enclosingElement;
if (enclosingElement2 is CompilationUnitElement) {
- LibraryElement library20 = ((enclosingElement2 as CompilationUnitElement)).library;
- if (library20.isDartCore()) {
- EvaluationResultImpl leftArgument = arguments3[0].accept(this);
- EvaluationResultImpl rightArgument = arguments3[1].accept(this);
+ LibraryElement library2 = ((enclosingElement2 as CompilationUnitElement)).library;
+ if (library2.isDartCore()) {
+ EvaluationResultImpl leftArgument = arguments2[0].accept(this);
+ EvaluationResultImpl rightArgument = arguments2[1].accept(this);
return leftArgument.equalEqual(node, rightArgument);
}
}
@@ -276,14 +402,14 @@
EvaluationResultImpl visitParenthesizedExpression(ParenthesizedExpression node) => node.expression.accept(this);
EvaluationResultImpl visitPrefixedIdentifier(PrefixedIdentifier node) => getConstantValue(node, node.element);
EvaluationResultImpl visitPrefixExpression(PrefixExpression node) {
- EvaluationResultImpl operand3 = node.operand.accept(this);
+ EvaluationResultImpl operand2 = node.operand.accept(this);
while (true) {
if (node.operator.type == TokenType.BANG) {
- return operand3.logicalNot(node);
+ return operand2.logicalNot(node);
} else if (node.operator.type == TokenType.TILDE) {
- return operand3.bitNot(node);
+ return operand2.bitNot(node);
} else if (node.operator.type == TokenType.MINUS) {
- return operand3.negated(node);
+ return operand2.negated(node);
}
break;
}
@@ -317,14 +443,16 @@
* @return the constant value of the static constant
*/
EvaluationResultImpl getConstantValue(ASTNode node, Element element) {
- if (element is PropertyAccessorElementImpl) {
- element = ((element as PropertyAccessorElementImpl)).variable;
+ if (element is PropertyAccessorElement) {
+ element = ((element as PropertyAccessorElement)).variable;
}
if (element is VariableElementImpl) {
EvaluationResultImpl value = ((element as VariableElementImpl)).evaluationResult;
if (value != null) {
return value;
}
+ } else if (element is ExecutableElement) {
+ return new ValidResult(element);
}
return error(node, null);
}
@@ -348,6 +476,147 @@
}
}
/**
+ * Instances of the class {@code DirectedGraph} implement a directed graph in which the nodes are
+ * arbitrary (client provided) objects and edges are represented implicitly. The graph will allow an
+ * edge from any node to any other node, including itself, but will not represent multiple edges
+ * between the same pair of nodes.
+ * @param N the type of the nodes in the graph
+ */
+class DirectedGraph<N> {
+ /**
+ * The table encoding the edges in the graph. An edge is represented by an entry mapping the head
+ * to a set of tails. Nodes that are not the head of any edge are represented by an entry mapping
+ * the node to an empty set of tails.
+ */
+ Map<N, Set<N>> _edges = new Map<N, Set<N>>();
+ /**
+ * Initialize a newly create directed graph to be empty.
+ */
+ DirectedGraph() : super() {
+ }
+ /**
+ * Add an edge from the given head node to the given tail node. Both nodes will be a part of the
+ * graph after this method is invoked, whether or not they were before.
+ * @param head the node at the head of the edge
+ * @param tail the node at the tail of the edge
+ */
+ void addEdge(N head, N tail) {
+ Set<N> tails = _edges[tail];
+ if (tails == null) {
+ _edges[tail] = new Set<N>();
+ }
+ tails = _edges[head];
+ if (tails == null) {
+ tails = new Set<N>();
+ _edges[head] = tails;
+ }
+ javaSetAdd(tails, tail);
+ }
+ /**
+ * Add the given node to the set of nodes in the graph.
+ * @param node the node to be added
+ */
+ void addNode(N node) {
+ Set<N> tails = _edges[node];
+ if (tails == null) {
+ _edges[node] = new Set<N>();
+ }
+ }
+ /**
+ * Return a list of nodes that form a cycle, or {@code null} if there are no cycles in this graph.
+ * @return a list of nodes that form a cycle
+ */
+ List<N> findCycle() => null;
+ /**
+ * Return the number of nodes in this graph.
+ * @return the number of nodes in this graph
+ */
+ int get nodeCount => _edges.length;
+ /**
+ * Return a set containing the tails of edges that have the given node as their head. The set will
+ * be empty if there are no such edges or if the node is not part of the graph. Clients must not
+ * modify the returned set.
+ * @param head the node at the head of all of the edges whose tails are to be returned
+ * @return a set containing the tails of edges that have the given node as their head
+ */
+ Set<N> getTails(N head) {
+ Set<N> tails = _edges[head];
+ if (tails == null) {
+ return new Set<N>();
+ }
+ return tails;
+ }
+ /**
+ * Return {@code true} if this graph is empty.
+ * @return {@code true} if this graph is empty
+ */
+ bool isEmpty() => _edges.isEmpty;
+ /**
+ * Remove all of the given nodes from this graph. As a consequence, any edges for which those
+ * nodes were either a head or a tail will also be removed.
+ * @param nodes the nodes to be removed
+ */
+ void removeAllNodes(List<N> nodes) {
+ for (N node in nodes) {
+ removeNode(node);
+ }
+ }
+ /**
+ * Remove the edge from the given head node to the given tail node. If there was no such edge then
+ * the graph will be unmodified: the number of edges will be the same and the set of nodes will be
+ * the same (neither node will either be added or removed).
+ * @param head the node at the head of the edge
+ * @param tail the node at the tail of the edge
+ * @return {@code true} if the graph was modified as a result of this operation
+ */
+ void removeEdge(N head, N tail) {
+ Set<N> tails = _edges[head];
+ if (tails != null) {
+ tails.remove(tail);
+ }
+ }
+ /**
+ * Remove the given node from this graph. As a consequence, any edges for which that node was
+ * either a head or a tail will also be removed.
+ * @param node the node to be removed
+ */
+ void removeNode(N node) {
+ _edges.remove(node);
+ for (Set<N> tails in _edges.values) {
+ tails.remove(node);
+ }
+ }
+ /**
+ * Find one node (referred to as a sink node) that has no outgoing edges (that is, for which there
+ * are no edges that have that node as the head of the edge) and remove it from this graph. Return
+ * the node that was removed, or {@code null} if there are no such nodes either because the graph
+ * is empty or because every node in the graph has at least one outgoing edge. As a consequence of
+ * removing the node from the graph any edges for which that node was a tail will also be removed.
+ * @return the sink node that was removed
+ */
+ N removeSink() {
+ N sink = findSink();
+ if (sink == null) {
+ return null;
+ }
+ removeNode(sink);
+ return sink;
+ }
+ /**
+ * Return one node that has no outgoing edges (that is, for which there are no edges that have
+ * that node as the head of the edge), or {@code null} if there are no such nodes.
+ * @return a sink node
+ */
+ N findSink() {
+ for (MapEntry<N, Set<N>> entry in getMapEntrySet(_edges)) {
+ if (entry.getValue().isEmpty) {
+ return entry.getKey();
+ }
+ }
+ return null;
+ }
+}
+/**
* Instances of the class {@code ErrorResult} represent the result of evaluating an expression that
* is not a valid compile time constant.
*/
@@ -363,9 +632,9 @@
* @param errorCode the error code for the error to be generated
*/
ErrorResult.con1(ASTNode node, ErrorCode errorCode) {
- _jtd_constructor_157_impl(node, errorCode);
+ _jtd_constructor_162_impl(node, errorCode);
}
- _jtd_constructor_157_impl(ASTNode node, ErrorCode errorCode) {
+ _jtd_constructor_162_impl(ASTNode node, ErrorCode errorCode) {
_errors.add(new ErrorResult_ErrorData(node, errorCode));
}
/**
@@ -375,9 +644,9 @@
* @param secondResult the second set of results being merged
*/
ErrorResult.con2(ErrorResult firstResult, ErrorResult secondResult) {
- _jtd_constructor_158_impl(firstResult, secondResult);
+ _jtd_constructor_163_impl(firstResult, secondResult);
}
- _jtd_constructor_158_impl(ErrorResult firstResult, ErrorResult secondResult) {
+ _jtd_constructor_163_impl(ErrorResult firstResult, ErrorResult secondResult) {
_errors.addAll(firstResult._errors);
_errors.addAll(secondResult._errors);
}
@@ -390,7 +659,6 @@
EvaluationResultImpl divide(BinaryExpression node, EvaluationResultImpl rightOperand) => rightOperand.divideError(node, this);
EvaluationResultImpl equalEqual(Expression node, EvaluationResultImpl rightOperand) => rightOperand.equalEqualError(node, this);
List<ErrorResult_ErrorData> get errorData => _errors;
- List<AnalysisError> get errors => new List.from(_errors);
EvaluationResultImpl greaterThan(BinaryExpression node, EvaluationResultImpl rightOperand) => rightOperand.greaterThanError(node, this);
EvaluationResultImpl greaterThanOrEqual(BinaryExpression node, EvaluationResultImpl rightOperand) => rightOperand.greaterThanOrEqualError(node, this);
EvaluationResultImpl integerDivide(BinaryExpression node, EvaluationResultImpl rightOperand) => rightOperand.integerDivideError(node, this);
@@ -549,6 +817,45 @@
EvaluationResultImpl timesValid(BinaryExpression node, ValidResult leftOperand);
}
/**
+ * Instances of the class {@code ReferenceFinder} add reference information for a given variable to
+ * the bi-directional mapping used to order the evaluation of constants.
+ */
+class ReferenceFinder extends RecursiveASTVisitor<Object> {
+ /**
+ * The element representing the variable whose initializer will be visited.
+ */
+ VariableElement _source;
+ /**
+ * A graph in which the nodes are the constant variables and the edges are from each variable to
+ * the other constant variables that are referenced in the head's initializer.
+ */
+ DirectedGraph<VariableElement> _referenceGraph;
+ /**
+ * Initialize a newly created reference finder to find references from the given variable to other
+ * variables and to add those references to the given graph.
+ * @param source the element representing the variable whose initializer will be visited
+ * @param referenceGraph a graph recording which variables (heads) reference which other variables
+ * (tails) in their initializers
+ */
+ ReferenceFinder(VariableElement source, DirectedGraph<VariableElement> referenceGraph) {
+ this._source = source;
+ this._referenceGraph = referenceGraph;
+ }
+ Object visitSimpleIdentifier(SimpleIdentifier node) {
+ Element element2 = node.element;
+ if (element2 is PropertyAccessorElement) {
+ element2 = ((element2 as PropertyAccessorElement)).variable;
+ }
+ if (element2 is VariableElement) {
+ VariableElement variable = element2 as VariableElement;
+ if (variable.isConst()) {
+ _referenceGraph.addEdge(_source, variable);
+ }
+ }
+ return null;
+ }
+}
+/**
* Instances of the class {@code ValidResult} represent the result of attempting to evaluate a valid
* compile time constant expression.
*/
@@ -645,8 +952,8 @@
return _value.toString();
}
EvaluationResultImpl addToError(BinaryExpression node, ErrorResult leftOperand) => leftOperand;
- EvaluationResultImpl addToValid(BinaryExpression node, ValidResult leftOperand3) {
- Object leftValue = leftOperand3.value;
+ EvaluationResultImpl addToValid(BinaryExpression node, ValidResult leftOperand2) {
+ Object leftValue = leftOperand2.value;
if (leftValue == null) {
return error(node.leftOperand);
} else if (_value == null) {
@@ -671,8 +978,8 @@
return error(node);
}
EvaluationResultImpl bitAndError(BinaryExpression node, ErrorResult leftOperand) => leftOperand;
- EvaluationResultImpl bitAndValid(BinaryExpression node, ValidResult leftOperand4) {
- Object leftValue = leftOperand4.value;
+ EvaluationResultImpl bitAndValid(BinaryExpression node, ValidResult leftOperand2) {
+ Object leftValue = leftOperand2.value;
if (leftValue == null) {
return error(node.leftOperand);
} else if (_value == null) {
@@ -689,8 +996,8 @@
return union(error(node.leftOperand), error(node.rightOperand));
}
EvaluationResultImpl bitOrError(BinaryExpression node, ErrorResult leftOperand) => leftOperand;
- EvaluationResultImpl bitOrValid(BinaryExpression node, ValidResult leftOperand5) {
- Object leftValue = leftOperand5.value;
+ EvaluationResultImpl bitOrValid(BinaryExpression node, ValidResult leftOperand2) {
+ Object leftValue = leftOperand2.value;
if (leftValue == null) {
return error(node.leftOperand);
} else if (_value == null) {
@@ -707,8 +1014,8 @@
return union(error(node.leftOperand), error(node.rightOperand));
}
EvaluationResultImpl bitXorError(BinaryExpression node, ErrorResult leftOperand) => leftOperand;
- EvaluationResultImpl bitXorValid(BinaryExpression node, ValidResult leftOperand6) {
- Object leftValue = leftOperand6.value;
+ EvaluationResultImpl bitXorValid(BinaryExpression node, ValidResult leftOperand2) {
+ Object leftValue = leftOperand2.value;
if (leftValue == null) {
return error(node.leftOperand);
} else if (_value == null) {
@@ -733,8 +1040,8 @@
return error(node);
}
EvaluationResultImpl divideError(BinaryExpression node, ErrorResult leftOperand) => leftOperand;
- EvaluationResultImpl divideValid(BinaryExpression node, ValidResult leftOperand7) {
- Object leftValue = leftOperand7.value;
+ EvaluationResultImpl divideValid(BinaryExpression node, ValidResult leftOperand2) {
+ Object leftValue = leftOperand2.value;
if (leftValue == null) {
return error(node.leftOperand);
} else if (_value == null) {
@@ -742,7 +1049,7 @@
} else if (leftValue is int) {
if (_value is int) {
if (((_value as int)) == 0) {
- return error2(node.rightOperand, CompileTimeErrorCode.COMPILE_TIME_CONSTANT_RAISES_EXCEPTION_DIVIDE_BY_ZERO);
+ return valueOf3(((leftValue as int)).toDouble() / ((_value as int)).toDouble());
}
return valueOf(((leftValue as int)) ~/ (_value as int));
} else if (_value is double) {
@@ -791,8 +1098,8 @@
}
EvaluationResultImpl greaterThanError(BinaryExpression node, ErrorResult leftOperand) => leftOperand;
EvaluationResultImpl greaterThanOrEqualError(BinaryExpression node, ErrorResult leftOperand) => leftOperand;
- EvaluationResultImpl greaterThanOrEqualValid(BinaryExpression node, ValidResult leftOperand8) {
- Object leftValue = leftOperand8.value;
+ EvaluationResultImpl greaterThanOrEqualValid(BinaryExpression node, ValidResult leftOperand2) {
+ Object leftValue = leftOperand2.value;
if (leftValue == null) {
return error(node.leftOperand);
} else if (_value == null) {
@@ -812,8 +1119,8 @@
}
return error(node);
}
- EvaluationResultImpl greaterThanValid(BinaryExpression node, ValidResult leftOperand9) {
- Object leftValue = leftOperand9.value;
+ EvaluationResultImpl greaterThanValid(BinaryExpression node, ValidResult leftOperand2) {
+ Object leftValue = leftOperand2.value;
if (leftValue == null) {
return error(node.leftOperand);
} else if (_value == null) {
@@ -834,8 +1141,8 @@
return error(node);
}
EvaluationResultImpl integerDivideError(BinaryExpression node, ErrorResult leftOperand) => leftOperand;
- EvaluationResultImpl integerDivideValid(BinaryExpression node, ValidResult leftOperand10) {
- Object leftValue = leftOperand10.value;
+ EvaluationResultImpl integerDivideValid(BinaryExpression node, ValidResult leftOperand2) {
+ Object leftValue = leftOperand2.value;
if (leftValue == null) {
return error(node.leftOperand);
} else if (_value == null) {
@@ -843,7 +1150,7 @@
} else if (leftValue is int) {
if (_value is int) {
if (((_value as int)) == 0) {
- return error2(node.rightOperand, CompileTimeErrorCode.COMPILE_TIME_CONSTANT_RAISES_EXCEPTION_DIVIDE_BY_ZERO);
+ return valueOf3(((leftValue as int)).toDouble() / ((_value as int)).toDouble());
}
return valueOf(((leftValue as int)) ~/ (_value as int));
} else if (_value is double) {
@@ -863,8 +1170,8 @@
}
EvaluationResultImpl lessThanError(BinaryExpression node, ErrorResult leftOperand) => leftOperand;
EvaluationResultImpl lessThanOrEqualError(BinaryExpression node, ErrorResult leftOperand) => leftOperand;
- EvaluationResultImpl lessThanOrEqualValid(BinaryExpression node, ValidResult leftOperand11) {
- Object leftValue = leftOperand11.value;
+ EvaluationResultImpl lessThanOrEqualValid(BinaryExpression node, ValidResult leftOperand2) {
+ Object leftValue = leftOperand2.value;
if (leftValue == null) {
return error(node.leftOperand);
} else if (_value == null) {
@@ -884,8 +1191,8 @@
}
return error(node);
}
- EvaluationResultImpl lessThanValid(BinaryExpression node, ValidResult leftOperand12) {
- Object leftValue = leftOperand12.value;
+ EvaluationResultImpl lessThanValid(BinaryExpression node, ValidResult leftOperand2) {
+ Object leftValue = leftOperand2.value;
if (leftValue == null) {
return error(node.leftOperand);
} else if (_value == null) {
@@ -922,8 +1229,8 @@
return booleanConversion(node.rightOperand, _value);
}
EvaluationResultImpl minusError(BinaryExpression node, ErrorResult leftOperand) => leftOperand;
- EvaluationResultImpl minusValid(BinaryExpression node, ValidResult leftOperand13) {
- Object leftValue = leftOperand13.value;
+ EvaluationResultImpl minusValid(BinaryExpression node, ValidResult leftOperand2) {
+ Object leftValue = leftOperand2.value;
if (leftValue == null) {
return error(node.leftOperand);
} else if (_value == null) {
@@ -976,17 +1283,17 @@
return RESULT_TRUE;
}
EvaluationResultImpl remainderError(BinaryExpression node, ErrorResult leftOperand) => leftOperand;
- EvaluationResultImpl remainderValid(BinaryExpression node, ValidResult leftOperand14) {
- Object leftValue = leftOperand14.value;
+ EvaluationResultImpl remainderValid(BinaryExpression node, ValidResult leftOperand2) {
+ Object leftValue = leftOperand2.value;
if (leftValue == null) {
return error(node.leftOperand);
} else if (_value == null) {
return error(node.rightOperand);
} else if (leftValue is int) {
- if (((_value as int)) == 0) {
- return error2(node.rightOperand, CompileTimeErrorCode.COMPILE_TIME_CONSTANT_RAISES_EXCEPTION_DIVIDE_BY_ZERO);
- }
if (_value is int) {
+ if (((_value as int)) == 0) {
+ return valueOf3(((leftValue as int)).toDouble() % ((_value as int)).toDouble());
+ }
return valueOf(((leftValue as int)).remainder((_value as int)));
} else if (_value is double) {
return valueOf3(((leftValue as int)).toDouble() % ((_value as double)));
@@ -1001,8 +1308,8 @@
return error(node);
}
EvaluationResultImpl shiftLeftError(BinaryExpression node, ErrorResult leftOperand) => leftOperand;
- EvaluationResultImpl shiftLeftValid(BinaryExpression node, ValidResult leftOperand15) {
- Object leftValue = leftOperand15.value;
+ EvaluationResultImpl shiftLeftValid(BinaryExpression node, ValidResult leftOperand2) {
+ Object leftValue = leftOperand2.value;
if (leftValue == null) {
return error(node.leftOperand);
} else if (_value == null) {
@@ -1019,8 +1326,8 @@
return union(error(node.leftOperand), error(node.rightOperand));
}
EvaluationResultImpl shiftRightError(BinaryExpression node, ErrorResult leftOperand) => leftOperand;
- EvaluationResultImpl shiftRightValid(BinaryExpression node, ValidResult leftOperand16) {
- Object leftValue = leftOperand16.value;
+ EvaluationResultImpl shiftRightValid(BinaryExpression node, ValidResult leftOperand2) {
+ Object leftValue = leftOperand2.value;
if (leftValue == null) {
return error(node.leftOperand);
} else if (_value == null) {
@@ -1037,8 +1344,8 @@
return union(error(node.leftOperand), error(node.rightOperand));
}
EvaluationResultImpl timesError(BinaryExpression node, ErrorResult leftOperand) => leftOperand;
- EvaluationResultImpl timesValid(BinaryExpression node, ValidResult leftOperand17) {
- Object leftValue = leftOperand17.value;
+ EvaluationResultImpl timesValid(BinaryExpression node, ValidResult leftOperand2) {
+ Object leftValue = leftOperand2.value;
if (leftValue == null) {
return error(node.leftOperand);
} else if (_value == null) {
diff --git a/pkg/analyzer_experimental/lib/src/generated/element.dart b/pkg/analyzer_experimental/lib/src/generated/element.dart
index e3e9d02..0dd5369 100644
--- a/pkg/analyzer_experimental/lib/src/generated/element.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/element.dart
@@ -9,6 +9,7 @@
import 'source.dart';
import 'scanner.dart' show Keyword;
import 'ast.dart' show Identifier, LibraryIdentifier;
+import 'sdk.dart' show DartSdk;
import 'html.dart' show XmlTagNode;
import 'engine.dart' show AnalysisContext;
import 'constant.dart' show EvaluationResultImpl;
@@ -204,15 +205,22 @@
*/
List<FunctionElement> get functions;
/**
+ * Return an array containing all of the function type aliases contained in this compilation unit.
+ * @return the function type aliases contained in this compilation unit
+ */
+ List<FunctionTypeAliasElement> get functionTypeAliases;
+ /**
* Return an array containing all of the top-level variables contained in this compilation unit.
* @return the top-level variables contained in this compilation unit
*/
List<TopLevelVariableElement> get topLevelVariables;
/**
- * Return an array containing all of the function type aliases contained in this compilation unit.
- * @return the function type aliases contained in this compilation unit
+ * Return the class defined in this compilation unit that has the given name, or {@code null} if
+ * this compilation unit does not define a class with the given name.
+ * @param className the name of the class to be returned
+ * @return the class with the given name that is defined in this compilation unit
*/
- List<FunctionTypeAliasElement> get functionTypeAliases;
+ ClassElement getType(String className);
/**
* Return an array containing all of the classes contained in this compilation unit.
* @return the classes contained in this compilation unit
@@ -297,8 +305,9 @@
*/
ElementKind get kind;
/**
- * Return the library that contains this element. This will be {@code null} if this element is a
- * library or HTML file because libraries and HTML files are not contained in other libraries.
+ * Return the library that contains this element. This will be the element itself if it is a
+ * library element. This will be {@code null} if this element is an HTML file because HTML files
+ * are not contained in libraries.
* @return the library that contains this element
*/
LibraryElement get library;
@@ -358,7 +367,7 @@
* The enumeration {@code ElementKind} defines the various kinds of elements in the element model.
* @coverage dart.engine.element
*/
-class ElementKind {
+class ElementKind implements Comparable<ElementKind> {
static final ElementKind CLASS = new ElementKind('CLASS', 0, "class");
static final ElementKind COMPILATION_UNIT = new ElementKind('COMPILATION_UNIT', 1, "compilation unit");
static final ElementKind CONSTRUCTOR = new ElementKind('CONSTRUCTOR', 2, "constructor");
@@ -396,6 +405,7 @@
* @return the name of this {@link ElementKind} to display in UI.
*/
String get displayName => _displayName;
+ int compareTo(ElementKind other) => __ordinal - other.__ordinal;
String toString() => __name;
}
/**
@@ -424,7 +434,9 @@
R visitExportElement(ExportElement element);
R visitExternalHtmlScriptElement(ExternalHtmlScriptElement element);
R visitFieldElement(FieldElement element);
+ R visitFieldFormalParameterElement(FieldFormalParameterElement element);
R visitFunctionElement(FunctionElement element);
+ R visitFunctionTypeAliasElement(FunctionTypeAliasElement element);
R visitHtmlElement(HtmlElement element);
R visitImportElement(ImportElement element);
R visitLabelElement(LabelElement element);
@@ -436,7 +448,6 @@
R visitPrefixElement(PrefixElement element);
R visitPropertyAccessorElement(PropertyAccessorElement element);
R visitTopLevelVariableElement(TopLevelVariableElement element);
- R visitFunctionTypeAliasElement(FunctionTypeAliasElement element);
R visitTypeVariableElement(TypeVariableElement element);
}
/**
@@ -545,6 +556,18 @@
ClassElement get enclosingElement;
}
/**
+ * The interface {@code FieldFormalParameterElement} defines the behavior of elements representing a
+ * field formal parameter defined within a constructor element.
+ */
+abstract class FieldFormalParameterElement implements ParameterElement {
+ /**
+ * Return the field element associated with this field formal parameter, or {@code null} if the
+ * parameter references a field that doesn't exist.
+ * @return the field element associated with this field formal parameter
+ */
+ FieldElement get field;
+}
+/**
* The interface {@code FunctionElement} defines the behavior of elements representing a function.
* @coverage dart.engine.element
*/
@@ -703,6 +726,13 @@
*/
List<PrefixElement> get prefixes;
/**
+ * Return the class defined in this library that has the given name, or {@code null} if this
+ * library does not define a class with the given name.
+ * @param className the name of the class to be returned
+ * @return the class with the given name that is defined in this library
+ */
+ ClassElement getType(String className);
+ /**
* Answer {@code true} if this library is an application that can be run in the browser.
* @return {@code true} if this library is an application that can be run in the browser
*/
@@ -808,6 +838,12 @@
*/
ParameterKind get parameterKind;
/**
+ * Return an array containing all of the parameters defined by this parameter. A parameter will
+ * only define other parameters if it is a function typed parameter.
+ * @return the parameters defined by this parameter element
+ */
+ List<ParameterElement> get parameters;
+ /**
* Return {@code true} if this parameter is an initializing formal parameter.
* @return {@code true} if this parameter is an initializing formal parameter
*/
@@ -1022,6 +1058,7 @@
* LocalElement
* LocalVariableElement
* ParameterElement
+ * FieldFormalParameterElement
* </pre>
* <p>
* Subclasses that override a visit method must either invoke the overridden visit method or
@@ -1043,7 +1080,9 @@
R visitExportElement(ExportElement element) => visitElement(element);
R visitExternalHtmlScriptElement(ExternalHtmlScriptElement element) => visitHtmlScriptElement(element);
R visitFieldElement(FieldElement element) => visitPropertyInducingElement(element);
+ R visitFieldFormalParameterElement(FieldFormalParameterElement element) => visitParameterElement(element);
R visitFunctionElement(FunctionElement element) => visitLocalElement(element);
+ R visitFunctionTypeAliasElement(FunctionTypeAliasElement element) => visitElement(element);
R visitHtmlElement(HtmlElement element) => visitElement(element);
R visitHtmlScriptElement(HtmlScriptElement element) => visitElement(element);
R visitImportElement(ImportElement element) => visitElement(element);
@@ -1067,7 +1106,6 @@
R visitPropertyAccessorElement(PropertyAccessorElement element) => visitExecutableElement(element);
R visitPropertyInducingElement(PropertyInducingElement element) => visitVariableElement(element);
R visitTopLevelVariableElement(TopLevelVariableElement element) => visitPropertyInducingElement(element);
- R visitFunctionTypeAliasElement(FunctionTypeAliasElement element) => visitElement(element);
R visitTypeVariableElement(TypeVariableElement element) => visitElement(element);
R visitVariableElement(VariableElement element) => visitElement(element);
}
@@ -1111,10 +1149,18 @@
element.visitChildren(this);
return null;
}
+ R visitFieldFormalParameterElement(FieldFormalParameterElement element) {
+ element.visitChildren(this);
+ return null;
+ }
R visitFunctionElement(FunctionElement element) {
element.visitChildren(this);
return null;
}
+ R visitFunctionTypeAliasElement(FunctionTypeAliasElement element) {
+ element.visitChildren(this);
+ return null;
+ }
R visitHtmlElement(HtmlElement element) {
element.visitChildren(this);
return null;
@@ -1159,10 +1205,6 @@
element.visitChildren(this);
return null;
}
- R visitFunctionTypeAliasElement(FunctionTypeAliasElement element) {
- element.visitChildren(this);
- return null;
- }
R visitTypeVariableElement(TypeVariableElement element) {
element.visitChildren(this);
return null;
@@ -1183,7 +1225,9 @@
R visitExportElement(ExportElement element) => null;
R visitExternalHtmlScriptElement(ExternalHtmlScriptElement element) => null;
R visitFieldElement(FieldElement element) => null;
+ R visitFieldFormalParameterElement(FieldFormalParameterElement element) => null;
R visitFunctionElement(FunctionElement element) => null;
+ R visitFunctionTypeAliasElement(FunctionTypeAliasElement element) => null;
R visitHtmlElement(HtmlElement element) => null;
R visitImportElement(ImportElement element) => null;
R visitLabelElement(LabelElement element) => null;
@@ -1195,7 +1239,6 @@
R visitPrefixElement(PrefixElement element) => null;
R visitPropertyAccessorElement(PropertyAccessorElement element) => null;
R visitTopLevelVariableElement(TopLevelVariableElement element) => null;
- R visitFunctionTypeAliasElement(FunctionTypeAliasElement element) => null;
R visitTypeVariableElement(TypeVariableElement element) => null;
}
/**
@@ -1277,60 +1320,116 @@
accept(ElementVisitor visitor) => visitor.visitClassElement(this);
List<PropertyAccessorElement> get accessors => _accessors;
List<InterfaceType> get allSupertypes {
- Set<InterfaceType> set = new Set<InterfaceType>();
- collectAllSupertypes(set);
- return set.toList();
+ Set<InterfaceType> list = new Set<InterfaceType>();
+ collectAllSupertypes(list);
+ return new List.from(list);
}
- ElementImpl getChild(String identifier25) {
+ ElementImpl getChild(String identifier2) {
for (PropertyAccessorElement accessor in _accessors) {
- if (((accessor as PropertyAccessorElementImpl)).identifier == identifier25) {
+ if (((accessor as PropertyAccessorElementImpl)).identifier == identifier2) {
return accessor as PropertyAccessorElementImpl;
}
}
for (ConstructorElement constructor in _constructors) {
- if (((constructor as ConstructorElementImpl)).identifier == identifier25) {
+ if (((constructor as ConstructorElementImpl)).identifier == identifier2) {
return constructor as ConstructorElementImpl;
}
}
for (FieldElement field in _fields) {
- if (((field as FieldElementImpl)).identifier == identifier25) {
+ if (((field as FieldElementImpl)).identifier == identifier2) {
return field as FieldElementImpl;
}
}
for (MethodElement method in _methods) {
- if (((method as MethodElementImpl)).identifier == identifier25) {
+ if (((method as MethodElementImpl)).identifier == identifier2) {
return method as MethodElementImpl;
}
}
for (TypeVariableElement typeVariable in _typeVariables) {
- if (((typeVariable as TypeVariableElementImpl)).identifier == identifier25) {
+ if (((typeVariable as TypeVariableElementImpl)).identifier == identifier2) {
return typeVariable as TypeVariableElementImpl;
}
}
return null;
}
List<ConstructorElement> get constructors => _constructors;
+ /**
+ * Given some name, this returns the {@link FieldElement} with the matching name, if there is no
+ * such field, then {@code null} is returned.
+ * @param name some name to lookup a field element with
+ * @return the matching field element, or {@code null} if no such element was found
+ */
+ FieldElement getField(String name2) {
+ for (FieldElement fieldElement in _fields) {
+ if (name2 == fieldElement.name) {
+ return fieldElement;
+ }
+ }
+ return null;
+ }
List<FieldElement> get fields => _fields;
+ /**
+ * Return the element representing the getter with the given name that is declared in this class,
+ * or {@code null} if this class does not declare a getter with the given name.
+ * @param getterName the name of the getter to be returned
+ * @return the getter declared in this class with the given name
+ */
+ PropertyAccessorElement getGetter(String getterName) {
+ for (PropertyAccessorElement accessor in _accessors) {
+ if (accessor.isGetter() && accessor.name == getterName) {
+ return accessor;
+ }
+ }
+ return null;
+ }
List<InterfaceType> get interfaces => _interfaces;
ElementKind get kind => ElementKind.CLASS;
+ /**
+ * Return the element representing the method with the given name that is declared in this class,
+ * or {@code null} if this class does not declare a method with the given name.
+ * @param methodName the name of the method to be returned
+ * @return the method declared in this class with the given name
+ */
+ MethodElement getMethod(String methodName) {
+ for (MethodElement method in _methods) {
+ if (method.name == methodName) {
+ return method;
+ }
+ }
+ return null;
+ }
List<MethodElement> get methods => _methods;
List<InterfaceType> get mixins => _mixins;
- ConstructorElement getNamedConstructor(String name24) {
+ ConstructorElement getNamedConstructor(String name2) {
for (ConstructorElement element in constructors) {
String elementName = element.name;
- if (elementName != null && elementName == name24) {
+ if (elementName != null && elementName == name2) {
return element;
}
}
return null;
}
+ /**
+ * Return the element representing the setter with the given name that is declared in this class,
+ * or {@code null} if this class does not declare a setter with the given name.
+ * @param setterName the name of the getter to be returned
+ * @return the setter declared in this class with the given name
+ */
+ PropertyAccessorElement getSetter(String setterName) {
+ for (PropertyAccessorElement accessor in _accessors) {
+ if (accessor.isSetter() && accessor.name == setterName) {
+ return accessor;
+ }
+ }
+ return null;
+ }
InterfaceType get supertype => _supertype;
InterfaceType get type => _type;
List<TypeVariableElement> get typeVariables => _typeVariables;
ConstructorElement get unnamedConstructor {
for (ConstructorElement element in constructors) {
- String name10 = element.name;
- if (name10 == null || name10.isEmpty) {
+ String name2 = element.name;
+ if (name2 == null || name2.isEmpty) {
return element;
}
}
@@ -1487,8 +1586,8 @@
* Set the type defined by the class to the given type.
* @param type the type defined by the class
*/
- void set type(InterfaceType type5) {
- this._type = type5;
+ void set type(InterfaceType type2) {
+ this._type = type2;
}
/**
* Set whether this class is defined by a typedef construct to correspond to the given value.
@@ -1523,11 +1622,11 @@
safelyVisitChildren(_typeVariables, visitor);
}
void appendTo(JavaStringBuilder builder) {
- String name11 = name;
- if (name11 == null) {
+ String name2 = name;
+ if (name2 == null) {
builder.append("{unnamed class}");
} else {
- builder.append(name11);
+ builder.append(name2);
}
int variableCount = _typeVariables.length;
if (variableCount > 0) {
@@ -1541,66 +1640,24 @@
builder.append(">");
}
}
- void collectAllSupertypes(var list) {
+ void collectAllSupertypes(Set<InterfaceType> list) {
if (_supertype == null || list.contains(_supertype)) {
return;
}
- list.add(_supertype);
+ javaSetAdd(list, _supertype);
((_supertype.element as ClassElementImpl)).collectAllSupertypes(list);
for (InterfaceType type in interfaces) {
if (!list.contains(type)) {
- list.add(type);
+ javaSetAdd(list, type);
((type.element as ClassElementImpl)).collectAllSupertypes(list);
}
}
for (InterfaceType type in mixins) {
if (!list.contains(type)) {
- list.add(type);
+ javaSetAdd(list, type);
}
}
}
- /**
- * Return the element representing the getter with the given name that is declared in this class,
- * or {@code null} if this class does not declare a getter with the given name.
- * @param getterName the name of the getter to be returned
- * @return the getter declared in this class with the given name
- */
- PropertyAccessorElement getGetter(String getterName) {
- for (PropertyAccessorElement accessor in _accessors) {
- if (accessor.isGetter() && accessor.name == getterName) {
- return accessor;
- }
- }
- return null;
- }
- /**
- * Return the element representing the method with the given name that is declared in this class,
- * or {@code null} if this class does not declare a method with the given name.
- * @param methodName the name of the method to be returned
- * @return the method declared in this class with the given name
- */
- MethodElement getMethod(String methodName) {
- for (MethodElement method in _methods) {
- if (method.name == methodName) {
- return method;
- }
- }
- return null;
- }
- /**
- * Return the element representing the setter with the given name that is declared in this class,
- * or {@code null} if this class does not declare a setter with the given name.
- * @param setterName the name of the getter to be returned
- * @return the getter declared in this class with the given name
- */
- PropertyAccessorElement getSetter(String setterName) {
- for (PropertyAccessorElement accessor in _accessors) {
- if (accessor.isSetter() && accessor.name == setterName) {
- return accessor;
- }
- }
- return null;
- }
}
/**
* Instances of the class {@code CompilationUnitElementImpl} implement a{@link CompilationUnitElement}.
@@ -1643,31 +1700,31 @@
CompilationUnitElementImpl(String name) : super.con2(name, -1) {
}
accept(ElementVisitor visitor) => visitor.visitCompilationUnitElement(this);
- bool operator ==(Object object) => object != null && identical(runtimeType, object.runtimeType) && _source == ((object as CompilationUnitElementImpl)).source;
+ bool operator ==(Object object) => object != null && runtimeType == object.runtimeType && _source == ((object as CompilationUnitElementImpl)).source;
List<PropertyAccessorElement> get accessors => _accessors;
- ElementImpl getChild(String identifier26) {
+ ElementImpl getChild(String identifier2) {
for (PropertyAccessorElement accessor in _accessors) {
- if (((accessor as PropertyAccessorElementImpl)).identifier == identifier26) {
+ if (((accessor as PropertyAccessorElementImpl)).identifier == identifier2) {
return accessor as PropertyAccessorElementImpl;
}
}
for (VariableElement variable in _variables) {
- if (((variable as VariableElementImpl)).identifier == identifier26) {
+ if (((variable as VariableElementImpl)).identifier == identifier2) {
return variable as VariableElementImpl;
}
}
for (ExecutableElement function in _functions) {
- if (((function as ExecutableElementImpl)).identifier == identifier26) {
+ if (((function as ExecutableElementImpl)).identifier == identifier2) {
return function as ExecutableElementImpl;
}
}
for (FunctionTypeAliasElement typeAlias in _typeAliases) {
- if (((typeAlias as FunctionTypeAliasElementImpl)).identifier == identifier26) {
+ if (((typeAlias as FunctionTypeAliasElementImpl)).identifier == identifier2) {
return typeAlias as FunctionTypeAliasElementImpl;
}
}
for (ClassElement type in _types) {
- if (((type as ClassElementImpl)).identifier == identifier26) {
+ if (((type as ClassElementImpl)).identifier == identifier2) {
return type as ClassElementImpl;
}
}
@@ -1680,6 +1737,14 @@
ElementKind get kind => ElementKind.COMPILATION_UNIT;
Source get source => _source;
List<TopLevelVariableElement> get topLevelVariables => _variables;
+ ClassElement getType(String className) {
+ for (ClassElement type in _types) {
+ if (type.name == className) {
+ return type;
+ }
+ }
+ return null;
+ }
List<ClassElement> get types => _types;
int get hashCode => _source.hashCode;
/**
@@ -1687,11 +1752,11 @@
* given accessors.
* @param the top-level accessors (getters and setters) contained in this compilation unit
*/
- void set accessors(List<PropertyAccessorElement> accessors3) {
- for (PropertyAccessorElement accessor in accessors3) {
+ void set accessors(List<PropertyAccessorElement> accessors2) {
+ for (PropertyAccessorElement accessor in accessors2) {
((accessor as PropertyAccessorElementImpl)).enclosingElement = this;
}
- this._accessors = accessors3;
+ this._accessors = accessors2;
}
/**
* Set the top-level functions contained in this compilation unit to the given functions.
@@ -1707,8 +1772,8 @@
* Set the source that corresponds to this compilation unit to the given source.
* @param source the source that corresponds to this compilation unit
*/
- void set source(Source source5) {
- this._source = source5;
+ void set source(Source source2) {
+ this._source = source2;
}
/**
* Set the top-level variables contained in this compilation unit to the given variables.
@@ -1792,8 +1857,8 @@
ConstLocalVariableElementImpl(Identifier name) : super(name) {
}
EvaluationResultImpl get evaluationResult => _result;
- void set evaluationResult(EvaluationResultImpl result3) {
- this._result = result3;
+ void set evaluationResult(EvaluationResultImpl result2) {
+ this._result = result2;
}
}
/**
@@ -1813,8 +1878,8 @@
ConstParameterElementImpl(Identifier name) : super(name) {
}
EvaluationResultImpl get evaluationResult => _result;
- void set evaluationResult(EvaluationResultImpl result4) {
- this._result = result4;
+ void set evaluationResult(EvaluationResultImpl result2) {
+ this._result = result2;
}
}
/**
@@ -1832,8 +1897,8 @@
ConstTopLevelVariableElementImpl(Identifier name) : super.con1(name) {
}
EvaluationResultImpl get evaluationResult => _result;
- void set evaluationResult(EvaluationResultImpl result5) {
- this._result = result5;
+ void set evaluationResult(EvaluationResultImpl result2) {
+ this._result = result2;
}
}
/**
@@ -1873,10 +1938,10 @@
}
void appendTo(JavaStringBuilder builder) {
builder.append(enclosingElement.name);
- String name12 = name;
- if (name12 != null && !name12.isEmpty) {
+ String name2 = name;
+ if (name2 != null && !name2.isEmpty) {
builder.append(".");
- builder.append(name12);
+ builder.append(name2);
}
super.appendTo(builder);
}
@@ -1915,8 +1980,8 @@
* Set the type defined by this element to the given type.
* @param type the type defined by this element
*/
- void set type(DynamicTypeImpl type6) {
- this._type = type6;
+ void set type(DynamicTypeImpl type2) {
+ this._type = type2;
}
}
/**
@@ -1948,14 +2013,18 @@
*/
List<Annotation> _metadata = AnnotationImpl.EMPTY_ARRAY;
/**
+ * A cached copy of the calculated hashCode for this element.
+ */
+ int _cachedHashCode = 0;
+ /**
* Initialize a newly created element to have the given name.
* @param name the name of this element
*/
- ElementImpl.con1(Identifier name25) {
- _jtd_constructor_178_impl(name25);
+ ElementImpl.con1(Identifier name2) {
+ _jtd_constructor_188_impl(name2);
}
- _jtd_constructor_178_impl(Identifier name25) {
- _jtd_constructor_179_impl(name25 == null ? "" : name25.name, name25 == null ? -1 : name25.offset);
+ _jtd_constructor_188_impl(Identifier name2) {
+ _jtd_constructor_189_impl(name2 == null ? "" : name2.name, name2 == null ? -1 : name2.offset);
}
/**
* Initialize a newly created element to have the given name.
@@ -1963,15 +2032,14 @@
* @param nameOffset the offset of the name of this element in the file that contains the
* declaration of this element
*/
- ElementImpl.con2(String name8, int nameOffset2) {
- _jtd_constructor_179_impl(name8, nameOffset2);
+ ElementImpl.con2(String name2, int nameOffset2) {
+ _jtd_constructor_189_impl(name2, nameOffset2);
}
- _jtd_constructor_179_impl(String name8, int nameOffset2) {
- this._name = name8;
+ _jtd_constructor_189_impl(String name2, int nameOffset2) {
+ this._name = StringUtilities.intern(name2);
this._nameOffset = nameOffset2;
- this._modifiers = new Set();
}
- bool operator ==(Object object) => object != null && identical(object.runtimeType, runtimeType) && ((object as Element)).location == location;
+ bool operator ==(Object object) => object != null && object.runtimeType == runtimeType && ((object as Element)).location == location;
Element getAncestor(Type elementClass) {
Element ancestor = _enclosingElement;
while (ancestor != null && !isInstanceOf(ancestor, elementClass)) {
@@ -2003,10 +2071,15 @@
}
return _enclosingElement.source;
}
- int get hashCode => location.hashCode;
- bool isAccessibleIn(LibraryElement library21) {
+ int get hashCode {
+ if (_cachedHashCode == 0) {
+ _cachedHashCode = location.hashCode;
+ }
+ return _cachedHashCode;
+ }
+ bool isAccessibleIn(LibraryElement library2) {
if (Identifier.isPrivateName(_name)) {
- return library21 == library;
+ return library2 == library;
}
return true;
}
@@ -2015,8 +2088,8 @@
* Set the metadata associate with this element to the given array of annotations.
* @param metadata the metadata to be associated with this element
*/
- void set metadata(List<Annotation> metadata3) {
- this._metadata = metadata3;
+ void set metadata(List<Annotation> metadata2) {
+ this._metadata = metadata2;
}
/**
* Set the offset of the name of this element in the file that contains the declaration of this
@@ -2024,8 +2097,8 @@
* provided to support unnamed constructors.
* @param nameOffset the offset to the beginning of the name
*/
- void set nameOffset(int nameOffset3) {
- this._nameOffset = nameOffset3;
+ void set nameOffset(int nameOffset2) {
+ this._nameOffset = nameOffset2;
}
/**
* Set whether this element is synthetic to correspond to the given value.
@@ -2065,7 +2138,7 @@
* @param modifier the modifier being tested for
* @return {@code true} if this element has the given modifier associated with it
*/
- bool hasModifier(Modifier modifier) => _modifiers.contains(modifier);
+ bool hasModifier(Modifier modifier) => _modifiers != null && _modifiers.contains(modifier);
/**
* If the given child is not {@code null}, use the given visitor to visit it.
* @param child the child to be visited
@@ -2103,9 +2176,17 @@
*/
void setModifier(Modifier modifier, bool value) {
if (value) {
+ if (_modifiers == null) {
+ _modifiers = new Set();
+ }
_modifiers.add(modifier);
} else {
- _modifiers.remove(modifier);
+ if (_modifiers != null) {
+ _modifiers.remove(modifier);
+ if (_modifiers.isEmpty) {
+ _modifiers = null;
+ }
+ }
}
}
}
@@ -2127,9 +2208,9 @@
* @param element the element whose location is being represented
*/
ElementLocationImpl.con1(Element element) {
- _jtd_constructor_180_impl(element);
+ _jtd_constructor_190_impl(element);
}
- _jtd_constructor_180_impl(Element element) {
+ _jtd_constructor_190_impl(Element element) {
List<String> components = new List<String>();
Element ancestor = element;
while (ancestor != null) {
@@ -2143,9 +2224,9 @@
* @param encoding the encoded form of a location
*/
ElementLocationImpl.con2(String encoding) {
- _jtd_constructor_181_impl(encoding);
+ _jtd_constructor_191_impl(encoding);
}
- _jtd_constructor_181_impl(String encoding) {
+ _jtd_constructor_191_impl(String encoding) {
this._components = decode(encoding);
}
bool operator ==(Object object) {
@@ -2182,11 +2263,11 @@
List<String> components = new List<String>();
JavaStringBuilder builder = new JavaStringBuilder();
int index = 0;
- int length3 = encoding.length;
- while (index < length3) {
+ int length2 = encoding.length;
+ while (index < length2) {
int currentChar = encoding.codeUnitAt(index);
if (currentChar == _SEPARATOR_CHAR) {
- if (index + 1 < length3 && encoding.codeUnitAt(index + 1) == _SEPARATOR_CHAR) {
+ if (index + 1 < length2 && encoding.codeUnitAt(index + 1) == _SEPARATOR_CHAR) {
builder.appendChar(_SEPARATOR_CHAR);
index += 2;
} else {
@@ -2210,8 +2291,8 @@
* @param component the component to be appended to the builder
*/
void encode(JavaStringBuilder builder, String component) {
- int length4 = component.length;
- for (int i = 0; i < length4; i++) {
+ int length2 = component.length;
+ for (int i = 0; i < length2; i++) {
int currentChar = component.codeUnitAt(i);
if (currentChar == _SEPARATOR_CHAR) {
builder.appendChar(_SEPARATOR_CHAR);
@@ -2284,9 +2365,9 @@
* @param name the name of this element
*/
ExecutableElementImpl.con1(Identifier name) : super.con1(name) {
- _jtd_constructor_183_impl(name);
+ _jtd_constructor_193_impl(name);
}
- _jtd_constructor_183_impl(Identifier name) {
+ _jtd_constructor_193_impl(Identifier name) {
}
/**
* Initialize a newly created executable element to have the given name.
@@ -2295,28 +2376,28 @@
* declaration of this element
*/
ExecutableElementImpl.con2(String name, int nameOffset) : super.con2(name, nameOffset) {
- _jtd_constructor_184_impl(name, nameOffset);
+ _jtd_constructor_194_impl(name, nameOffset);
}
- _jtd_constructor_184_impl(String name, int nameOffset) {
+ _jtd_constructor_194_impl(String name, int nameOffset) {
}
- ElementImpl getChild(String identifier27) {
+ ElementImpl getChild(String identifier2) {
for (ExecutableElement function in _functions) {
- if (((function as ExecutableElementImpl)).identifier == identifier27) {
+ if (((function as ExecutableElementImpl)).identifier == identifier2) {
return function as ExecutableElementImpl;
}
}
for (LabelElement label in _labels) {
- if (((label as LabelElementImpl)).identifier == identifier27) {
+ if (((label as LabelElementImpl)).identifier == identifier2) {
return label as LabelElementImpl;
}
}
for (VariableElement variable in _localVariables) {
- if (((variable as VariableElementImpl)).identifier == identifier27) {
+ if (((variable as VariableElementImpl)).identifier == identifier2) {
return variable as VariableElementImpl;
}
}
for (ParameterElement parameter in _parameters) {
- if (((parameter as ParameterElementImpl)).identifier == identifier27) {
+ if (((parameter as ParameterElementImpl)).identifier == identifier2) {
return parameter as ParameterElementImpl;
}
}
@@ -2332,11 +2413,11 @@
* Set the functions defined within this executable element to the given functions.
* @param functions the functions defined within this executable element
*/
- void set functions(List<FunctionElement> functions3) {
- for (FunctionElement function in functions3) {
+ void set functions(List<FunctionElement> functions2) {
+ for (FunctionElement function in functions2) {
((function as FunctionElementImpl)).enclosingElement = this;
}
- this._functions = functions3;
+ this._functions = functions2;
}
/**
* Set the labels defined within this executable element to the given labels.
@@ -2362,18 +2443,18 @@
* Set the parameters defined by this executable element to the given parameters.
* @param parameters the parameters defined by this executable element
*/
- void set parameters(List<ParameterElement> parameters7) {
- for (ParameterElement parameter in parameters7) {
+ void set parameters(List<ParameterElement> parameters2) {
+ for (ParameterElement parameter in parameters2) {
((parameter as ParameterElementImpl)).enclosingElement = this;
}
- this._parameters = parameters7;
+ this._parameters = parameters2;
}
/**
* Set the type of function defined by this executable element to the given type.
* @param type the type of function defined by this executable element
*/
- void set type(FunctionType type7) {
- this._type = type7;
+ void set type(FunctionType type2) {
+ this._type = type2;
}
void visitChildren(ElementVisitor<Object> visitor) {
super.visitChildren(visitor);
@@ -2482,18 +2563,18 @@
* @param name the name of this element
*/
FieldElementImpl.con1(Identifier name) : super.con1(name) {
- _jtd_constructor_187_impl(name);
+ _jtd_constructor_197_impl(name);
}
- _jtd_constructor_187_impl(Identifier name) {
+ _jtd_constructor_197_impl(Identifier name) {
}
/**
* Initialize a newly created synthetic field element to have the given name.
* @param name the name of this element
*/
FieldElementImpl.con2(String name) : super.con2(name) {
- _jtd_constructor_188_impl(name);
+ _jtd_constructor_198_impl(name);
}
- _jtd_constructor_188_impl(String name) {
+ _jtd_constructor_198_impl(String name) {
}
accept(ElementVisitor visitor) => visitor.visitFieldElement(this);
ClassElement get enclosingElement => super.enclosingElement as ClassElement;
@@ -2508,6 +2589,31 @@
}
}
/**
+ * Instances of the class {@code FieldFormalParameterElementImpl} extend{@link ParameterElementImpl} to provide the additional information of the {@link FieldElement}associated with the parameter.
+ * @coverage dart.engine.element
+ */
+class FieldFormalParameterElementImpl extends ParameterElementImpl implements FieldFormalParameterElement {
+ /**
+ * The field associated with this field formal parameter.
+ */
+ FieldElement _field;
+ /**
+ * Initialize a newly created parameter element to have the given name.
+ * @param name the name of this element
+ */
+ FieldFormalParameterElementImpl(Identifier name) : super(name) {
+ }
+ accept(ElementVisitor visitor) => visitor.visitFieldFormalParameterElement(this);
+ FieldElement get field => _field;
+ /**
+ * Set the field element associated with this field formal parameter to the given element.
+ * @param field the new field element
+ */
+ void set field(FieldElement field2) {
+ this._field = field2;
+ }
+}
+/**
* Instances of the class {@code FunctionElementImpl} implement a {@code FunctionElement}.
* @coverage dart.engine.element
*/
@@ -2529,9 +2635,9 @@
* Initialize a newly created synthetic function element.
*/
FunctionElementImpl() : super.con2("", -1) {
- _jtd_constructor_189_impl();
+ _jtd_constructor_200_impl();
}
- _jtd_constructor_189_impl() {
+ _jtd_constructor_200_impl() {
synthetic = true;
}
/**
@@ -2539,9 +2645,20 @@
* @param name the name of this element
*/
FunctionElementImpl.con1(Identifier name) : super.con1(name) {
- _jtd_constructor_190_impl(name);
+ _jtd_constructor_201_impl(name);
}
- _jtd_constructor_190_impl(Identifier name) {
+ _jtd_constructor_201_impl(Identifier name) {
+ }
+ /**
+ * Initialize a newly created function element to have no name and the given offset. This is used
+ * for function expressions, which have no name.
+ * @param nameOffset the offset of the name of this element in the file that contains the
+ * declaration of this element
+ */
+ FunctionElementImpl.con2(int nameOffset) : super.con2("", nameOffset) {
+ _jtd_constructor_202_impl(nameOffset);
+ }
+ _jtd_constructor_202_impl(int nameOffset) {
}
accept(ElementVisitor visitor) => visitor.visitFunctionElement(this);
String get identifier => name;
@@ -2565,9 +2682,9 @@
_visibleRangeLength = length;
}
void appendTo(JavaStringBuilder builder) {
- String name13 = name;
- if (name13 != null) {
- builder.append(name13);
+ String name2 = name;
+ if (name2 != null) {
+ builder.append(name2);
}
super.appendTo(builder);
}
@@ -2600,14 +2717,14 @@
FunctionTypeAliasElementImpl(Identifier name) : super.con1(name) {
}
accept(ElementVisitor visitor) => visitor.visitFunctionTypeAliasElement(this);
- ElementImpl getChild(String identifier28) {
+ ElementImpl getChild(String identifier2) {
for (VariableElement parameter in _parameters) {
- if (((parameter as VariableElementImpl)).identifier == identifier28) {
+ if (((parameter as VariableElementImpl)).identifier == identifier2) {
return parameter as VariableElementImpl;
}
}
for (TypeVariableElement typeVariable in _typeVariables) {
- if (((typeVariable as TypeVariableElementImpl)).identifier == identifier28) {
+ if (((typeVariable as TypeVariableElementImpl)).identifier == identifier2) {
return typeVariable as TypeVariableElementImpl;
}
}
@@ -2622,30 +2739,30 @@
* Set the parameters defined by this type alias to the given parameters.
* @param parameters the parameters defined by this type alias
*/
- void set parameters(List<ParameterElement> parameters8) {
- if (parameters8 != null) {
- for (ParameterElement parameter in parameters8) {
+ void set parameters(List<ParameterElement> parameters2) {
+ if (parameters2 != null) {
+ for (ParameterElement parameter in parameters2) {
((parameter as ParameterElementImpl)).enclosingElement = this;
}
}
- this._parameters = parameters8;
+ this._parameters = parameters2;
}
/**
* Set the type of function defined by this type alias to the given type.
* @param type the type of function defined by this type alias
*/
- void set type(FunctionType type8) {
- this._type = type8;
+ void set type(FunctionType type2) {
+ this._type = type2;
}
/**
* Set the type variables defined for this type to the given variables.
* @param typeVariables the type variables defined for this type
*/
- void set typeVariables(List<TypeVariableElement> typeVariables3) {
- for (TypeVariableElement variable in typeVariables3) {
+ void set typeVariables(List<TypeVariableElement> typeVariables2) {
+ for (TypeVariableElement variable in typeVariables2) {
((variable as TypeVariableElementImpl)).enclosingElement = this;
}
- this._typeVariables = typeVariables3;
+ this._typeVariables = typeVariables2;
}
void visitChildren(ElementVisitor<Object> visitor) {
super.visitChildren(visitor);
@@ -2748,7 +2865,7 @@
this._context = context;
}
accept(ElementVisitor visitor) => visitor.visitHtmlElement(this);
- bool operator ==(Object object) => identical(runtimeType, object.runtimeType) && _source == ((object as CompilationUnitElementImpl)).source;
+ bool operator ==(Object object) => runtimeType == object.runtimeType && _source == ((object as CompilationUnitElementImpl)).source;
AnalysisContext get context => _context;
ElementKind get kind => ElementKind.HTML;
List<HtmlScriptElement> get scripts => _scripts;
@@ -2759,6 +2876,9 @@
* @param scripts the scripts
*/
void set scripts(List<HtmlScriptElement> scripts2) {
+ if (scripts2.length == 0) {
+ scripts2 = HtmlScriptElementImpl.EMPTY_ARRAY;
+ }
for (HtmlScriptElement script in scripts2) {
((script as HtmlScriptElementImpl)).enclosingElement = this;
}
@@ -2768,8 +2888,8 @@
* Set the source that corresponds to this HTML file to the given source.
* @param source the source that corresponds to this HTML file
*/
- void set source(Source source6) {
- this._source = source6;
+ void set source(Source source2) {
+ this._source = source2;
}
void visitChildren(ElementVisitor<Object> visitor) {
super.visitChildren(visitor);
@@ -2833,23 +2953,23 @@
* combinators.
* @param combinators the combinators that were specified as part of the import directive
*/
- void set combinators(List<NamespaceCombinator> combinators3) {
- this._combinators = combinators3;
+ void set combinators(List<NamespaceCombinator> combinators2) {
+ this._combinators = combinators2;
}
/**
* Set the library that is imported into this library by this import directive to the given
* library.
* @param importedLibrary the library that is imported into this library
*/
- void set importedLibrary(LibraryElement importedLibrary3) {
- this._importedLibrary = importedLibrary3;
+ void set importedLibrary(LibraryElement importedLibrary2) {
+ this._importedLibrary = importedLibrary2;
}
/**
* Set the prefix that was specified as part of the import directive to the given prefix.
* @param prefix the prefix that was specified as part of the import directive
*/
- void set prefix(PrefixElement prefix3) {
- this._prefix = prefix3;
+ void set prefix(PrefixElement prefix2) {
+ this._prefix = prefix2;
}
void visitChildren(ElementVisitor<Object> visitor) {
super.visitChildren(visitor);
@@ -2973,13 +3093,13 @@
this._context = context;
}
accept(ElementVisitor visitor) => visitor.visitLibraryElement(this);
- bool operator ==(Object object) => object != null && identical(runtimeType, object.runtimeType) && _definingCompilationUnit == ((object as LibraryElementImpl)).definingCompilationUnit;
- ElementImpl getChild(String identifier29) {
- if (((_definingCompilationUnit as CompilationUnitElementImpl)).identifier == identifier29) {
+ bool operator ==(Object object) => object != null && runtimeType == object.runtimeType && _definingCompilationUnit == ((object as LibraryElementImpl)).definingCompilationUnit;
+ ElementImpl getChild(String identifier2) {
+ if (((_definingCompilationUnit as CompilationUnitElementImpl)).identifier == identifier2) {
return _definingCompilationUnit as CompilationUnitElementImpl;
}
for (CompilationUnitElement part in _parts) {
- if (((part as CompilationUnitElementImpl)).identifier == identifier29) {
+ if (((part as CompilationUnitElementImpl)).identifier == identifier2) {
return part as CompilationUnitElementImpl;
}
}
@@ -3012,13 +3132,14 @@
}
List<ImportElement> get imports => _imports;
ElementKind get kind => ElementKind.LIBRARY;
+ LibraryElement get library => this;
List<CompilationUnitElement> get parts => _parts;
List<PrefixElement> get prefixes {
Set<PrefixElement> prefixes = new Set<PrefixElement>();
for (ImportElement element in _imports) {
- PrefixElement prefix4 = element.prefix;
- if (prefix4 != null) {
- javaSetAdd(prefixes, prefix4);
+ PrefixElement prefix2 = element.prefix;
+ if (prefix2 != null) {
+ javaSetAdd(prefixes, prefix2);
}
}
return new List.from(prefixes);
@@ -3029,6 +3150,19 @@
}
return _definingCompilationUnit.source;
}
+ ClassElement getType(String className) {
+ ClassElement type = _definingCompilationUnit.getType(className);
+ if (type != null) {
+ return type;
+ }
+ for (CompilationUnitElement part in _parts) {
+ type = part.getType(className);
+ if (type != null) {
+ return type;
+ }
+ }
+ return null;
+ }
int get hashCode => _definingCompilationUnit.hashCode;
bool isBrowserApplication() => _entryPoint != null && isOrImportsBrowserLibrary();
bool isDartCore() => name == "dart.core";
@@ -3068,9 +3202,9 @@
void set imports(List<ImportElement> imports2) {
for (ImportElement importElement in imports2) {
((importElement as ImportElementImpl)).enclosingElement = this;
- PrefixElementImpl prefix5 = importElement.prefix as PrefixElementImpl;
- if (prefix5 != null) {
- prefix5.enclosingElement = this;
+ PrefixElementImpl prefix2 = importElement.prefix as PrefixElementImpl;
+ if (prefix2 != null) {
+ prefix2.enclosingElement = this;
}
}
this._imports = imports2;
@@ -3098,12 +3232,12 @@
*/
bool isOrImportsBrowserLibrary() {
List<LibraryElement> visited = new List<LibraryElement>();
- Source htmlLibSource = definingCompilationUnit.source.resolve("dart:html");
+ Source htmlLibSource = _context.sourceFactory.forUri(DartSdk.DART_HTML);
visited.add(this);
for (int index = 0; index < visited.length; index++) {
LibraryElement library = visited[index];
- Source source10 = library.definingCompilationUnit.source;
- if (source10 == htmlLibSource) {
+ Source source2 = library.definingCompilationUnit.source;
+ if (source2 == htmlLibSource) {
return true;
}
for (LibraryElement importedLibrary in library.importedLibraries) {
@@ -3183,9 +3317,9 @@
* @param name the name of this element
*/
MethodElementImpl.con1(Identifier name) : super.con1(name) {
- _jtd_constructor_199_impl(name);
+ _jtd_constructor_211_impl(name);
}
- _jtd_constructor_199_impl(Identifier name) {
+ _jtd_constructor_211_impl(Identifier name) {
}
/**
* Initialize a newly created method element to have the given name.
@@ -3194,20 +3328,20 @@
* declaration of this element
*/
MethodElementImpl.con2(String name, int nameOffset) : super.con2(name, nameOffset) {
- _jtd_constructor_200_impl(name, nameOffset);
+ _jtd_constructor_212_impl(name, nameOffset);
}
- _jtd_constructor_200_impl(String name, int nameOffset) {
+ _jtd_constructor_212_impl(String name, int nameOffset) {
}
accept(ElementVisitor visitor) => visitor.visitMethodElement(this);
ClassElement get enclosingElement => super.enclosingElement as ClassElement;
ElementKind get kind => ElementKind.METHOD;
bool isAbstract() => hasModifier(Modifier.ABSTRACT);
bool isOperator() {
- String name14 = name;
- if (name14.isEmpty) {
+ String name2 = name;
+ if (name2.isEmpty) {
return false;
}
- int first = name14.codeUnitAt(0);
+ int first = name2.codeUnitAt(0);
return !((0x61 <= first && first <= 0x7A) || (0x41 <= first && first <= 0x5A) || first == 0x5F || first == 0x24);
}
bool isStatic() => hasModifier(Modifier.STATIC);
@@ -3237,7 +3371,7 @@
* language and for a few additional flags that are useful.
* @coverage dart.engine.element
*/
-class Modifier {
+class Modifier implements Comparable<Modifier> {
static final Modifier ABSTRACT = new Modifier('ABSTRACT', 0);
static final Modifier CONST = new Modifier('CONST', 1);
static final Modifier FACTORY = new Modifier('FACTORY', 2);
@@ -3255,6 +3389,7 @@
int get ordinal => __ordinal;
Modifier(this.__name, this.__ordinal) {
}
+ int compareTo(Modifier other) => __ordinal - other.__ordinal;
String toString() => __name;
}
/**
@@ -3357,6 +3492,11 @@
*/
class ParameterElementImpl extends VariableElementImpl implements ParameterElement {
/**
+ * An array containing all of the parameters defined by this parameter element. There will only be
+ * parameters if this parameter is a function typed parameter.
+ */
+ List<ParameterElement> _parameters = ParameterElementImpl.EMPTY_ARRAY;
+ /**
* The kind of this parameter.
*/
ParameterKind _parameterKind;
@@ -3382,6 +3522,7 @@
accept(ElementVisitor visitor) => visitor.visitParameterElement(this);
ElementKind get kind => ElementKind.PARAMETER;
ParameterKind get parameterKind => _parameterKind;
+ List<ParameterElement> get parameters => _parameters;
SourceRange get visibleRange {
if (_visibleRangeLength < 0) {
return null;
@@ -3404,6 +3545,16 @@
this._parameterKind = parameterKind2;
}
/**
+ * Set the parameters defined by this executable element to the given parameters.
+ * @param parameters the parameters defined by this executable element
+ */
+ void set parameters(List<ParameterElement> parameters2) {
+ for (ParameterElement parameter in parameters2) {
+ ((parameter as ParameterElementImpl)).enclosingElement = this;
+ }
+ this._parameters = parameters2;
+ }
+ /**
* Set the visible range for this element to the range starting at the given offset with the given
* length.
* @param offset the offset to the beginning of the visible range for this element
@@ -3414,13 +3565,28 @@
_visibleRangeOffset = offset;
_visibleRangeLength = length;
}
+ void visitChildren(ElementVisitor<Object> visitor) {
+ super.visitChildren(visitor);
+ safelyVisitChildren(_parameters, visitor);
+ }
void appendTo(JavaStringBuilder builder) {
+ String left = "";
+ String right = "";
+ while (true) {
+ if (parameterKind == ParameterKind.NAMED) {
+ left = "{";
+ right = "}";
+ } else if (parameterKind == ParameterKind.POSITIONAL) {
+ left = "[";
+ right = "]";
+ }
+ break;
+ }
+ builder.append(left);
builder.append(type);
builder.append(" ");
builder.append(name);
- builder.append(" (");
- builder.append(kind);
- builder.append(")");
+ builder.append(right);
}
}
/**
@@ -3479,9 +3645,9 @@
* @param name the name of this element
*/
PropertyAccessorElementImpl.con1(Identifier name) : super.con1(name) {
- _jtd_constructor_205_impl(name);
+ _jtd_constructor_217_impl(name);
}
- _jtd_constructor_205_impl(Identifier name) {
+ _jtd_constructor_217_impl(Identifier name) {
}
/**
* Initialize a newly created synthetic property accessor element to be associated with the given
@@ -3489,9 +3655,9 @@
* @param variable the variable with which this access is associated
*/
PropertyAccessorElementImpl.con2(PropertyInducingElementImpl variable2) : super.con2(variable2.name, -1) {
- _jtd_constructor_206_impl(variable2);
+ _jtd_constructor_218_impl(variable2);
}
- _jtd_constructor_206_impl(PropertyInducingElementImpl variable2) {
+ _jtd_constructor_218_impl(PropertyInducingElementImpl variable2) {
this._variable = variable2;
synthetic = true;
}
@@ -3525,8 +3691,8 @@
* Set the variable associated with this accessor to the given variable.
* @param variable the variable associated with this accessor
*/
- void set variable(PropertyInducingElement variable3) {
- this._variable = variable3;
+ void set variable(PropertyInducingElement variable2) {
+ this._variable = variable2;
}
void appendTo(JavaStringBuilder builder) {
builder.append(isGetter() ? "get " : "set ");
@@ -3556,18 +3722,18 @@
* @param name the name of this element
*/
PropertyInducingElementImpl.con1(Identifier name) : super.con1(name) {
- _jtd_constructor_207_impl(name);
+ _jtd_constructor_219_impl(name);
}
- _jtd_constructor_207_impl(Identifier name) {
+ _jtd_constructor_219_impl(Identifier name) {
}
/**
* Initialize a newly created synthetic element to have the given name.
* @param name the name of this element
*/
PropertyInducingElementImpl.con2(String name) : super.con2(name, -1) {
- _jtd_constructor_208_impl(name);
+ _jtd_constructor_220_impl(name);
}
- _jtd_constructor_208_impl(String name) {
+ _jtd_constructor_220_impl(String name) {
synthetic = true;
}
PropertyAccessorElement get getter => _getter;
@@ -3638,18 +3804,18 @@
* @param name the name of this element
*/
TopLevelVariableElementImpl.con1(Identifier name) : super.con1(name) {
- _jtd_constructor_210_impl(name);
+ _jtd_constructor_222_impl(name);
}
- _jtd_constructor_210_impl(Identifier name) {
+ _jtd_constructor_222_impl(Identifier name) {
}
/**
* Initialize a newly created synthetic top-level variable element to have the given name.
* @param name the name of this element
*/
TopLevelVariableElementImpl.con2(String name) : super.con2(name) {
- _jtd_constructor_211_impl(name);
+ _jtd_constructor_223_impl(name);
}
- _jtd_constructor_211_impl(String name) {
+ _jtd_constructor_223_impl(String name) {
}
accept(ElementVisitor visitor) => visitor.visitTopLevelVariableElement(this);
ElementKind get kind => ElementKind.TOP_LEVEL_VARIABLE;
@@ -3694,8 +3860,8 @@
* Set the type defined by this type variable to the given type
* @param type the type defined by this type variable
*/
- void set type(TypeVariableType type9) {
- this._type = type9;
+ void set type(TypeVariableType type2) {
+ this._type = type2;
}
void appendTo(JavaStringBuilder builder) {
builder.append(name);
@@ -3728,9 +3894,9 @@
* @param name the name of this element
*/
VariableElementImpl.con1(Identifier name) : super.con1(name) {
- _jtd_constructor_213_impl(name);
+ _jtd_constructor_225_impl(name);
}
- _jtd_constructor_213_impl(Identifier name) {
+ _jtd_constructor_225_impl(Identifier name) {
}
/**
* Initialize a newly created variable element to have the given name.
@@ -3739,9 +3905,9 @@
* declaration of this element
*/
VariableElementImpl.con2(String name, int nameOffset) : super.con2(name, nameOffset) {
- _jtd_constructor_214_impl(name, nameOffset);
+ _jtd_constructor_226_impl(name, nameOffset);
}
- _jtd_constructor_214_impl(String name, int nameOffset) {
+ _jtd_constructor_226_impl(String name, int nameOffset) {
}
/**
* Return the result of evaluating this variable's initializer as a compile-time constant
@@ -3780,18 +3946,18 @@
* Set the function representing this variable's initializer to the given function.
* @param initializer the function representing this variable's initializer
*/
- void set initializer(FunctionElement initializer3) {
- if (initializer3 != null) {
- ((initializer3 as FunctionElementImpl)).enclosingElement = this;
+ void set initializer(FunctionElement initializer2) {
+ if (initializer2 != null) {
+ ((initializer2 as FunctionElementImpl)).enclosingElement = this;
}
- this._initializer = initializer3;
+ this._initializer = initializer2;
}
/**
* Set the declared type of this variable to the given type.
* @param type the declared type of this variable
*/
- void set type(Type2 type10) {
- this._type = type10;
+ void set type(Type2 type2) {
+ this._type = type2;
}
void visitChildren(ElementVisitor<Object> visitor) {
super.visitChildren(visitor);
@@ -3804,6 +3970,418 @@
}
}
/**
+ * The abstract class {@code ExecutableMember} defines the behavior common to members that represent
+ * an executable element defined in a parameterized type where the values of the type parameters are
+ * known.
+ */
+abstract class ExecutableMember extends Member implements ExecutableElement {
+ /**
+ * Initialize a newly created element to represent an executable element of the given
+ * parameterized type.
+ * @param baseElement the element on which the parameterized element was created
+ * @param definingType the type in which the element is defined
+ */
+ ExecutableMember(ExecutableElement baseElement, InterfaceType definingType) : super(baseElement, definingType) {
+ }
+ ExecutableElement get baseElement => super.baseElement as ExecutableElement;
+ List<FunctionElement> get functions {
+ throw new UnsupportedOperationException();
+ }
+ List<LabelElement> get labels => baseElement.labels;
+ List<LocalVariableElement> get localVariables {
+ throw new UnsupportedOperationException();
+ }
+ List<ParameterElement> get parameters {
+ List<ParameterElement> baseParameters = baseElement.parameters;
+ int parameterCount = baseParameters.length;
+ if (parameterCount == 0) {
+ return baseParameters;
+ }
+ List<ParameterElement> parameterizedParameters = new List<ParameterElement>(parameterCount);
+ for (int i = 0; i < parameterCount; i++) {
+ parameterizedParameters[i] = ParameterMember.from(baseParameters[i], definingType);
+ }
+ return parameterizedParameters;
+ }
+ FunctionType get type => substituteFor(baseElement.type);
+ bool isOperator() => baseElement.isOperator();
+ bool isStatic() => baseElement.isStatic();
+ void visitChildren(ElementVisitor<Object> visitor) {
+ super.visitChildren(visitor);
+ safelyVisitChildren(baseElement.functions, visitor);
+ safelyVisitChildren(labels, visitor);
+ safelyVisitChildren(baseElement.localVariables, visitor);
+ safelyVisitChildren(parameters, visitor);
+ }
+}
+/**
+ * Instances of the class {@code FieldMember} represent a field element defined in a parameterized
+ * type where the values of the type parameters are known.
+ */
+class FieldMember extends VariableMember implements FieldElement {
+ /**
+ * If the given field's type is different when any type parameters from the defining type's
+ * declaration are replaced with the actual type arguments from the defining type, create a field
+ * member representing the given field. Return the member that was created, or the base field if
+ * no member was created.
+ * @param baseField the base field for which a member might be created
+ * @param definingType the type defining the parameters and arguments to be used in the
+ * substitution
+ * @return the field element that will return the correctly substituted types
+ */
+ static FieldElement from(FieldElement baseField, InterfaceType definingType) {
+ if (baseField == null || definingType.typeArguments.length == 0) {
+ return baseField;
+ }
+ Type2 baseType = baseField.type;
+ if (baseType == null) {
+ return baseField;
+ }
+ List<Type2> argumentTypes = definingType.typeArguments;
+ List<Type2> parameterTypes = TypeVariableTypeImpl.getTypes(definingType.element.typeVariables);
+ Type2 substitutedType = baseType.substitute2(argumentTypes, parameterTypes);
+ if (baseType == substitutedType) {
+ return baseField;
+ }
+ return new FieldMember(baseField, definingType);
+ }
+ /**
+ * Initialize a newly created element to represent a field of the given parameterized type.
+ * @param baseElement the element on which the parameterized element was created
+ * @param definingType the type in which the element is defined
+ */
+ FieldMember(FieldElement baseElement, InterfaceType definingType) : super(baseElement, definingType) {
+ }
+ accept(ElementVisitor visitor) => visitor.visitFieldElement(this);
+ FieldElement get baseElement => super.baseElement as FieldElement;
+ ClassElement get enclosingElement => baseElement.enclosingElement;
+ PropertyAccessorElement get getter => PropertyAccessorMember.from(baseElement.getter, definingType);
+ PropertyAccessorElement get setter => PropertyAccessorMember.from(baseElement.setter, definingType);
+ bool isStatic() => baseElement.isStatic();
+}
+/**
+ * The abstract class {@code Member} defines the behavior common to elements that represent members
+ * of parameterized types.
+ */
+abstract class Member implements Element {
+ /**
+ * The element on which the parameterized element was created.
+ */
+ Element _baseElement;
+ /**
+ * The type in which the element is defined.
+ */
+ InterfaceType _definingType;
+ /**
+ * Initialize a newly created element to represent the member of the given parameterized type.
+ * @param baseElement the element on which the parameterized element was created
+ * @param definingType the type in which the element is defined
+ */
+ Member(Element baseElement, InterfaceType definingType) {
+ this._baseElement = baseElement;
+ this._definingType = definingType;
+ }
+ Element getAncestor(Type elementClass) => baseElement.getAncestor(elementClass);
+ /**
+ * Return the element on which the parameterized element was created.
+ * @return the element on which the parameterized element was created
+ */
+ Element get baseElement => _baseElement;
+ AnalysisContext get context => _baseElement.context;
+ ElementKind get kind => _baseElement.kind;
+ LibraryElement get library => _baseElement.library;
+ ElementLocation get location => _baseElement.location;
+ List<Annotation> get metadata {
+ throw new UnsupportedOperationException();
+ }
+ String get name => _baseElement.name;
+ int get nameOffset => _baseElement.nameOffset;
+ Source get source => _baseElement.source;
+ bool isAccessibleIn(LibraryElement library) => _baseElement.isAccessibleIn(library);
+ bool isSynthetic() => _baseElement.isSynthetic();
+ void visitChildren(ElementVisitor<Object> visitor) {
+ }
+ /**
+ * Return the type in which the element is defined.
+ * @return the type in which the element is defined
+ */
+ InterfaceType get definingType => _definingType;
+ /**
+ * If the given child is not {@code null}, use the given visitor to visit it.
+ * @param child the child to be visited
+ * @param visitor the visitor to be used to visit the child
+ */
+ void safelyVisitChild(Element child, ElementVisitor<Object> visitor) {
+ if (child != null) {
+ child.accept(visitor);
+ }
+ }
+ /**
+ * Use the given visitor to visit all of the children in the given array.
+ * @param children the children to be visited
+ * @param visitor the visitor being used to visit the children
+ */
+ void safelyVisitChildren(List<Element> children, ElementVisitor<Object> visitor) {
+ if (children != null) {
+ for (Element child in children) {
+ child.accept(visitor);
+ }
+ }
+ }
+ /**
+ * Return the type that results from replacing the type parameters in the given type with the type
+ * arguments.
+ * @param type the type to be transformed
+ * @return the result of transforming the type
+ */
+ Type2 substituteFor(Type2 type) {
+ List<Type2> argumentTypes = _definingType.typeArguments;
+ List<Type2> parameterTypes = TypeVariableTypeImpl.getTypes(_definingType.element.typeVariables);
+ return type.substitute2(argumentTypes, parameterTypes) as Type2;
+ }
+ /**
+ * Return the array of types that results from replacing the type parameters in the given types
+ * with the type arguments.
+ * @param types the types to be transformed
+ * @return the result of transforming the types
+ */
+ List<InterfaceType> substituteFor2(List<InterfaceType> types) {
+ int count = types.length;
+ List<InterfaceType> substitutedTypes = new List<InterfaceType>(count);
+ for (int i = 0; i < count; i++) {
+ substitutedTypes[i] = substituteFor(types[i]);
+ }
+ return substitutedTypes;
+ }
+}
+/**
+ * Instances of the class {@code MethodMember} represent a method element defined in a parameterized
+ * type where the values of the type parameters are known.
+ */
+class MethodMember extends ExecutableMember implements MethodElement {
+ /**
+ * If the given method's type is different when any type parameters from the defining type's
+ * declaration are replaced with the actual type arguments from the defining type, create a method
+ * member representing the given method. Return the member that was created, or the base method if
+ * no member was created.
+ * @param baseMethod the base method for which a member might be created
+ * @param definingType the type defining the parameters and arguments to be used in the
+ * substitution
+ * @return the method element that will return the correctly substituted types
+ */
+ static MethodElement from(MethodElement baseMethod, InterfaceType definingType) {
+ if (baseMethod == null || definingType.typeArguments.length == 0) {
+ return baseMethod;
+ }
+ FunctionType baseType = baseMethod.type;
+ List<Type2> argumentTypes = definingType.typeArguments;
+ List<Type2> parameterTypes = TypeVariableTypeImpl.getTypes(definingType.element.typeVariables);
+ FunctionType substitutedType = baseType.substitute2(argumentTypes, parameterTypes);
+ if (baseType == substitutedType) {
+ return baseMethod;
+ }
+ return new MethodMember(baseMethod, definingType);
+ }
+ /**
+ * Initialize a newly created element to represent a method of the given parameterized type.
+ * @param baseElement the element on which the parameterized element was created
+ * @param definingType the type in which the element is defined
+ */
+ MethodMember(MethodElement baseElement, InterfaceType definingType) : super(baseElement, definingType) {
+ }
+ accept(ElementVisitor visitor) => visitor.visitMethodElement(this);
+ MethodElement get baseElement => super.baseElement as MethodElement;
+ ClassElement get enclosingElement => baseElement.enclosingElement;
+ bool isAbstract() => baseElement.isAbstract();
+ String toString() {
+ MethodElement baseElement2 = baseElement;
+ List<ParameterElement> parameters2 = parameters;
+ FunctionType type2 = type;
+ JavaStringBuilder builder = new JavaStringBuilder();
+ builder.append(baseElement2.enclosingElement.name);
+ builder.append(".");
+ builder.append(baseElement2.name);
+ builder.append("(");
+ int parameterCount = parameters2.length;
+ for (int i = 0; i < parameterCount; i++) {
+ if (i > 0) {
+ builder.append(", ");
+ }
+ builder.append(parameters2[i]).toString();
+ }
+ builder.append(")");
+ if (type2 != null) {
+ builder.append(" -> ");
+ builder.append(type2.returnType);
+ }
+ return builder.toString();
+ }
+}
+/**
+ * Instances of the class {@code ParameterMember} represent a parameter element defined in a
+ * parameterized type where the values of the type parameters are known.
+ */
+class ParameterMember extends VariableMember implements ParameterElement {
+ /**
+ * If the given parameter's type is different when any type parameters from the defining type's
+ * declaration are replaced with the actual type arguments from the defining type, create a
+ * parameter member representing the given parameter. Return the member that was created, or the
+ * base parameter if no member was created.
+ * @param baseParameter the base parameter for which a member might be created
+ * @param definingType the type defining the parameters and arguments to be used in the
+ * substitution
+ * @return the parameter element that will return the correctly substituted types
+ */
+ static ParameterElement from(ParameterElement baseParameter, InterfaceType definingType) {
+ if (baseParameter == null || definingType.typeArguments.length == 0) {
+ return baseParameter;
+ }
+ Type2 baseType = baseParameter.type;
+ List<Type2> argumentTypes = definingType.typeArguments;
+ List<Type2> parameterTypes = TypeVariableTypeImpl.getTypes(definingType.element.typeVariables);
+ Type2 substitutedType = baseType.substitute2(argumentTypes, parameterTypes);
+ if (baseType == substitutedType) {
+ return baseParameter;
+ }
+ return new ParameterMember(baseParameter, definingType);
+ }
+ /**
+ * Initialize a newly created element to represent a parameter of the given parameterized type.
+ * @param baseElement the element on which the parameterized element was created
+ * @param definingType the type in which the element is defined
+ */
+ ParameterMember(ParameterElement baseElement, InterfaceType definingType) : super(baseElement, definingType) {
+ }
+ accept(ElementVisitor visitor) => visitor.visitParameterElement(this);
+ Element getAncestor(Type elementClass) {
+ Element element = baseElement.getAncestor(elementClass);
+ if (element is MethodElement) {
+ return MethodMember.from((element as MethodElement), definingType) as Element;
+ } else if (element is PropertyAccessorElement) {
+ return PropertyAccessorMember.from((element as PropertyAccessorElement), definingType) as Element;
+ }
+ return element;
+ }
+ ParameterElement get baseElement => super.baseElement as ParameterElement;
+ Element get enclosingElement => baseElement.enclosingElement;
+ ParameterKind get parameterKind => baseElement.parameterKind;
+ List<ParameterElement> get parameters {
+ List<ParameterElement> baseParameters = baseElement.parameters;
+ int parameterCount = baseParameters.length;
+ if (parameterCount == 0) {
+ return baseParameters;
+ }
+ List<ParameterElement> parameterizedParameters = new List<ParameterElement>(parameterCount);
+ for (int i = 0; i < parameterCount; i++) {
+ parameterizedParameters[i] = ParameterMember.from(baseParameters[i], definingType);
+ }
+ return parameterizedParameters;
+ }
+ SourceRange get visibleRange => baseElement.visibleRange;
+ bool isInitializingFormal() => baseElement.isInitializingFormal();
+ String toString() {
+ ParameterElement baseElement2 = baseElement;
+ String left = "";
+ String right = "";
+ while (true) {
+ if (baseElement2.parameterKind == ParameterKind.NAMED) {
+ left = "{";
+ right = "}";
+ } else if (baseElement2.parameterKind == ParameterKind.POSITIONAL) {
+ left = "[";
+ right = "]";
+ }
+ break;
+ }
+ JavaStringBuilder builder = new JavaStringBuilder();
+ builder.append(left);
+ builder.append(type);
+ builder.append(" ");
+ builder.append(baseElement2.name);
+ builder.append(right);
+ return builder.toString();
+ }
+ void visitChildren(ElementVisitor<Object> visitor) {
+ super.visitChildren(visitor);
+ safelyVisitChildren(parameters, visitor);
+ }
+}
+/**
+ * Instances of the class {@code PropertyAccessorMember} represent a property accessor element
+ * defined in a parameterized type where the values of the type parameters are known.
+ */
+class PropertyAccessorMember extends ExecutableMember implements PropertyAccessorElement {
+ /**
+ * If the given property accessor's type is different when any type parameters from the defining
+ * type's declaration are replaced with the actual type arguments from the defining type, create a
+ * property accessor member representing the given property accessor. Return the member that was
+ * created, or the base accessor if no member was created.
+ * @param baseAccessor the base property accessor for which a member might be created
+ * @param definingType the type defining the parameters and arguments to be used in the
+ * substitution
+ * @return the property accessor element that will return the correctly substituted types
+ */
+ static PropertyAccessorElement from(PropertyAccessorElement baseAccessor, InterfaceType definingType) {
+ if (baseAccessor == null || definingType.typeArguments.length == 0) {
+ return baseAccessor;
+ }
+ FunctionType baseType = baseAccessor.type;
+ List<Type2> argumentTypes = definingType.typeArguments;
+ List<Type2> parameterTypes = TypeVariableTypeImpl.getTypes(definingType.element.typeVariables);
+ FunctionType substitutedType = baseType.substitute2(argumentTypes, parameterTypes);
+ if (baseType == substitutedType) {
+ return baseAccessor;
+ }
+ return new PropertyAccessorMember(baseAccessor, definingType);
+ }
+ /**
+ * Initialize a newly created element to represent a property accessor of the given parameterized
+ * type.
+ * @param baseElement the element on which the parameterized element was created
+ * @param definingType the type in which the element is defined
+ */
+ PropertyAccessorMember(PropertyAccessorElement baseElement, InterfaceType definingType) : super(baseElement, definingType) {
+ }
+ accept(ElementVisitor visitor) => visitor.visitPropertyAccessorElement(this);
+ PropertyAccessorElement get baseElement => super.baseElement as PropertyAccessorElement;
+ Element get enclosingElement => baseElement.enclosingElement;
+ PropertyInducingElement get variable {
+ PropertyInducingElement variable2 = baseElement.variable;
+ if (variable2 is FieldElement) {
+ return FieldMember.from(((variable2 as FieldElement)), definingType);
+ }
+ return variable2;
+ }
+ bool isGetter() => baseElement.isGetter();
+ bool isSetter() => baseElement.isSetter();
+}
+/**
+ * The abstract class {@code VariableMember} defines the behavior common to members that represent a
+ * variable element defined in a parameterized type where the values of the type parameters are
+ * known.
+ */
+abstract class VariableMember extends Member implements VariableElement {
+ /**
+ * Initialize a newly created element to represent an executable element of the given
+ * parameterized type.
+ * @param baseElement the element on which the parameterized element was created
+ * @param definingType the type in which the element is defined
+ */
+ VariableMember(VariableElement baseElement, InterfaceType definingType) : super(baseElement, definingType) {
+ }
+ VariableElement get baseElement => super.baseElement as VariableElement;
+ FunctionElement get initializer {
+ throw new UnsupportedOperationException();
+ }
+ Type2 get type => substituteFor(baseElement.type);
+ bool isConst() => baseElement.isConst();
+ bool isFinal() => baseElement.isFinal();
+ void visitChildren(ElementVisitor<Object> visitor) {
+ super.visitChildren(visitor);
+ safelyVisitChild(baseElement.initializer, visitor);
+ }
+}
+/**
* The unique instance of the class {@code BottomTypeImpl} implements the type {@code bottom}.
* @coverage dart.engine.type
*/
@@ -3934,9 +4512,9 @@
* @param element the element representing the declaration of the function type
*/
FunctionTypeImpl.con1(ExecutableElement element) : super(element, element == null ? null : element.name) {
- _jtd_constructor_265_impl(element);
+ _jtd_constructor_290_impl(element);
}
- _jtd_constructor_265_impl(ExecutableElement element) {
+ _jtd_constructor_290_impl(ExecutableElement element) {
}
/**
* Initialize a newly created function type to be declared by the given element and to have the
@@ -3944,16 +4522,16 @@
* @param element the element representing the declaration of the function type
*/
FunctionTypeImpl.con2(FunctionTypeAliasElement element) : super(element, element == null ? null : element.name) {
- _jtd_constructor_266_impl(element);
+ _jtd_constructor_291_impl(element);
}
- _jtd_constructor_266_impl(FunctionTypeAliasElement element) {
+ _jtd_constructor_291_impl(FunctionTypeAliasElement element) {
}
bool operator ==(Object object) {
if (object is! FunctionTypeImpl) {
return false;
}
FunctionTypeImpl otherType = object as FunctionTypeImpl;
- return element == otherType.element && JavaArrays.equals(_normalParameterTypes, otherType._normalParameterTypes) && JavaArrays.equals(_optionalParameterTypes, otherType._optionalParameterTypes) && equals2(_namedParameterTypes, otherType._namedParameterTypes);
+ return element == otherType.element && JavaArrays.equals(_normalParameterTypes, otherType._normalParameterTypes) && JavaArrays.equals(_optionalParameterTypes, otherType._optionalParameterTypes) && equals2(_namedParameterTypes, otherType._namedParameterTypes) && _returnType == otherType._returnType;
}
Map<String, Type2> get namedParameterTypes => _namedParameterTypes;
List<Type2> get normalParameterTypes => _normalParameterTypes;
@@ -3961,11 +4539,11 @@
Type2 get returnType => _returnType;
List<Type2> get typeArguments => _typeArguments;
int get hashCode {
- Element element44 = element;
- if (element44 == null) {
+ Element element2 = element;
+ if (element2 == null) {
return 0;
}
- return element44.hashCode;
+ return element2.hashCode;
}
bool isSubtypeOf(Type2 type) {
if (type == null) {
@@ -4058,15 +4636,15 @@
* Set the type of object returned by this type of function to the given type.
* @param returnType the type of object returned by this type of function
*/
- void set returnType(Type2 returnType3) {
- this._returnType = returnType3;
+ void set returnType(Type2 returnType2) {
+ this._returnType = returnType2;
}
/**
* Set the actual types of the type arguments to the given types.
* @param typeArguments the actual types of the type arguments
*/
- void set typeArguments(List<Type2> typeArguments4) {
- this._typeArguments = typeArguments4;
+ void set typeArguments(List<Type2> typeArguments2) {
+ this._typeArguments = typeArguments2;
}
FunctionTypeImpl substitute4(List<Type2> argumentTypes) => substitute2(argumentTypes, typeArguments);
FunctionTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes) {
@@ -4076,8 +4654,8 @@
if (argumentTypes.length == 0) {
return this;
}
- Element element45 = element;
- FunctionTypeImpl newType = (element45 is ExecutableElement) ? new FunctionTypeImpl.con1((element45 as ExecutableElement)) : new FunctionTypeImpl.con2((element45 as FunctionTypeAliasElement));
+ Element element2 = element;
+ FunctionTypeImpl newType = (element2 is ExecutableElement) ? new FunctionTypeImpl.con1((element2 as ExecutableElement)) : new FunctionTypeImpl.con2((element2 as FunctionTypeAliasElement));
newType.returnType = _returnType.substitute2(argumentTypes, parameterTypes);
newType.normalParameterTypes = TypeImpl.substitute(_normalParameterTypes, argumentTypes, parameterTypes);
newType.optionalParameterTypes = TypeImpl.substitute(_optionalParameterTypes, argumentTypes, parameterTypes);
@@ -4193,8 +4771,8 @@
}
}
}
- InterfaceType supertype3 = classElement.supertype;
- pathLength = computeLongestInheritancePathToObject2(supertype3, depth + 1);
+ InterfaceType supertype2 = classElement.supertype;
+ pathLength = computeLongestInheritancePathToObject2(supertype2, depth + 1);
if (pathLength > longestPath) {
longestPath = pathLength;
}
@@ -4210,18 +4788,18 @@
* @see #getLeastUpperBound(Type)
*/
static Set<InterfaceType> computeSuperinterfaceSet2(InterfaceType type, Set<InterfaceType> set) {
- Element element46 = type.element;
- if (element46 != null && element46 is ClassElement) {
- ClassElement classElement = element46 as ClassElement;
+ Element element2 = type.element;
+ if (element2 != null && element2 is ClassElement) {
+ ClassElement classElement = element2 as ClassElement;
List<InterfaceType> superinterfaces = classElement.interfaces;
for (InterfaceType superinterface in superinterfaces) {
javaSetAdd(set, superinterface);
computeSuperinterfaceSet2(superinterface, set);
}
- InterfaceType supertype4 = classElement.supertype;
- if (supertype4 != null) {
- javaSetAdd(set, supertype4);
- computeSuperinterfaceSet2(supertype4, set);
+ InterfaceType supertype2 = classElement.supertype;
+ if (supertype2 != null) {
+ javaSetAdd(set, supertype2);
+ computeSuperinterfaceSet2(supertype2, set);
}
}
return set;
@@ -4235,9 +4813,9 @@
* @param element the element representing the declaration of the type
*/
InterfaceTypeImpl.con1(ClassElement element) : super(element, element.name) {
- _jtd_constructor_267_impl(element);
+ _jtd_constructor_292_impl(element);
}
- _jtd_constructor_267_impl(ClassElement element) {
+ _jtd_constructor_292_impl(ClassElement element) {
}
/**
* Initialize a newly created type to have the given name. This constructor should only be used in
@@ -4245,9 +4823,9 @@
* @param name the name of the type
*/
InterfaceTypeImpl.con2(String name) : super(null, name) {
- _jtd_constructor_268_impl(name);
+ _jtd_constructor_293_impl(name);
}
- _jtd_constructor_268_impl(String name) {
+ _jtd_constructor_293_impl(String name) {
}
bool operator ==(Object object) {
if (object is! InterfaceTypeImpl) {
@@ -4257,20 +4835,35 @@
return element == otherType.element && JavaArrays.equals(_typeArguments, otherType._typeArguments);
}
ClassElement get element => super.element as ClassElement;
- Type2 getLeastUpperBound(Type2 type) {
+ PropertyAccessorElement getGetter(String getterName) => PropertyAccessorMember.from(((element as ClassElementImpl)).getGetter(getterName), this);
+ List<InterfaceType> get interfaces {
+ ClassElement classElement = element;
+ List<InterfaceType> interfaces2 = classElement.interfaces;
+ List<TypeVariableElement> typeVariables2 = classElement.typeVariables;
+ if (typeVariables2.length == 0) {
+ return interfaces2;
+ }
+ int count = interfaces2.length;
+ List<InterfaceType> typedInterfaces = new List<InterfaceType>(count);
+ for (int i = 0; i < count; i++) {
+ typedInterfaces[i] = interfaces2[i].substitute2(_typeArguments, TypeVariableTypeImpl.getTypes(typeVariables2));
+ }
+ return typedInterfaces;
+ }
+ Type2 getLeastUpperBound(Type2 type2) {
Type2 dynamicType = DynamicTypeImpl.instance;
- if (identical(this, dynamicType) || identical(type, dynamicType)) {
+ if (identical(this, dynamicType) || identical(type2, dynamicType)) {
return dynamicType;
}
- if (type == null || type is! InterfaceType) {
+ if (type2 == null || type2 is! InterfaceType) {
return null;
}
InterfaceType i = this;
- InterfaceType j = type as InterfaceType;
+ InterfaceType j = type2 as InterfaceType;
Set<InterfaceType> si = computeSuperinterfaceSet(i);
Set<InterfaceType> sj = computeSuperinterfaceSet(j);
- javaSetAdd(si, i);
- javaSetAdd(sj, j);
+ javaSetAdd(si, i.element.type);
+ javaSetAdd(sj, j.element.type);
si.retainAll(sj);
Set<InterfaceType> s = si;
List<InterfaceType> sn = new List.from(s);
@@ -4297,33 +4890,53 @@
}
return null;
}
- Type2 get superclass {
+ MethodElement getMethod(String methodName) => MethodMember.from(((element as ClassElementImpl)).getMethod(methodName), this);
+ List<InterfaceType> get mixins {
ClassElement classElement = element;
- return element.supertype.substitute2(_typeArguments, TypeVariableTypeImpl.getTypes(classElement.typeVariables));
+ List<InterfaceType> mixins2 = classElement.mixins;
+ List<TypeVariableElement> typeVariables2 = classElement.typeVariables;
+ if (typeVariables2.length == 0) {
+ return mixins2;
+ }
+ int count = mixins2.length;
+ List<InterfaceType> typedMixins = new List<InterfaceType>(count);
+ for (int i = 0; i < count; i++) {
+ typedMixins[i] = mixins2[i].substitute2(_typeArguments, TypeVariableTypeImpl.getTypes(typeVariables2));
+ }
+ return typedMixins;
+ }
+ PropertyAccessorElement getSetter(String setterName) => PropertyAccessorMember.from(((element as ClassElementImpl)).getSetter(setterName), this);
+ InterfaceType get superclass {
+ ClassElement classElement = element;
+ InterfaceType supertype2 = classElement.supertype;
+ if (supertype2 == null) {
+ return null;
+ }
+ return supertype2.substitute2(_typeArguments, TypeVariableTypeImpl.getTypes(classElement.typeVariables));
}
List<Type2> get typeArguments => _typeArguments;
int get hashCode {
- ClassElement element47 = element;
- if (element47 == null) {
+ ClassElement element2 = element;
+ if (element2 == null) {
return 0;
}
- return element47.hashCode;
+ return element2.hashCode;
}
bool isDartCoreFunction() {
- ClassElement element48 = element;
- if (element48 == null) {
+ ClassElement element2 = element;
+ if (element2 == null) {
return false;
}
- return element48.name == "Function" && element48.library.isDartCore();
+ return element2.name == "Function" && element2.library.isDartCore();
}
bool isDirectSupertypeOf(InterfaceType type) {
ClassElement i = element;
ClassElement j = type.element;
- InterfaceType supertype5 = j.supertype;
- if (supertype5 == null) {
+ InterfaceType supertype2 = j.supertype;
+ if (supertype2 == null) {
return false;
}
- ClassElement supertypeElement = supertype5.element;
+ ClassElement supertypeElement = supertype2.element;
if (supertypeElement == i) {
return true;
}
@@ -4404,8 +5017,8 @@
}
return true;
}
- Type2 supertype6 = elementT.supertype;
- if (supertype6 == null) {
+ Type2 supertype2 = elementT.supertype;
+ if (supertype2 == null) {
return false;
}
List<Type2> interfaceTypes = elementT.interfaces;
@@ -4420,14 +5033,77 @@
return true;
}
}
- return supertype6.isSubtypeOf(typeS);
+ return supertype2.isSubtypeOf(typeS);
+ }
+ PropertyAccessorElement lookUpGetter(String getterName, LibraryElement library) {
+ PropertyAccessorElement element = getGetter(getterName);
+ if (element != null && element.isAccessibleIn(library)) {
+ return element;
+ }
+ for (InterfaceType mixin in mixins) {
+ element = mixin.getGetter(getterName);
+ if (element != null && element.isAccessibleIn(library)) {
+ return element;
+ }
+ }
+ InterfaceType supertype = superclass;
+ while (supertype != null) {
+ element = supertype.getGetter(getterName);
+ if (element != null && element.isAccessibleIn(library)) {
+ return element;
+ }
+ supertype = supertype.superclass;
+ }
+ return null;
+ }
+ MethodElement lookUpMethod(String methodName, LibraryElement library) {
+ MethodElement element = getMethod(methodName);
+ if (element != null && element.isAccessibleIn(library)) {
+ return element;
+ }
+ for (InterfaceType mixin in mixins) {
+ element = mixin.getMethod(methodName);
+ if (element != null && element.isAccessibleIn(library)) {
+ return element;
+ }
+ }
+ InterfaceType supertype = superclass;
+ while (supertype != null) {
+ element = supertype.getMethod(methodName);
+ if (element != null && element.isAccessibleIn(library)) {
+ return element;
+ }
+ supertype = supertype.superclass;
+ }
+ return null;
+ }
+ PropertyAccessorElement lookUpSetter(String setterName, LibraryElement library) {
+ PropertyAccessorElement element = getSetter(setterName);
+ if (element != null && element.isAccessibleIn(library)) {
+ return element;
+ }
+ for (InterfaceType mixin in mixins) {
+ element = mixin.getSetter(setterName);
+ if (element != null && element.isAccessibleIn(library)) {
+ return element;
+ }
+ }
+ InterfaceType supertype = superclass;
+ while (supertype != null) {
+ element = supertype.getSetter(setterName);
+ if (element != null && element.isAccessibleIn(library)) {
+ return element;
+ }
+ supertype = supertype.superclass;
+ }
+ return null;
}
/**
* Set the actual types of the type arguments to those in the given array.
* @param typeArguments the actual types of the type arguments
*/
- void set typeArguments(List<Type2> typeArguments5) {
- this._typeArguments = typeArguments5;
+ void set typeArguments(List<Type2> typeArguments2) {
+ this._typeArguments = typeArguments2;
}
InterfaceTypeImpl substitute5(List<Type2> argumentTypes) => substitute2(argumentTypes, typeArguments);
InterfaceTypeImpl substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes) {
@@ -4471,12 +5147,12 @@
* @return the result of performing the substitution on each of the types
*/
static List<Type2> substitute(List<Type2> types, List<Type2> argumentTypes, List<Type2> parameterTypes) {
- int length6 = types.length;
- if (length6 == 0) {
+ int length2 = types.length;
+ if (length2 == 0) {
return types;
}
- List<Type2> newTypes = new List<Type2>(length6);
- for (int i = 0; i < length6; i++) {
+ List<Type2> newTypes = new List<Type2>(length2);
+ for (int i = 0; i < length2; i++) {
newTypes[i] = types[i].substitute2(argumentTypes, parameterTypes);
}
return newTypes;
@@ -4565,8 +5241,8 @@
}
bool isSubtypeOf(Type2 type) => true;
Type2 substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes) {
- int length7 = parameterTypes.length;
- for (int i = 0; i < length7; i++) {
+ int length2 = parameterTypes.length;
+ for (int i = 0; i < length2; i++) {
if (parameterTypes[i] == this) {
return argumentTypes[i];
}
@@ -4731,6 +5407,20 @@
abstract class InterfaceType implements Type2 {
ClassElement get element;
/**
+ * Return the element representing the getter with the given name that is declared in this class,
+ * or {@code null} if this class does not declare a getter with the given name.
+ * @param getterName the name of the getter to be returned
+ * @return the getter declared in this class with the given name
+ */
+ PropertyAccessorElement getGetter(String getterName);
+ /**
+ * Return an array containing all of the interfaces that are implemented by this interface. Note
+ * that this is <b>not</b>, in general, equivalent to getting the interfaces from this type's
+ * element because the types returned by this method will have had their type parameters replaced.
+ * @return the interfaces that are implemented by this type
+ */
+ List<InterfaceType> get interfaces;
+ /**
* Return the least upper bound of this type and the given type, or {@code null} if there is no
* least upper bound.
* <p>
@@ -4747,12 +5437,35 @@
*/
Type2 getLeastUpperBound(Type2 type);
/**
- * Return the type representing the superclass of this type. Note that this is <b>not</b>, in
- * general, equivalent to getting the superclass from this type's element because the type
- * returned by this method will have had it's type parameters replaced.
+ * Return the element representing the method with the given name that is declared in this class,
+ * or {@code null} if this class does not declare a method with the given name.
+ * @param methodName the name of the method to be returned
+ * @return the method declared in this class with the given name
+ */
+ MethodElement getMethod(String methodName);
+ /**
+ * Return an array containing all of the mixins that are applied to the class being extended in
+ * order to derive the superclass of this class. Note that this is <b>not</b>, in general,
+ * equivalent to getting the mixins from this type's element because the types returned by this
+ * method will have had their type parameters replaced.
+ * @return the mixins that are applied to derive the superclass of this class
+ */
+ List<InterfaceType> get mixins;
+ /**
+ * Return the element representing the setter with the given name that is declared in this class,
+ * or {@code null} if this class does not declare a setter with the given name.
+ * @param setterName the name of the setter to be returned
+ * @return the setter declared in this class with the given name
+ */
+ PropertyAccessorElement getSetter(String setterName);
+ /**
+ * Return the type representing the superclass of this type, or null if this type represents the
+ * class 'Object'. Note that this is <b>not</b>, in general, equivalent to getting the superclass
+ * from this type's element because the type returned by this method will have had it's type
+ * parameters replaced.
* @return the superclass of this type
*/
- Type2 get superclass;
+ InterfaceType get superclass;
/**
* Return an array containing the actual types of the type arguments. If this type's element does
* not have type parameters, then the array should be empty (although it is possible for type
@@ -4807,6 +5520,65 @@
*/
bool isSubtypeOf(Type2 type);
/**
+ * Return the element representing the getter that results from looking up the given getter in
+ * this class with respect to the given library, or {@code null} if the look up fails. The
+ * behavior of this method is defined by the Dart Language Specification in section 12.15.1:
+ * <blockquote>The result of looking up getter (respectively setter) <i>m</i> in class <i>C</i>
+ * with respect to library <i>L</i> is:
+ * <ul>
+ * <li>If <i>C</i> declares an instance getter (respectively setter) named <i>m</i> that is
+ * accessible to <i>L</i>, then that getter (respectively setter) is the result of the lookup.
+ * Otherwise, if <i>C</i> has a superclass <i>S</i>, then the result of the lookup is the result
+ * of looking up getter (respectively setter) <i>m</i> in <i>S</i> with respect to <i>L</i>.
+ * Otherwise, we say that the lookup has failed.</li>
+ * </ul>
+ * </blockquote>
+ * @param getterName the name of the getter being looked up
+ * @param library the library with respect to which the lookup is being performed
+ * @return the result of looking up the given getter in this class with respect to the given
+ * library
+ */
+ PropertyAccessorElement lookUpGetter(String getterName, LibraryElement library);
+ /**
+ * Return the element representing the method that results from looking up the given method in
+ * this class with respect to the given library, or {@code null} if the look up fails. The
+ * behavior of this method is defined by the Dart Language Specification in section 12.15.1:
+ * <blockquote> The result of looking up method <i>m</i> in class <i>C</i> with respect to library
+ * <i>L</i> is:
+ * <ul>
+ * <li>If <i>C</i> declares an instance method named <i>m</i> that is accessible to <i>L</i>, then
+ * that method is the result of the lookup. Otherwise, if <i>C</i> has a superclass <i>S</i>, then
+ * the result of the lookup is the result of looking up method <i>m</i> in <i>S</i> with respect
+ * to <i>L</i>. Otherwise, we say that the lookup has failed.</li>
+ * </ul>
+ * </blockquote>
+ * @param methodName the name of the method being looked up
+ * @param library the library with respect to which the lookup is being performed
+ * @return the result of looking up the given method in this class with respect to the given
+ * library
+ */
+ MethodElement lookUpMethod(String methodName, LibraryElement library);
+ /**
+ * Return the element representing the setter that results from looking up the given setter in
+ * this class with respect to the given library, or {@code null} if the look up fails. The
+ * behavior of this method is defined by the Dart Language Specification in section 12.16:
+ * <blockquote> The result of looking up getter (respectively setter) <i>m</i> in class <i>C</i>
+ * with respect to library <i>L</i> is:
+ * <ul>
+ * <li>If <i>C</i> declares an instance getter (respectively setter) named <i>m</i> that is
+ * accessible to <i>L</i>, then that getter (respectively setter) is the result of the lookup.
+ * Otherwise, if <i>C</i> has a superclass <i>S</i>, then the result of the lookup is the result
+ * of looking up getter (respectively setter) <i>m</i> in <i>S</i> with respect to <i>L</i>.
+ * Otherwise, we say that the lookup has failed.</li>
+ * </ul>
+ * </blockquote>
+ * @param setterName the name of the setter being looked up
+ * @param library the library with respect to which the lookup is being performed
+ * @return the result of looking up the given setter in this class with respect to the given
+ * library
+ */
+ PropertyAccessorElement lookUpSetter(String setterName, LibraryElement library);
+ /**
* Return the type resulting from substituting the given arguments for this type's parameters.
* This is fully equivalent to {@code substitute(argumentTypes, getTypeArguments())}.
* @param argumentTypes the actual type arguments being substituted for the type parameters
@@ -4913,4 +5685,4 @@
*/
abstract class VoidType implements Type2 {
VoidType substitute2(List<Type2> argumentTypes, List<Type2> parameterTypes);
-}
+}
\ No newline at end of file
diff --git a/pkg/analyzer_experimental/lib/src/generated/engine.dart b/pkg/analyzer_experimental/lib/src/generated/engine.dart
index 6b0bdad..66f945b 100644
--- a/pkg/analyzer_experimental/lib/src/generated/engine.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/engine.dart
@@ -3,17 +3,20 @@
library engine;
+import 'dart:collection' show HasNextIterator;
+import 'dart:uri' show Uri;
import 'java_core.dart';
import 'java_engine.dart';
-import 'dart:collection' show HasNextIterator;
+import 'instrumentation.dart';
import 'error.dart';
import 'source.dart';
import 'scanner.dart' show Token, CharBufferScanner, StringScanner;
-import 'ast.dart' show CompilationUnit, Directive, PartOfDirective;
+import 'ast.dart';
import 'parser.dart' show Parser;
+import 'sdk.dart' show DartSdk;
import 'element.dart';
-import 'resolver.dart' show Namespace, NamespaceBuilder, LibraryResolver, HtmlUnitBuilder;
-import 'html.dart' show XmlTagNode, XmlAttributeNode, SimpleXmlVisitor, HtmlScanner, HtmlScanResult, HtmlParser, HtmlParseResult, HtmlUnit;
+import 'resolver.dart';
+import 'html.dart' show XmlTagNode, XmlAttributeNode, RecursiveXmlVisitor, HtmlScanner, HtmlScanResult, HtmlParser, HtmlParseResult, HtmlUnit;
/**
* The unique instance of the class {@code AnalysisEngine} serves as the entry point for the
@@ -78,7 +81,13 @@
* Create a new context in which analysis can be performed.
* @return the analysis context that was created
*/
- AnalysisContext createAnalysisContext() => new AnalysisContextImpl();
+ AnalysisContext createAnalysisContext() {
+ if (Instrumentation.isNullLogger()) {
+ return new DelegatingAnalysisContextImpl();
+ } else {
+ return new InstrumentedAnalysisContextImpl.con1(new DelegatingAnalysisContextImpl());
+ }
+ }
/**
* Return the logger that should receive information about errors within the analysis engine.
* @return the logger that should receive information about errors within the analysis engine
@@ -207,14 +216,15 @@
*/
Element getElement(ElementLocation location);
/**
- * Return an array containing all of the errors associated with the given source. The array will
- * be empty if the source is not known to this context or if there are no errors in the source.
- * The errors contained in the array can be incomplete.
+ * Return an analysis error info containing the array of all of the errors and the line info
+ * associated with the given source. The array of errors will be empty if the source is not known
+ * to this context or if there are no errors in the source. The errors contained in the array can
+ * be incomplete.
* @param source the source whose errors are to be returned
- * @return all of the errors associated with the given source
+ * @return all of the errors associated with the given source and the line info
* @see #computeErrors(Source)
*/
- List<AnalysisError> getErrors(Source source);
+ AnalysisErrorInfo getErrors(Source source);
/**
* Return the element model corresponding to the HTML file defined by the given source, or{@code null} if the source does not represent an HTML file, the element representing the file
* has not yet been created, or the analysis of the HTML file failed for some reason.
@@ -298,6 +308,23 @@
*/
LineInfo getLineInfo(Source source);
/**
+ * Return a fully resolved AST for a single compilation unit within the given library, or{@code null} if the resolved AST is not already computed.
+ * @param unitSource the source of the compilation unit
+ * @param library the library containing the compilation unit
+ * @return a fully resolved AST for the compilation unit
+ * @see #resolveCompilationUnit(Source,LibraryElement)
+ */
+ CompilationUnit getResolvedCompilationUnit(Source unitSource, LibraryElement library);
+ /**
+ * Return a fully resolved AST for a single compilation unit within the given library, or{@code null} if the resolved AST is not already computed.
+ * @param unitSource the source of the compilation unit
+ * @param librarySource the source of the defining compilation unit of the library containing the
+ * compilation unit
+ * @return a fully resolved AST for the compilation unit
+ * @see #resolveCompilationUnit(Source,Source)
+ */
+ CompilationUnit getResolvedCompilationUnit2(Source unitSource, Source librarySource);
+ /**
* Return the source factory used to create the sources that can be analyzed in this context.
* @return the source factory used to create the sources that can be analyzed in this context
*/
@@ -365,6 +392,7 @@
* @return the result of resolving the AST structure representing the content of the source in the
* context of the given library
* @throws AnalysisException if the analysis could not be performed
+ * @see #getResolvedCompilationUnit(Source,LibraryElement)
*/
CompilationUnit resolveCompilationUnit(Source unitSource, LibraryElement library);
/**
@@ -375,6 +403,7 @@
* @return the result of resolving the AST structure representing the content of the source in the
* context of the given library
* @throws AnalysisException if the analysis could not be performed
+ * @see #getResolvedCompilationUnit(Source,Source)
*/
CompilationUnit resolveCompilationUnit2(Source unitSource, Source librarySource);
/**
@@ -408,6 +437,23 @@
Iterable<Source> sourcesToResolve(List<Source> changedSources);
}
/**
+ * The interface {@code AnalysisErrorInfo} contains the analysis errors and line information for the
+ * errors.
+ */
+abstract class AnalysisErrorInfo {
+ /**
+ * Return the errors that as a result of the analysis, or {@code null} if there were no errors.
+ * @return the errors as a result of the analysis
+ */
+ List<AnalysisError> get errors;
+ /**
+ * Return the line information associated with the errors, or {@code null} if there were no
+ * errors.
+ * @return the line information associated with the errors
+ */
+ LineInfo get lineInfo;
+}
+/**
* Instances of the class {@code AnalysisException} represent an exception that occurred during the
* analysis of one or more sources.
* @coverage dart.engine
@@ -417,18 +463,18 @@
* Initialize a newly created exception.
*/
AnalysisException() : super() {
- _jtd_constructor_124_impl();
+ _jtd_constructor_125_impl();
}
- _jtd_constructor_124_impl() {
+ _jtd_constructor_125_impl() {
}
/**
* Initialize a newly created exception to have the given message.
* @param message the message associated with the exception
*/
AnalysisException.con1(String message) : super(message) {
- _jtd_constructor_125_impl(message);
+ _jtd_constructor_126_impl(message);
}
- _jtd_constructor_125_impl(String message) {
+ _jtd_constructor_126_impl(String message) {
}
/**
* Initialize a newly created exception to have the given message and cause.
@@ -436,18 +482,18 @@
* @param cause the underlying exception that caused this exception
*/
AnalysisException.con2(String message, Exception cause) : super(message, cause) {
- _jtd_constructor_126_impl(message, cause);
+ _jtd_constructor_127_impl(message, cause);
}
- _jtd_constructor_126_impl(String message, Exception cause) {
+ _jtd_constructor_127_impl(String message, Exception cause) {
}
/**
* Initialize a newly created exception to have the given cause.
* @param cause the underlying exception that caused this exception
*/
AnalysisException.con3(Exception cause) : super.withCause(cause) {
- _jtd_constructor_127_impl(cause);
+ _jtd_constructor_128_impl(cause);
}
- _jtd_constructor_127_impl(Exception cause) {
+ _jtd_constructor_128_impl(Exception cause) {
}
}
/**
@@ -455,7 +501,7 @@
* analysis results associated with a given source.
* @coverage dart.engine
*/
-abstract class ChangeNotice {
+abstract class ChangeNotice implements AnalysisErrorInfo {
/**
* Return the fully resolved AST that changed as a result of the analysis, or {@code null} if the
* AST was not changed.
@@ -463,18 +509,6 @@
*/
CompilationUnit get compilationUnit;
/**
- * Return the errors that changed as a result of the analysis, or {@code null} if errors were not
- * changed.
- * @return the errors that changed as a result of the analysis
- */
- List<AnalysisError> get errors;
- /**
- * Return the line information associated with the source, or {@code null} if errors were not
- * changed.
- * @return the line information associated with the source
- */
- LineInfo get lineInfo;
- /**
* Return the source for which the result is being reported.
* @return the source for which the result is being reported
*/
@@ -572,7 +606,7 @@
* context}.
* @coverage dart.engine
*/
-class AnalysisContextImpl implements AnalysisContext {
+class AnalysisContextImpl implements InternalAnalysisContext {
/**
* The source factory used to create the sources that can be analyzed in this context.
*/
@@ -587,10 +621,20 @@
*/
Map<Source, ChangeNoticeImpl> _pendingNotices = new Map<Source, ChangeNoticeImpl>();
/**
+ * A list containing the most recently accessed sources with the most recently used at the end of
+ * the list. When more sources are added than the maximum allowed then the least recently used
+ * source will be removed and will have it's cached AST structure flushed.
+ */
+ List<Source> _recentlyUsed = new List<Source>();
+ /**
* The object used to synchronize access to all of the caches.
*/
Object _cacheLock = new Object();
/**
+ * The maximum number of sources for which data should be kept in the cache.
+ */
+ static int _MAX_CACHE_SIZE = 64;
+ /**
* The name of the 'src' attribute in a HTML tag.
*/
static String _ATTRIBUTE_SRC = "src";
@@ -599,10 +643,18 @@
*/
static String _TAG_SCRIPT = "script";
/**
+ * The number of times that the flushing of information from the cache has been disabled without
+ * being re-enabled.
+ */
+ int _cacheRemovalCount = 0;
+ /**
* Initialize a newly created analysis context.
*/
AnalysisContextImpl() : super() {
}
+ void addSourceInfo(Source source, SourceInfo info) {
+ _sourceMap[source] = info;
+ }
void applyChanges(ChangeSet changeSet) {
if (changeSet.isEmpty()) {
return;
@@ -646,8 +698,8 @@
if (htmlUnitInfo == null) {
return null;
}
- HtmlElement element24 = htmlUnitInfo.element;
- if (element24 == null) {
+ HtmlElement element2 = htmlUnitInfo.element;
+ if (element2 == null) {
HtmlUnit unit = htmlUnitInfo.resolvedUnit;
if (unit == null) {
unit = htmlUnitInfo.parsedUnit;
@@ -656,11 +708,11 @@
}
}
HtmlUnitBuilder builder = new HtmlUnitBuilder(this);
- element24 = builder.buildHtmlElement2(source, unit);
+ element2 = builder.buildHtmlElement2(source, unit);
htmlUnitInfo.resolvedUnit = unit;
- htmlUnitInfo.element = element24;
+ htmlUnitInfo.element = element2;
}
- return element24;
+ return element2;
}
}
SourceKind computeKindOf(Source source) {
@@ -668,8 +720,8 @@
SourceInfo sourceInfo = getSourceInfo(source);
if (sourceInfo == null) {
return SourceKind.UNKNOWN;
- } else if (sourceInfo is DartInfo) {
- sourceInfo = internalComputeKindOf(source, sourceInfo);
+ } else if (identical(sourceInfo, DartInfo.pendingInstance)) {
+ sourceInfo = internalComputeKindOf(source);
}
return sourceInfo.kind;
}
@@ -683,22 +735,22 @@
if (libraryInfo == null) {
return null;
}
- LibraryElement element25 = libraryInfo.element;
- if (element25 == null) {
+ LibraryElement element2 = libraryInfo.element;
+ if (element2 == null) {
if (computeKindOf(source) != SourceKind.LIBRARY) {
return null;
}
LibraryResolver resolver = new LibraryResolver.con1(this);
try {
- element25 = resolver.resolveLibrary(source, true);
- if (element25 != null) {
- libraryInfo.element = element25;
+ element2 = resolver.resolveLibrary(source, true);
+ if (element2 != null) {
+ libraryInfo.element = element2;
}
} on AnalysisException catch (exception) {
AnalysisEngine.instance.logger.logError2("Could not resolve the library ${source.fullName}", exception);
}
}
- return element25;
+ return element2;
}
}
LineInfo computeLineInfo(Source source) {
@@ -707,31 +759,49 @@
if (sourceInfo == null) {
return null;
}
- LineInfo lineInfo4 = sourceInfo.lineInfo;
- if (lineInfo4 == null) {
- if (sourceInfo is DartInfo) {
- sourceInfo = internalComputeKindOf(source, sourceInfo);
+ LineInfo lineInfo2 = sourceInfo.lineInfo;
+ if (lineInfo2 == null) {
+ if (identical(sourceInfo, DartInfo.pendingInstance)) {
+ sourceInfo = internalComputeKindOf(source);
}
if (sourceInfo is HtmlUnitInfo) {
parseHtmlUnit(source);
- lineInfo4 = sourceInfo.lineInfo;
+ lineInfo2 = sourceInfo.lineInfo;
} else if (sourceInfo is CompilationUnitInfo) {
parseCompilationUnit(source);
- lineInfo4 = sourceInfo.lineInfo;
+ lineInfo2 = sourceInfo.lineInfo;
}
}
- return lineInfo4;
+ return lineInfo2;
}
}
- AnalysisContext extractContext(SourceContainer container) {
- AnalysisContextImpl newContext = AnalysisEngine.instance.createAnalysisContext() as AnalysisContextImpl;
+ CompilationUnit computeResolvableCompilationUnit(Source source) {
+ {
+ CompilationUnitInfo compilationUnitInfo = getCompilationUnitInfo(source);
+ if (compilationUnitInfo == null) {
+ return null;
+ }
+ CompilationUnit unit = compilationUnitInfo.parsedCompilationUnit;
+ if (unit == null) {
+ unit = compilationUnitInfo.resolvedCompilationUnit;
+ }
+ if (unit != null) {
+ return unit.accept(new ASTCloner()) as CompilationUnit;
+ }
+ unit = internalParseCompilationUnit(compilationUnitInfo, source);
+ compilationUnitInfo.clearParsedUnit();
+ return unit;
+ }
+ }
+ AnalysisContext extractContext(SourceContainer container) => extractContextInto(container, (AnalysisEngine.instance.createAnalysisContext() as AnalysisContextImpl));
+ InternalAnalysisContext extractContextInto(SourceContainer container, InternalAnalysisContext newContext) {
List<Source> sourcesToRemove = new List<Source>();
{
for (MapEntry<Source, SourceInfo> entry in getMapEntrySet(_sourceMap)) {
Source source = entry.getKey();
if (container.contains(source)) {
sourcesToRemove.add(source);
- newContext._sourceMap[source] = entry.getValue().copy();
+ newContext.addSourceInfo(source, entry.getValue().copy());
}
}
}
@@ -756,13 +826,14 @@
}
return element;
}
- List<AnalysisError> getErrors(Source source) {
+ AnalysisErrorInfo getErrors(Source source) {
{
SourceInfo info = getSourceInfo(source);
if (info is CompilationUnitInfo) {
- return ((info as CompilationUnitInfo)).allErrors;
+ CompilationUnitInfo compilationUnitInfo = info as CompilationUnitInfo;
+ return new AnalysisErrorInfoImpl(compilationUnitInfo.allErrors, compilationUnitInfo.lineInfo);
}
- return AnalysisError.NO_ERRORS;
+ return new AnalysisErrorInfoImpl(AnalysisError.NO_ERRORS, info.lineInfo);
}
}
HtmlElement getHtmlElement(Source source) {
@@ -776,22 +847,25 @@
}
List<Source> getHtmlFilesReferencing(Source source) {
{
- SourceInfo info = getSourceInfo(source);
- if (info is LibraryInfo) {
- return ((info as LibraryInfo)).htmlSources;
- } else if (info is CompilationUnitInfo) {
- List<Source> sources = new List<Source>();
- for (Source librarySource in ((info as CompilationUnitInfo)).librarySources) {
- LibraryInfo libraryInfo = getLibraryInfo(librarySource);
- for (Source htmlSource in libraryInfo.htmlSources) {
- sources.add(htmlSource);
+ List<Source> htmlSources = new List<Source>();
+ while (true) {
+ if (getKindOf(source) == SourceKind.LIBRARY) {
+ } else if (getKindOf(source) == SourceKind.PART) {
+ List<Source> librarySources = getLibrariesContaining(source);
+ for (MapEntry<Source, SourceInfo> entry in getMapEntrySet(_sourceMap)) {
+ if (identical(entry.getValue().kind, SourceKind.HTML)) {
+ if (containsAny(((entry.getValue() as HtmlUnitInfo)).librarySources, librarySources)) {
+ htmlSources.add(entry.getKey());
+ }
+ }
}
}
- if (!sources.isEmpty) {
- return new List.from(sources);
- }
+ break;
}
- return Source.EMPTY_ARRAY;
+ if (htmlSources.isEmpty) {
+ return Source.EMPTY_ARRAY;
+ }
+ return new List.from(htmlSources);
}
}
List<Source> get htmlSources => getSources(SourceKind.HTML);
@@ -832,11 +906,18 @@
}
List<Source> getLibrariesContaining(Source source) {
{
- SourceInfo info = getSourceInfo(source);
- if (info is CompilationUnitInfo) {
- return ((info as CompilationUnitInfo)).librarySources;
+ List<Source> librarySources = new List<Source>();
+ for (MapEntry<Source, SourceInfo> entry in getMapEntrySet(_sourceMap)) {
+ if (identical(entry.getValue().kind, SourceKind.LIBRARY)) {
+ if (contains(((entry.getValue() as LibraryInfo)).unitSources, source)) {
+ librarySources.add(entry.getKey());
+ }
+ }
}
- return Source.EMPTY_ARRAY;
+ if (librarySources.isEmpty) {
+ return Source.EMPTY_ARRAY;
+ }
+ return new List.from(librarySources);
}
}
LibraryElement getLibraryElement(Source source) {
@@ -858,16 +939,10 @@
return null;
}
}
- /**
- * Return a namespace containing mappings for all of the public names defined by the given
- * library.
- * @param library the library whose public namespace is to be returned
- * @return the public namespace of the given library
- */
Namespace getPublicNamespace(LibraryElement library) {
- Source source8 = library.definingCompilationUnit.source;
+ Source source2 = library.definingCompilationUnit.source;
{
- LibraryInfo libraryInfo = getLibraryInfo(source8);
+ LibraryInfo libraryInfo = getLibraryInfo(source2);
if (libraryInfo == null) {
return null;
}
@@ -880,13 +955,6 @@
return namespace;
}
}
- /**
- * Return a namespace containing mappings for all of the public names defined by the library
- * defined by the given source.
- * @param source the source defining the library whose public namespace is to be returned
- * @return the public namespace corresponding to the library defined by the given source
- * @throws AnalysisException if the public namespace could not be computed
- */
Namespace getPublicNamespace2(Source source) {
{
LibraryInfo libraryInfo = getLibraryInfo(source);
@@ -906,6 +974,22 @@
return namespace;
}
}
+ CompilationUnit getResolvedCompilationUnit(Source unitSource, LibraryElement library) {
+ if (library == null) {
+ return null;
+ }
+ return getResolvedCompilationUnit2(unitSource, library.source);
+ }
+ CompilationUnit getResolvedCompilationUnit2(Source unitSource, Source librarySource) {
+ {
+ accessed(unitSource);
+ CompilationUnitInfo compilationUnitInfo = getCompilationUnitInfo(unitSource);
+ if (compilationUnitInfo == null) {
+ return null;
+ }
+ return compilationUnitInfo.resolvedCompilationUnit;
+ }
+ }
SourceFactory get sourceFactory => _sourceFactory;
bool isClientLibrary(Source librarySource) {
SourceInfo sourceInfo = getSourceInfo(librarySource);
@@ -943,6 +1027,7 @@
}
CompilationUnit parseCompilationUnit(Source source) {
{
+ accessed(source);
CompilationUnitInfo compilationUnitInfo = getCompilationUnitInfo(source);
if (compilationUnitInfo == null) {
return null;
@@ -951,17 +1036,7 @@
if (unit == null) {
unit = compilationUnitInfo.parsedCompilationUnit;
if (unit == null) {
- RecordingErrorListener errorListener = new RecordingErrorListener();
- AnalysisContextImpl_ScanResult scanResult = internalScan(source, errorListener);
- Parser parser = new Parser(source, errorListener);
- unit = parser.parseCompilationUnit(scanResult._token);
- LineInfo lineInfo = new LineInfo(scanResult._lineStarts);
- List<AnalysisError> errors = errorListener.getErrors2(source);
- unit.parsingErrors = errors;
- unit.lineInfo = lineInfo;
- compilationUnitInfo.lineInfo = lineInfo;
- compilationUnitInfo.parsedCompilationUnit = unit;
- compilationUnitInfo.parseErrors = errors;
+ unit = internalParseCompilationUnit(compilationUnitInfo, source);
}
}
return unit;
@@ -969,6 +1044,7 @@
}
HtmlUnit parseHtmlUnit(Source source) {
{
+ accessed(source);
HtmlUnitInfo htmlUnitInfo = getHtmlUnitInfo(source);
if (htmlUnitInfo == null) {
return null;
@@ -981,17 +1057,7 @@
unit = result.htmlUnit;
htmlUnitInfo.lineInfo = new LineInfo(result.lineStarts);
htmlUnitInfo.parsedUnit = unit;
- for (SourceInfo sourceInfo in _sourceMap.values) {
- if (sourceInfo is LibraryInfo) {
- ((sourceInfo as LibraryInfo)).removeHtmlSource(source);
- }
- }
- for (Source librarySource in getLibrarySources2(source, unit)) {
- LibraryInfo libraryInfo = getLibraryInfo(librarySource);
- if (libraryInfo != null) {
- libraryInfo.addHtmlSource(source);
- }
- }
+ htmlUnitInfo.librarySources = getLibrarySources2(source, unit);
}
}
return unit;
@@ -1010,105 +1076,113 @@
return notices;
}
}
- /**
- * Given a table mapping the source for the libraries represented by the corresponding elements to
- * the elements representing the libraries, record those mappings.
- * @param elementMap a table mapping the source for the libraries represented by the elements to
- * the elements representing the libraries
- */
void recordLibraryElements(Map<Source, LibraryElement> elementMap) {
Source htmlSource = _sourceFactory.forUri("dart:html");
{
for (MapEntry<Source, LibraryElement> entry in getMapEntrySet(elementMap)) {
+ Source librarySource = entry.getKey();
LibraryElement library = entry.getValue();
- LibraryInfo libraryInfo = getLibraryInfo(entry.getKey());
+ LibraryInfo libraryInfo = getLibraryInfo(librarySource);
if (libraryInfo != null) {
libraryInfo.element = library;
libraryInfo.launchable = library.entryPoint != null;
libraryInfo.client = isClient(library, htmlSource, new Set<LibraryElement>());
- }
- Source librarySource = library.source;
- if (librarySource != null) {
- for (SourceInfo info in _sourceMap.values) {
- if (info is CompilationUnitInfo) {
- ((info as CompilationUnitInfo)).removeLibrarySource(librarySource);
- }
- }
- if (libraryInfo != null) {
- libraryInfo.addLibrarySource(librarySource);
- }
+ List<Source> unitSources = new List<Source>();
+ unitSources.add(librarySource);
for (CompilationUnitElement part in library.parts) {
Source partSource = part.source;
- CompilationUnitInfo partInfo = partSource == null ? null : getCompilationUnitInfo(partSource);
- if (partInfo != null) {
- partInfo.addLibrarySource(librarySource);
- }
+ unitSources.add(partSource);
}
+ libraryInfo.unitSources = new List.from(unitSources);
}
}
}
}
- /**
- * Give the resolution errors and line info associated with the given source, add the information
- * to the cache.
- * @param source the source with which the information is associated
- * @param errors the resolution errors associated with the source
- * @param lineInfo the line information associated with the source
- */
- void recordResolutionErrors(Source source, List<AnalysisError> errors, LineInfo lineInfo5) {
+ void recordResolutionErrors(Source source, List<AnalysisError> errors, LineInfo lineInfo2) {
{
CompilationUnitInfo compilationUnitInfo = getCompilationUnitInfo(source);
if (compilationUnitInfo != null) {
- compilationUnitInfo.lineInfo = lineInfo5;
+ compilationUnitInfo.lineInfo = lineInfo2;
compilationUnitInfo.resolutionErrors = errors;
}
- getNotice(source).setErrors(compilationUnitInfo.allErrors, lineInfo5);
+ getNotice(source).setErrors(compilationUnitInfo.allErrors, lineInfo2);
}
}
- /**
- * Give the resolved compilation unit associated with the given source, add the unit to the cache.
- * @param source the source with which the unit is associated
- * @param unit the compilation unit associated with the source
- */
void recordResolvedCompilationUnit(Source source, CompilationUnit unit) {
{
CompilationUnitInfo compilationUnitInfo = getCompilationUnitInfo(source);
if (compilationUnitInfo != null) {
compilationUnitInfo.resolvedCompilationUnit = unit;
+ compilationUnitInfo.clearParsedUnit();
getNotice(source).compilationUnit = unit;
}
}
}
- CompilationUnit resolveCompilationUnit(Source source15, LibraryElement library) {
+ CompilationUnit resolveCompilationUnit(Source source2, LibraryElement library) {
if (library == null) {
return null;
}
- return resolveCompilationUnit2(source15, library.source);
+ return resolveCompilationUnit2(source2, library.source);
}
CompilationUnit resolveCompilationUnit2(Source unitSource, Source librarySource) {
{
+ accessed(unitSource);
CompilationUnitInfo compilationUnitInfo = getCompilationUnitInfo(unitSource);
if (compilationUnitInfo == null) {
return null;
}
CompilationUnit unit = compilationUnitInfo.resolvedCompilationUnit;
if (unit == null) {
- computeLibraryElement(librarySource);
- unit = compilationUnitInfo.resolvedCompilationUnit;
+ disableCacheRemoval();
+ try {
+ LibraryElement libraryElement = computeLibraryElement(librarySource);
+ unit = compilationUnitInfo.resolvedCompilationUnit;
+ if (unit == null && libraryElement != null) {
+ Source coreLibrarySource = libraryElement.context.sourceFactory.forUri(DartSdk.DART_CORE);
+ LibraryElement coreElement = computeLibraryElement(coreLibrarySource);
+ TypeProvider typeProvider = new TypeProviderImpl(coreElement);
+ CompilationUnit unitAST = computeResolvableCompilationUnit(unitSource);
+ new DeclarationResolver().resolve(unitAST, find(libraryElement, unitSource));
+ RecordingErrorListener errorListener = new RecordingErrorListener();
+ TypeResolverVisitor typeResolverVisitor = new TypeResolverVisitor.con2(libraryElement, unitSource, typeProvider, errorListener);
+ unitAST.accept(typeResolverVisitor);
+ ResolverVisitor resolverVisitor = new ResolverVisitor.con2(libraryElement, unitSource, typeProvider, errorListener);
+ unitAST.accept(resolverVisitor);
+ ErrorReporter errorReporter = new ErrorReporter(errorListener, unitSource);
+ ErrorVerifier errorVerifier = new ErrorVerifier(errorReporter, libraryElement, typeProvider);
+ unitAST.accept(errorVerifier);
+ ConstantVerifier constantVerifier = new ConstantVerifier(errorReporter);
+ unitAST.accept(constantVerifier);
+ unitAST.resolutionErrors = errorListener.errors;
+ compilationUnitInfo.resolvedCompilationUnit = unitAST;
+ unit = unitAST;
+ }
+ } finally {
+ enableCacheRemoval();
+ }
}
return unit;
}
}
HtmlUnit resolveHtmlUnit(Source unitSource) {
{
+ accessed(unitSource);
HtmlUnitInfo htmlUnitInfo = getHtmlUnitInfo(unitSource);
if (htmlUnitInfo == null) {
return null;
}
HtmlUnit unit = htmlUnitInfo.resolvedUnit;
if (unit == null) {
- computeHtmlElement(unitSource);
- unit = htmlUnitInfo.resolvedUnit;
+ disableCacheRemoval();
+ try {
+ computeHtmlElement(unitSource);
+ unit = htmlUnitInfo.resolvedUnit;
+ if (unit == null) {
+ unit = parseHtmlUnit(unitSource);
+ }
+ } finally {
+ enableCacheRemoval();
+ }
}
return unit;
}
@@ -1159,6 +1233,31 @@
return librarySources;
}
/**
+ * Record that the given source was just accessed for some unspecified purpose.
+ * <p>
+ * Note: This method must only be invoked while we are synchronized on {@link #cacheLock}.
+ * @param source the source that was accessed
+ */
+ void accessed(Source source) {
+ if (_recentlyUsed.contains(source)) {
+ _recentlyUsed.remove(source);
+ _recentlyUsed.add(source);
+ return;
+ }
+ if (_cacheRemovalCount == 0 && _recentlyUsed.length >= _MAX_CACHE_SIZE) {
+ Source removedSource = _recentlyUsed.removeAt(0);
+ SourceInfo sourceInfo = _sourceMap[removedSource];
+ if (sourceInfo is HtmlUnitInfo) {
+ ((sourceInfo as HtmlUnitInfo)).clearParsedUnit();
+ ((sourceInfo as HtmlUnitInfo)).clearResolvedUnit();
+ } else if (sourceInfo is CompilationUnitInfo) {
+ ((sourceInfo as CompilationUnitInfo)).clearParsedUnit();
+ ((sourceInfo as CompilationUnitInfo)).clearResolvedUnit();
+ }
+ }
+ _recentlyUsed.add(source);
+ }
+ /**
* Add all of the sources contained in the given source container to the given list of sources.
* <p>
* Note: This method must only be invoked while we are synchronized on {@link #cacheLock}.
@@ -1173,6 +1272,34 @@
}
}
/**
+ * Return {@code true} if the given array of sources contains the given source.
+ * @param sources the sources being searched
+ * @param targetSource the source being searched for
+ * @return {@code true} if the given source is in the array
+ */
+ bool contains(List<Source> sources, Source targetSource) {
+ for (Source source in sources) {
+ if (source == targetSource) {
+ return true;
+ }
+ }
+ return false;
+ }
+ /**
+ * Return {@code true} if the given array of sources contains any of the given target sources.
+ * @param sources the sources being searched
+ * @param targetSources the sources being searched for
+ * @return {@code true} if any of the given target sources are in the array
+ */
+ bool containsAny(List<Source> sources, List<Source> targetSources) {
+ for (Source targetSource in targetSources) {
+ if (contains(sources, targetSource)) {
+ return true;
+ }
+ }
+ return false;
+ }
+ /**
* Create a source information object suitable for the given source. Return the source information
* object that was created, or {@code null} if the source should not be tracked by this context.
* @param source the source for which an information object is being created
@@ -1185,13 +1312,61 @@
_sourceMap[source] = info;
return info;
} else if (AnalysisEngine.isDartFileName(name)) {
- DartInfo info = DartInfo.instance;
+ DartInfo info = DartInfo.pendingInstance;
_sourceMap[source] = info;
return info;
}
return null;
}
/**
+ * Disable flushing information from the cache until {@link #enableCacheRemoval()} has been
+ * called.
+ */
+ void disableCacheRemoval() {
+ _cacheRemovalCount++;
+ }
+ /**
+ * Re-enable flushing information from the cache.
+ */
+ void enableCacheRemoval() {
+ if (_cacheRemovalCount > 0) {
+ _cacheRemovalCount--;
+ }
+ if (_cacheRemovalCount == 0) {
+ while (_recentlyUsed.length >= _MAX_CACHE_SIZE) {
+ Source removedSource = _recentlyUsed.removeAt(0);
+ SourceInfo sourceInfo = _sourceMap[removedSource];
+ if (sourceInfo is HtmlUnitInfo) {
+ ((sourceInfo as HtmlUnitInfo)).clearParsedUnit();
+ ((sourceInfo as HtmlUnitInfo)).clearResolvedUnit();
+ } else if (sourceInfo is CompilationUnitInfo) {
+ ((sourceInfo as CompilationUnitInfo)).clearParsedUnit();
+ ((sourceInfo as CompilationUnitInfo)).clearResolvedUnit();
+ }
+ }
+ }
+ }
+ /**
+ * Search the compilation units that are part of the given library and return the element
+ * representing the compilation unit with the given source. Return {@code null} if there is no
+ * such compilation unit.
+ * @param libraryElement the element representing the library being searched through
+ * @param unitSource the source for the compilation unit whose element is to be returned
+ * @return the element representing the compilation unit
+ */
+ CompilationUnitElement find(LibraryElement libraryElement, Source unitSource) {
+ CompilationUnitElement element = libraryElement.definingCompilationUnit;
+ if (element.source == unitSource) {
+ return element;
+ }
+ for (CompilationUnitElement partElement in libraryElement.parts) {
+ if (partElement.source == unitSource) {
+ return partElement;
+ }
+ }
+ return null;
+ }
+ /**
* Return the compilation unit information associated with the given source, or {@code null} if
* the source is not known to this context. This method should be used to access the compilation
* unit information rather than accessing the compilation unit map directly because sources in the
@@ -1210,8 +1385,8 @@
return sourceInfo as CompilationUnitInfo;
} else if (sourceInfo is CompilationUnitInfo) {
return sourceInfo as CompilationUnitInfo;
- } else if (sourceInfo is DartInfo) {
- sourceInfo = internalComputeKindOf(source, sourceInfo);
+ } else if (identical(sourceInfo, DartInfo.pendingInstance)) {
+ sourceInfo = internalComputeKindOf(source);
if (sourceInfo is CompilationUnitInfo) {
return sourceInfo as CompilationUnitInfo;
}
@@ -1258,8 +1433,8 @@
return sourceInfo as LibraryInfo;
} else if (sourceInfo is LibraryInfo) {
return sourceInfo as LibraryInfo;
- } else if (sourceInfo is DartInfo) {
- sourceInfo = internalComputeKindOf(source, sourceInfo);
+ } else if (identical(sourceInfo, DartInfo.pendingInstance)) {
+ sourceInfo = internalComputeKindOf(source);
if (sourceInfo is LibraryInfo) {
return sourceInfo as LibraryInfo;
}
@@ -1274,8 +1449,11 @@
*/
List<Source> getLibrarySources2(Source htmlSource, HtmlUnit htmlUnit) {
List<Source> libraries = new List<Source>();
- htmlUnit.accept(new SimpleXmlVisitor_3(htmlSource, libraries));
- return libraries;
+ htmlUnit.accept(new RecursiveXmlVisitor_6(this, htmlSource, libraries));
+ if (libraries.isEmpty) {
+ return Source.EMPTY_ARRAY;
+ }
+ return new List.from(libraries);
}
/**
* Return a change notice for the given source, creating one if one does not already exist.
@@ -1312,11 +1490,11 @@
* @param kind the kind of sources to be returned
* @return all of the sources known to this context that have the given kind
*/
- List<Source> getSources(SourceKind kind3) {
+ List<Source> getSources(SourceKind kind2) {
List<Source> sources = new List<Source>();
{
for (MapEntry<Source, SourceInfo> entry in getMapEntrySet(_sourceMap)) {
- if (identical(entry.getValue().kind, kind3)) {
+ if (identical(entry.getValue().kind, kind2)) {
sources.add(entry.getKey());
}
}
@@ -1324,20 +1502,33 @@
return new List.from(sources);
}
/**
- * Return {@code true} if the given compilation unit has a part-of directive.
+ * Return {@code true} if the given compilation unit has a part-of directive but no library
+ * directive.
* @param unit the compilation unit being tested
* @return {@code true} if the compilation unit has a part-of directive
*/
bool hasPartOfDirective(CompilationUnit unit) {
+ bool hasPartOf = false;
for (Directive directive in unit.directives) {
if (directive is PartOfDirective) {
- return true;
+ hasPartOf = true;
+ } else if (directive is LibraryDirective) {
+ return false;
}
}
- return false;
+ return hasPartOf;
}
- SourceInfo internalComputeKindOf(Source source, SourceInfo info) {
+ /**
+ * Compute the kind of the given source. This method should only be invoked when the kind is not
+ * already known. In such a case the source is currently being represented by a {@link DartInfo}.
+ * After this method has run the source will be represented by a new information object that is
+ * appropriate to the computed kind of the source.
+ * @param source the source for which a kind is to be computed
+ * @return the new source info that was created to represent the source
+ */
+ SourceInfo internalComputeKindOf(Source source) {
try {
+ accessed(source);
RecordingErrorListener errorListener = new RecordingErrorListener();
AnalysisContextImpl_ScanResult scanResult = internalScan(source, errorListener);
Parser parser = new Parser(source, errorListener);
@@ -1358,12 +1549,29 @@
_sourceMap[source] = sourceInfo;
return sourceInfo;
} on AnalysisException catch (exception) {
- return info;
+ DartInfo sourceInfo = DartInfo.errorInstance;
+ _sourceMap[source] = sourceInfo;
+ return sourceInfo;
}
}
+ CompilationUnit internalParseCompilationUnit(CompilationUnitInfo compilationUnitInfo, Source source) {
+ accessed(source);
+ RecordingErrorListener errorListener = new RecordingErrorListener();
+ AnalysisContextImpl_ScanResult scanResult = internalScan(source, errorListener);
+ Parser parser = new Parser(source, errorListener);
+ CompilationUnit unit = parser.parseCompilationUnit(scanResult._token);
+ LineInfo lineInfo = new LineInfo(scanResult._lineStarts);
+ List<AnalysisError> errors = errorListener.getErrors2(source);
+ unit.parsingErrors = errors;
+ unit.lineInfo = lineInfo;
+ compilationUnitInfo.lineInfo = lineInfo;
+ compilationUnitInfo.parsedCompilationUnit = unit;
+ compilationUnitInfo.parseErrors = errors;
+ return unit;
+ }
AnalysisContextImpl_ScanResult internalScan(Source source, AnalysisErrorListener errorListener) {
AnalysisContextImpl_ScanResult result = new AnalysisContextImpl_ScanResult();
- Source_ContentReceiver receiver = new Source_ContentReceiver_4(source, errorListener, result);
+ Source_ContentReceiver receiver = new Source_ContentReceiver_7(source, errorListener, result);
try {
source.getContents(receiver);
} catch (exception) {
@@ -1372,6 +1580,27 @@
return result;
}
/**
+ * In response to a change to at least one of the compilation units in the given library,
+ * invalidate any results that are dependent on the result of resolving that library.
+ * @param librarySource the source of the library being invalidated
+ * @param libraryInfo the information for the library being invalidated
+ */
+ void invalidateLibraryResolution(Source librarySource, LibraryInfo libraryInfo) {
+ if (libraryInfo != null) {
+ libraryInfo.invalidateElement();
+ libraryInfo.invalidateLaunchable();
+ libraryInfo.invalidatePublicNamespace();
+ libraryInfo.invalidateResolutionErrors();
+ libraryInfo.invalidateResolvedUnit();
+ for (Source unitSource in libraryInfo.unitSources) {
+ CompilationUnitInfo partInfo = getCompilationUnitInfo(unitSource);
+ partInfo.invalidateResolutionErrors();
+ partInfo.invalidateResolvedUnit();
+ }
+ libraryInfo.invalidateUnitSources();
+ }
+ }
+ /**
* Return {@code true} if this library is, or depends on, dart:html.
* @param library the library being tested
* @param visitedLibraries a collection of the libraries that have been visited, used to prevent
@@ -1407,8 +1636,8 @@
bool performSingleAnalysisTask() {
for (MapEntry<Source, SourceInfo> entry in getMapEntrySet(_sourceMap)) {
SourceInfo sourceInfo = entry.getValue();
- if (identical(sourceInfo, DartInfo.instance) || sourceInfo.kind == null) {
- internalComputeKindOf(entry.getKey(), sourceInfo);
+ if (identical(sourceInfo, DartInfo.pendingInstance)) {
+ internalComputeKindOf(entry.getKey());
return true;
}
}
@@ -1447,7 +1676,18 @@
computeLibraryElement(entry.getKey());
} on AnalysisException catch (exception) {
libraryInfo.element = null;
- AnalysisEngine.instance.logger.logError2("Could not compute the library element for ${entry.getKey().fullName}", exception);
+ AnalysisEngine.instance.logger.logError2("Could not resolve ${entry.getKey().fullName}", exception);
+ }
+ return true;
+ }
+ } else if (sourceInfo is HtmlUnitInfo) {
+ HtmlUnitInfo unitInfo = sourceInfo as HtmlUnitInfo;
+ if (unitInfo.hasInvalidResolvedUnit()) {
+ try {
+ resolveHtmlUnit(entry.getKey());
+ } on AnalysisException catch (exception) {
+ unitInfo.resolvedUnit = null;
+ AnalysisEngine.instance.logger.logError2("Could not resolve ${entry.getKey().fullName}", exception);
}
return true;
}
@@ -1482,21 +1722,20 @@
SourceInfo sourceInfo = _sourceMap[source];
if (sourceInfo is HtmlUnitInfo) {
HtmlUnitInfo htmlUnitInfo = sourceInfo as HtmlUnitInfo;
+ htmlUnitInfo.invalidateElement();
htmlUnitInfo.invalidateLineInfo();
htmlUnitInfo.invalidateParsedUnit();
htmlUnitInfo.invalidateResolvedUnit();
+ } else if (sourceInfo is LibraryInfo) {
+ LibraryInfo libraryInfo = sourceInfo as LibraryInfo;
+ invalidateLibraryResolution(source, libraryInfo);
+ _sourceMap[source] = DartInfo.pendingInstance;
} else if (sourceInfo is CompilationUnitInfo) {
- CompilationUnitInfo compilationUnitInfo = sourceInfo as CompilationUnitInfo;
- for (Source librarySource in compilationUnitInfo.librarySources) {
+ for (Source librarySource in getLibrariesContaining(source)) {
LibraryInfo libraryInfo = getLibraryInfo(librarySource);
- if (libraryInfo != null) {
- libraryInfo.invalidateElement();
- libraryInfo.invalidatePublicNamespace();
- libraryInfo.invalidateLaunchable();
- libraryInfo.invalidateClientServer();
- }
+ invalidateLibraryResolution(librarySource, libraryInfo);
}
- _sourceMap[source] = DartInfo.instance;
+ _sourceMap[source] = DartInfo.pendingInstance;
}
}
/**
@@ -1506,14 +1745,9 @@
void sourceRemoved(Source source) {
CompilationUnitInfo compilationUnitInfo = getCompilationUnitInfo(source);
if (compilationUnitInfo != null) {
- for (Source librarySource in compilationUnitInfo.librarySources) {
+ for (Source librarySource in getLibrariesContaining(source)) {
LibraryInfo libraryInfo = getLibraryInfo(librarySource);
- if (libraryInfo != null) {
- libraryInfo.invalidateElement();
- libraryInfo.invalidatePublicNamespace();
- libraryInfo.invalidateLaunchable();
- libraryInfo.invalidateClientServer();
- }
+ invalidateLibraryResolution(librarySource, libraryInfo);
}
}
_sourceMap.remove(source);
@@ -1524,6 +1758,10 @@
*/
class AnalysisContextImpl_ScanResult {
/**
+ * The time at which the contents of the source were last set.
+ */
+ int _modificationTime = 0;
+ /**
* The first token in the token stream.
*/
Token _token;
@@ -1537,44 +1775,89 @@
AnalysisContextImpl_ScanResult() : super() {
}
}
-class SimpleXmlVisitor_3 extends SimpleXmlVisitor<Object> {
+class RecursiveXmlVisitor_6 extends RecursiveXmlVisitor<Object> {
+ final AnalysisContextImpl AnalysisContextImpl_this;
Source htmlSource;
List<Source> libraries;
- SimpleXmlVisitor_3(this.htmlSource, this.libraries) : super();
+ RecursiveXmlVisitor_6(this.AnalysisContextImpl_this, this.htmlSource, this.libraries) : super();
Object visitXmlTagNode(XmlTagNode node) {
if (javaStringEqualsIgnoreCase(node.tag.lexeme, AnalysisContextImpl._TAG_SCRIPT)) {
for (XmlAttributeNode attribute in node.attributes) {
if (javaStringEqualsIgnoreCase(attribute.name.lexeme, AnalysisContextImpl._ATTRIBUTE_SRC)) {
- Source librarySource = htmlSource.resolve(attribute.value.lexeme);
- if (librarySource.exists()) {
- libraries.add(librarySource);
+ try {
+ Uri uri = new Uri.fromComponents(path: attribute.text);
+ String fileName = uri.path;
+ if (AnalysisEngine.isDartFileName(fileName)) {
+ Source librarySource = AnalysisContextImpl_this._sourceFactory.resolveUri(htmlSource, fileName);
+ if (librarySource.exists()) {
+ libraries.add(librarySource);
+ }
+ }
+ } catch (exception) {
+ AnalysisEngine.instance.logger.logError2("Invalid URL ('${attribute.text}') in script tag in '${htmlSource.fullName}'", exception);
}
}
}
}
- return null;
+ return super.visitXmlTagNode(node);
}
}
-class Source_ContentReceiver_4 implements Source_ContentReceiver {
+class Source_ContentReceiver_7 implements Source_ContentReceiver {
Source source;
AnalysisErrorListener errorListener;
AnalysisContextImpl_ScanResult result;
- Source_ContentReceiver_4(this.source, this.errorListener, this.result);
- accept(CharBuffer contents) {
+ Source_ContentReceiver_7(this.source, this.errorListener, this.result);
+ void accept(CharBuffer contents, int modificationTime2) {
CharBufferScanner scanner = new CharBufferScanner(source, contents, errorListener);
+ result._modificationTime = modificationTime2;
result._token = scanner.tokenize();
result._lineStarts = scanner.lineStarts;
}
- void accept2(String contents) {
+ void accept2(String contents, int modificationTime2) {
StringScanner scanner = new StringScanner(source, contents, errorListener);
+ result._modificationTime = modificationTime2;
result._token = scanner.tokenize();
result._lineStarts = scanner.lineStarts;
}
}
/**
+ * Instances of the class {@code AnalysisErrorInfoImpl} represent the analysis errors and line info
+ * associated with a source.
+ */
+class AnalysisErrorInfoImpl implements AnalysisErrorInfo {
+ /**
+ * The analysis errors associated with a source, or {@code null} if there are no errors.
+ */
+ List<AnalysisError> _errors;
+ /**
+ * The line information associated with the errors, or {@code null} if there are no errors.
+ */
+ LineInfo _lineInfo;
+ /**
+ * Initialize an newly created error info with the errors and line information
+ * @param errors the errors as a result of analysis
+ * @param lineinfo the line info for the errors
+ */
+ AnalysisErrorInfoImpl(List<AnalysisError> errors, LineInfo lineInfo) {
+ this._errors = errors;
+ this._lineInfo = lineInfo;
+ }
+ /**
+ * Return the errors of analysis, or {@code null} if there were no errors.
+ * @return the errors as a result of the analysis
+ */
+ List<AnalysisError> get errors => _errors;
+ /**
+ * Return the line information associated with the errors, or {@code null} if there were no
+ * errors.
+ * @return the line information associated with the errors
+ */
+ LineInfo get lineInfo => _lineInfo;
+}
+/**
* The enumeration {@code CacheState} defines the possible states of cached data.
*/
-class CacheState {
+class CacheState implements Comparable<CacheState> {
/**
* A state representing the fact that the data was up-to-date but flushed from the cache in order
* to control memory usage.
@@ -1595,6 +1878,7 @@
int get ordinal => __ordinal;
CacheState(this.__name, this.__ordinal) {
}
+ int compareTo(CacheState other) => __ordinal - other.__ordinal;
String toString() => __name;
}
/**
@@ -1659,8 +1943,8 @@
* Set the fully resolved AST that changed as a result of the analysis to the given AST.
* @param compilationUnit the fully resolved AST that changed as a result of the analysis
*/
- void set compilationUnit(CompilationUnit compilationUnit9) {
- this._compilationUnit = compilationUnit9;
+ void set compilationUnit(CompilationUnit compilationUnit2) {
+ this._compilationUnit = compilationUnit2;
}
/**
* Set the errors that changed as a result of the analysis to the given errors and set the line
@@ -1668,9 +1952,9 @@
* @param errors the errors that changed as a result of the analysis
* @param lineInfo the line information associated with the source
*/
- void setErrors(List<AnalysisError> errors2, LineInfo lineInfo3) {
+ void setErrors(List<AnalysisError> errors2, LineInfo lineInfo2) {
this._errors = errors2;
- this._lineInfo = lineInfo3;
+ this._lineInfo = lineInfo2;
}
}
/**
@@ -1716,48 +2000,37 @@
*/
List<AnalysisError> _resolutionErrors;
/**
- * The sources for the defining compilation units of the libraries containing the source, or{@code null} if the libraries containing the source are not yet known.
- */
- List<Source> _librarySources = null;
- /**
* Initialize a newly created information holder to be empty.
*/
CompilationUnitInfo() : super() {
}
/**
- * Add the given source to the list of sources for the defining compilation units for the
- * libraries containing this source.
- * @param source the source to be added to the list
- */
- void addLibrarySource(Source source) {
- if (_librarySources == null) {
- _librarySources = new List<Source>();
- }
- _librarySources.add(source);
- }
- /**
* Remove the parsed compilation unit from the cache.
*/
void clearParsedUnit() {
_parsedUnit = null;
+ _parsedUnitState = CacheState.FLUSHED;
}
/**
* Remove the parse errors from the cache.
*/
void clearParseErrors() {
_parseErrors = null;
+ _parseErrorsState = CacheState.FLUSHED;
}
/**
* Remove the resolution errors from the cache.
*/
void clearResolutionErrors() {
_resolutionErrors = null;
+ _resolutionErrorsState = CacheState.FLUSHED;
}
/**
* Remove the resolved compilation unit from the cache.
*/
void clearResolvedUnit() {
_resolvedUnit = null;
+ _resolvedUnitState = CacheState.FLUSHED;
}
CompilationUnitInfo copy() {
CompilationUnitInfo copy = new CompilationUnitInfo();
@@ -1786,16 +2059,6 @@
}
SourceKind get kind => SourceKind.PART;
/**
- * Return the sources for the defining compilation units for the libraries containing this source.
- * @return the sources for the defining compilation units for the libraries containing this source
- */
- List<Source> get librarySources {
- if (_librarySources == null) {
- return Source.EMPTY_ARRAY;
- }
- return new List.from(_librarySources);
- }
- /**
* Return the parsed compilation unit, or {@code null} if the parsed compilation unit is not
* currently cached.
* @return the parsed compilation unit
@@ -1868,19 +2131,6 @@
_resolvedUnit = null;
}
/**
- * Remove the given source from the list of sources for the defining compilation units for the
- * libraries containing this source.
- * @param source the source to be removed to the list
- */
- void removeLibrarySource(Source source) {
- if (_librarySources != null) {
- _librarySources.remove(source);
- if (_librarySources.isEmpty) {
- _librarySources = null;
- }
- }
- }
- /**
* Set the parsed compilation unit to the given compilation unit.
* <p>
* <b>Note:</b> Do not use this method to clear or invalidate the parsed compilation unit. Use
@@ -1927,20 +2177,34 @@
}
}
/**
- * The unique instance of the class {@code DartInfo} acts as a placeholder for Dart compilation
- * units that have not yet had their kind computed.
+ * Instances of the class {@code DartInfo} acts as a placeholder for Dart compilation units that
+ * have not yet had their kind computed.
* @coverage dart.engine
*/
class DartInfo extends SourceInfo {
/**
- * The unique instance of this class.
+ * The instance of this class used to represent a compilation unit for which an attempt was made
+ * to compute the kind but the kind could not be computed.
*/
- static DartInfo _UniqueInstance = new DartInfo();
+ static DartInfo _ErrorInstance = new DartInfo();
/**
- * Return the unique instance of this class.
- * @return the unique instance of this class
+ * The instance of this class used to represent a compilation unit for which no attempt has been
+ * made to compute the kind.
*/
- static DartInfo get instance => _UniqueInstance;
+ static DartInfo _PendingInstance = new DartInfo();
+ /**
+ * Return an instance of this class representing a compilation unit for which an attempt was made
+ * to compute the kind but the kind could not be computed.
+ * @return an instance of this class used to indicate that the computation of the kind resulted in
+ * an error and there is no point trying again
+ */
+ static DartInfo get errorInstance => _ErrorInstance;
+ /**
+ * Return an instance of this class representing a compilation unit for which no attempt has been
+ * made to compute the kind.
+ * @return an instance of this class used to indicate that the computation of the kind is pending
+ */
+ static DartInfo get pendingInstance => _PendingInstance;
/**
* Prevent the creation of instances of this class.
*/
@@ -1950,6 +2214,243 @@
SourceKind get kind => SourceKind.UNKNOWN;
}
/**
+ * Instances of the class {@code DelegatingAnalysisContextImpl} extend {@link AnalysisContextImplanalysis context} to delegate sources to the appropriate analysis context. For instance, if the
+ * source is in a system library then the analysis context from the {@link DartSdk} is used.
+ * @coverage dart.engine
+ */
+class DelegatingAnalysisContextImpl extends AnalysisContextImpl {
+ /**
+ * This references the {@link InternalAnalysisContext} held onto by the {@link DartSdk} which is
+ * used (instead of this {@link AnalysisContext}) for SDK sources. This field is set when
+ * #setSourceFactory(SourceFactory) is called, and references the analysis context in the{@link DartUriResolver} in the {@link SourceFactory}, this analysis context assumes that there
+ * will be such a resolver.
+ */
+ InternalAnalysisContext _sdkAnalysisContext;
+ /**
+ * Initialize a newly created delegating analysis context.
+ */
+ DelegatingAnalysisContextImpl() : super() {
+ }
+ void addSourceInfo(Source source, SourceInfo info) {
+ if (source.isInSystemLibrary()) {
+ _sdkAnalysisContext.addSourceInfo(source, info);
+ } else {
+ super.addSourceInfo(source, info);
+ }
+ }
+ List<AnalysisError> computeErrors(Source source) {
+ if (source.isInSystemLibrary()) {
+ return _sdkAnalysisContext.computeErrors(source);
+ } else {
+ return super.computeErrors(source);
+ }
+ }
+ HtmlElement computeHtmlElement(Source source) {
+ if (source.isInSystemLibrary()) {
+ return _sdkAnalysisContext.computeHtmlElement(source);
+ } else {
+ return super.computeHtmlElement(source);
+ }
+ }
+ SourceKind computeKindOf(Source source) {
+ if (source.isInSystemLibrary()) {
+ return _sdkAnalysisContext.computeKindOf(source);
+ } else {
+ return super.computeKindOf(source);
+ }
+ }
+ LibraryElement computeLibraryElement(Source source) {
+ if (source.isInSystemLibrary()) {
+ return _sdkAnalysisContext.computeLibraryElement(source);
+ } else {
+ return super.computeLibraryElement(source);
+ }
+ }
+ LineInfo computeLineInfo(Source source) {
+ if (source.isInSystemLibrary()) {
+ return _sdkAnalysisContext.computeLineInfo(source);
+ } else {
+ return super.computeLineInfo(source);
+ }
+ }
+ CompilationUnit computeResolvableCompilationUnit(Source source) {
+ if (source.isInSystemLibrary()) {
+ return _sdkAnalysisContext.computeResolvableCompilationUnit(source);
+ } else {
+ return super.computeResolvableCompilationUnit(source);
+ }
+ }
+ AnalysisErrorInfo getErrors(Source source) {
+ if (source.isInSystemLibrary()) {
+ return _sdkAnalysisContext.getErrors(source);
+ } else {
+ return super.getErrors(source);
+ }
+ }
+ HtmlElement getHtmlElement(Source source) {
+ if (source.isInSystemLibrary()) {
+ return _sdkAnalysisContext.getHtmlElement(source);
+ } else {
+ return super.getHtmlElement(source);
+ }
+ }
+ List<Source> getHtmlFilesReferencing(Source source) {
+ if (source.isInSystemLibrary()) {
+ return _sdkAnalysisContext.getHtmlFilesReferencing(source);
+ } else {
+ return super.getHtmlFilesReferencing(source);
+ }
+ }
+ SourceKind getKindOf(Source source) {
+ if (source.isInSystemLibrary()) {
+ return _sdkAnalysisContext.getKindOf(source);
+ } else {
+ return super.getKindOf(source);
+ }
+ }
+ List<Source> getLibrariesContaining(Source source) {
+ if (source.isInSystemLibrary()) {
+ return _sdkAnalysisContext.getLibrariesContaining(source);
+ } else {
+ return super.getLibrariesContaining(source);
+ }
+ }
+ LibraryElement getLibraryElement(Source source) {
+ if (source.isInSystemLibrary()) {
+ return _sdkAnalysisContext.getLibraryElement(source);
+ } else {
+ return super.getLibraryElement(source);
+ }
+ }
+ List<Source> get librarySources => ArrayUtils.addAll(super.librarySources, _sdkAnalysisContext.librarySources);
+ LineInfo getLineInfo(Source source) {
+ if (source.isInSystemLibrary()) {
+ return _sdkAnalysisContext.getLineInfo(source);
+ } else {
+ return super.getLineInfo(source);
+ }
+ }
+ Namespace getPublicNamespace(LibraryElement library) {
+ Source source2 = library.source;
+ if (source2.isInSystemLibrary()) {
+ return _sdkAnalysisContext.getPublicNamespace(library);
+ } else {
+ return super.getPublicNamespace(library);
+ }
+ }
+ Namespace getPublicNamespace2(Source source) {
+ if (source.isInSystemLibrary()) {
+ return _sdkAnalysisContext.getPublicNamespace2(source);
+ } else {
+ return super.getPublicNamespace2(source);
+ }
+ }
+ CompilationUnit getResolvedCompilationUnit(Source unitSource, LibraryElement library) {
+ if (unitSource.isInSystemLibrary()) {
+ return _sdkAnalysisContext.getResolvedCompilationUnit(unitSource, library);
+ } else {
+ return super.getResolvedCompilationUnit(unitSource, library);
+ }
+ }
+ CompilationUnit getResolvedCompilationUnit2(Source unitSource, Source librarySource) {
+ if (unitSource.isInSystemLibrary()) {
+ return _sdkAnalysisContext.getResolvedCompilationUnit2(unitSource, librarySource);
+ } else {
+ return super.getResolvedCompilationUnit2(unitSource, librarySource);
+ }
+ }
+ bool isClientLibrary(Source librarySource) {
+ if (librarySource.isInSystemLibrary()) {
+ return _sdkAnalysisContext.isClientLibrary(librarySource);
+ } else {
+ return super.isClientLibrary(librarySource);
+ }
+ }
+ bool isServerLibrary(Source librarySource) {
+ if (librarySource.isInSystemLibrary()) {
+ return _sdkAnalysisContext.isServerLibrary(librarySource);
+ } else {
+ return super.isServerLibrary(librarySource);
+ }
+ }
+ CompilationUnit parseCompilationUnit(Source source) {
+ if (source.isInSystemLibrary()) {
+ return _sdkAnalysisContext.parseCompilationUnit(source);
+ } else {
+ return super.parseCompilationUnit(source);
+ }
+ }
+ HtmlUnit parseHtmlUnit(Source source) {
+ if (source.isInSystemLibrary()) {
+ return _sdkAnalysisContext.parseHtmlUnit(source);
+ } else {
+ return super.parseHtmlUnit(source);
+ }
+ }
+ void recordLibraryElements(Map<Source, LibraryElement> elementMap) {
+ if (elementMap.isEmpty) {
+ return;
+ }
+ Source source = new JavaIterator(elementMap.keys.toSet()).next();
+ if (source.isInSystemLibrary()) {
+ _sdkAnalysisContext.recordLibraryElements(elementMap);
+ } else {
+ super.recordLibraryElements(elementMap);
+ }
+ }
+ void recordResolutionErrors(Source source, List<AnalysisError> errors, LineInfo lineInfo) {
+ if (source.isInSystemLibrary()) {
+ _sdkAnalysisContext.recordResolutionErrors(source, errors, lineInfo);
+ } else {
+ super.recordResolutionErrors(source, errors, lineInfo);
+ }
+ }
+ void recordResolvedCompilationUnit(Source source, CompilationUnit unit) {
+ if (source.isInSystemLibrary()) {
+ _sdkAnalysisContext.recordResolvedCompilationUnit(source, unit);
+ } else {
+ super.recordResolvedCompilationUnit(source, unit);
+ }
+ }
+ CompilationUnit resolveCompilationUnit(Source source, LibraryElement library) {
+ if (source.isInSystemLibrary()) {
+ return _sdkAnalysisContext.resolveCompilationUnit(source, library);
+ } else {
+ return super.resolveCompilationUnit(source, library);
+ }
+ }
+ CompilationUnit resolveCompilationUnit2(Source unitSource, Source librarySource) {
+ if (unitSource.isInSystemLibrary()) {
+ return _sdkAnalysisContext.resolveCompilationUnit2(unitSource, librarySource);
+ } else {
+ return super.resolveCompilationUnit2(unitSource, librarySource);
+ }
+ }
+ HtmlUnit resolveHtmlUnit(Source unitSource) {
+ if (unitSource.isInSystemLibrary()) {
+ return _sdkAnalysisContext.resolveHtmlUnit(unitSource);
+ } else {
+ return super.resolveHtmlUnit(unitSource);
+ }
+ }
+ void setContents(Source source, String contents) {
+ if (source.isInSystemLibrary()) {
+ _sdkAnalysisContext.setContents(source, contents);
+ } else {
+ super.setContents(source, contents);
+ }
+ }
+ void set sourceFactory(SourceFactory factory) {
+ super.sourceFactory = factory;
+ DartSdk sdk = factory.dartSdk;
+ if (sdk != null) {
+ _sdkAnalysisContext = sdk.context as InternalAnalysisContext;
+ } else {
+ throw new IllegalStateException("SourceFactorys provided to DelegatingAnalysisContextImpls must have a DartSdk associated with the provided SourceFactory.");
+ }
+ }
+}
+/**
* Instances of the class {@code HtmlUnitInfo} maintain the information cached by an analysis
* context about an individual HTML file.
* @coverage dart.engine
@@ -1980,6 +2481,14 @@
*/
HtmlElement _element;
/**
+ * The state of the cached library sources.
+ */
+ CacheState _librarySourcesState = CacheState.INVALID;
+ /**
+ * The sources of libraries referenced by this HTML file.
+ */
+ List<Source> _librarySources = Source.EMPTY_ARRAY;
+ /**
* Initialize a newly created information holder to be empty.
*/
HtmlUnitInfo() : super() {
@@ -1989,12 +2498,14 @@
*/
void clearParsedUnit() {
_parsedUnit = null;
+ _parsedUnitState = CacheState.FLUSHED;
}
/**
* Remove the resolved HTML unit from the cache.
*/
void clearResolvedUnit() {
_resolvedUnit = null;
+ _resolvedUnitState = CacheState.FLUSHED;
}
HtmlUnitInfo copy() {
HtmlUnitInfo copy = new HtmlUnitInfo();
@@ -2009,6 +2520,11 @@
HtmlElement get element => _element;
SourceKind get kind => SourceKind.HTML;
/**
+ * Return the sources of libraries referenced by this HTML file.
+ * @return the sources of libraries referenced by this HTML file
+ */
+ List<Source> get librarySources => _librarySources;
+ /**
* Return the parsed HTML unit, or {@code null} if the parsed HTML unit is not currently cached.
* @return the parsed HTML unit
*/
@@ -2042,6 +2558,13 @@
_element = null;
}
/**
+ * Mark the library sources as needing to be recomputed.
+ */
+ void invalidateLibrarySources() {
+ _librarySourcesState = CacheState.INVALID;
+ _librarySources = Source.EMPTY_ARRAY;
+ }
+ /**
* Mark the parsed HTML unit as needing to be recomputed.
*/
void invalidateParsedUnit() {
@@ -2052,6 +2575,7 @@
* Mark the resolved HTML unit as needing to be recomputed.
*/
void invalidateResolvedUnit() {
+ invalidateElement();
_resolvedUnitState = CacheState.INVALID;
_resolvedUnit = null;
}
@@ -2061,11 +2585,19 @@
* <b>Note:</b> Do not use this method to clear or invalidate the element. Use either{@link #clearElement()} or {@link #invalidateElement()}.
* @param element the element representing the HTML file
*/
- void set element(HtmlElement element19) {
- this._element = element19;
+ void set element(HtmlElement element2) {
+ this._element = element2;
_elementState = CacheState.VALID;
}
/**
+ * Set the sources of libraries referenced by this HTML file to the given sources.
+ * @param sources the sources of libraries referenced by this HTML file
+ */
+ void set librarySources(List<Source> sources) {
+ _librarySources = sources;
+ _librarySourcesState = CacheState.VALID;
+ }
+ /**
* Set the parsed HTML unit to the given HTML unit.
* <p>
* <b>Note:</b> Do not use this method to clear or invalidate the HTML unit. Use either{@link #clearParsedUnit()} or {@link #invalidateParsedUnit()}.
@@ -2090,6 +2622,504 @@
}
}
/**
+ * Instances of the class {@code InstrumentedAnalysisContextImpl} implement an{@link AnalysisContext analysis context} by recording instrumentation data and delegating to
+ * another analysis context to do the non-instrumentation work.
+ * @coverage dart.engine
+ */
+class InstrumentedAnalysisContextImpl implements InternalAnalysisContext {
+ /**
+ * Record an exception that was thrown during analysis.
+ * @param instrumentation the instrumentation builder being used to record the exception
+ * @param exception the exception being reported
+ */
+ static void recordAnalysisException(InstrumentationBuilder instrumentation, AnalysisException exception) {
+ instrumentation.record(exception);
+ }
+ /**
+ * The unique identifier used to identify this analysis context in the instrumentation data.
+ */
+ String _contextId = UUID.randomUUID().toString();
+ /**
+ * The analysis context to which all of the non-instrumentation work is delegated.
+ */
+ InternalAnalysisContext _basis;
+ /**
+ * Create a new {@link InstrumentedAnalysisContextImpl} which wraps a new{@link AnalysisContextImpl} as the basis context.
+ */
+ InstrumentedAnalysisContextImpl() {
+ _jtd_constructor_175_impl();
+ }
+ _jtd_constructor_175_impl() {
+ _jtd_constructor_176_impl(new AnalysisContextImpl());
+ }
+ /**
+ * Create a new {@link InstrumentedAnalysisContextImpl} with a specified basis context, aka the
+ * context to wrap and instrument.
+ * @param context some {@link InstrumentedAnalysisContext} to wrap and instrument
+ */
+ InstrumentedAnalysisContextImpl.con1(InternalAnalysisContext context) {
+ _jtd_constructor_176_impl(context);
+ }
+ _jtd_constructor_176_impl(InternalAnalysisContext context) {
+ _basis = context;
+ }
+ void addSourceInfo(Source source, SourceInfo info) {
+ _basis.addSourceInfo(source, info);
+ }
+ void applyChanges(ChangeSet changeSet) {
+ InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-applyChanges");
+ try {
+ instrumentation.metric3("contextId", _contextId);
+ _basis.applyChanges(changeSet);
+ } finally {
+ instrumentation.log();
+ }
+ }
+ List<AnalysisError> computeErrors(Source source) {
+ InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-computeErrors");
+ try {
+ instrumentation.metric3("contextId", _contextId);
+ List<AnalysisError> errors = _basis.computeErrors(source);
+ instrumentation.metric2("Errors-count", errors.length);
+ return errors;
+ } finally {
+ instrumentation.log();
+ }
+ }
+ HtmlElement computeHtmlElement(Source source) {
+ InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-computeHtmlElement");
+ try {
+ instrumentation.metric3("contextId", _contextId);
+ return _basis.computeHtmlElement(source);
+ } on AnalysisException catch (e) {
+ recordAnalysisException(instrumentation, e);
+ throw e;
+ } finally {
+ instrumentation.log();
+ }
+ }
+ SourceKind computeKindOf(Source source) {
+ InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-computeKindOf");
+ try {
+ instrumentation.metric3("contextId", _contextId);
+ return _basis.computeKindOf(source);
+ } finally {
+ instrumentation.log();
+ }
+ }
+ LibraryElement computeLibraryElement(Source source) {
+ InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-computeLibraryElement");
+ try {
+ instrumentation.metric3("contextId", _contextId);
+ return _basis.computeLibraryElement(source);
+ } on AnalysisException catch (e) {
+ recordAnalysisException(instrumentation, e);
+ throw e;
+ } finally {
+ instrumentation.log();
+ }
+ }
+ LineInfo computeLineInfo(Source source) {
+ InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-computeLineInfo");
+ try {
+ instrumentation.metric3("contextId", _contextId);
+ return _basis.computeLineInfo(source);
+ } on AnalysisException catch (e) {
+ recordAnalysisException(instrumentation, e);
+ throw e;
+ } finally {
+ instrumentation.log();
+ }
+ }
+ CompilationUnit computeResolvableCompilationUnit(Source source) => _basis.computeResolvableCompilationUnit(source);
+ AnalysisContext extractContext(SourceContainer container) {
+ InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-extractContext");
+ try {
+ instrumentation.metric3("contextId", _contextId);
+ InstrumentedAnalysisContextImpl newContext = new InstrumentedAnalysisContextImpl();
+ _basis.extractContextInto(container, newContext._basis);
+ return newContext;
+ } finally {
+ instrumentation.log();
+ }
+ }
+ InternalAnalysisContext extractContextInto(SourceContainer container, InternalAnalysisContext newContext) => _basis.extractContextInto(container, newContext);
+ /**
+ * @return the underlying {@link AnalysisContext}.
+ */
+ AnalysisContext get basis => _basis;
+ Element getElement(ElementLocation location) {
+ InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-getElement");
+ try {
+ instrumentation.metric3("contextId", _contextId);
+ return _basis.getElement(location);
+ } finally {
+ instrumentation.log();
+ }
+ }
+ AnalysisErrorInfo getErrors(Source source) {
+ InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-getErrors");
+ try {
+ instrumentation.metric3("contextId", _contextId);
+ AnalysisErrorInfo ret = _basis.getErrors(source);
+ if (ret != null) {
+ instrumentation.metric2("Errors-count", ret.errors.length);
+ }
+ return ret;
+ } finally {
+ instrumentation.log();
+ }
+ }
+ HtmlElement getHtmlElement(Source source) {
+ InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-getHtmlElement");
+ try {
+ instrumentation.metric3("contextId", _contextId);
+ return _basis.getHtmlElement(source);
+ } finally {
+ instrumentation.log();
+ }
+ }
+ List<Source> getHtmlFilesReferencing(Source source) {
+ InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-getHtmlFilesReferencing");
+ try {
+ instrumentation.metric3("contextId", _contextId);
+ List<Source> ret = _basis.getHtmlFilesReferencing(source);
+ if (ret != null) {
+ instrumentation.metric2("Source-count", ret.length);
+ }
+ return ret;
+ } finally {
+ instrumentation.log();
+ }
+ }
+ List<Source> get htmlSources {
+ InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-getHtmlSources");
+ try {
+ instrumentation.metric3("contextId", _contextId);
+ List<Source> ret = _basis.htmlSources;
+ if (ret != null) {
+ instrumentation.metric2("Source-count", ret.length);
+ }
+ return ret;
+ } finally {
+ instrumentation.log();
+ }
+ }
+ SourceKind getKindOf(Source source) {
+ InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-getKindOf");
+ try {
+ instrumentation.metric3("contextId", _contextId);
+ return _basis.getKindOf(source);
+ } finally {
+ instrumentation.log();
+ }
+ }
+ List<Source> get launchableClientLibrarySources {
+ InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-getLaunchableClientLibrarySources");
+ try {
+ instrumentation.metric3("contextId", _contextId);
+ List<Source> ret = _basis.launchableClientLibrarySources;
+ if (ret != null) {
+ instrumentation.metric2("Source-count", ret.length);
+ }
+ return ret;
+ } finally {
+ instrumentation.log();
+ }
+ }
+ List<Source> get launchableServerLibrarySources {
+ InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-getLaunchableServerLibrarySources");
+ try {
+ instrumentation.metric3("contextId", _contextId);
+ List<Source> ret = _basis.launchableServerLibrarySources;
+ if (ret != null) {
+ instrumentation.metric2("Source-count", ret.length);
+ }
+ return ret;
+ } finally {
+ instrumentation.log();
+ }
+ }
+ List<Source> getLibrariesContaining(Source source) {
+ InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-getLibrariesContaining");
+ try {
+ instrumentation.metric3("contextId", _contextId);
+ List<Source> ret = _basis.getLibrariesContaining(source);
+ if (ret != null) {
+ instrumentation.metric2("Source-count", ret.length);
+ }
+ return ret;
+ } finally {
+ instrumentation.log();
+ }
+ }
+ LibraryElement getLibraryElement(Source source) {
+ InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-getLibraryElement");
+ try {
+ instrumentation.metric3("contextId", _contextId);
+ return _basis.getLibraryElement(source);
+ } finally {
+ instrumentation.log();
+ }
+ }
+ List<Source> get librarySources {
+ InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-getLibrarySources");
+ try {
+ instrumentation.metric3("contextId", _contextId);
+ List<Source> ret = _basis.librarySources;
+ if (ret != null) {
+ instrumentation.metric2("Source-count", ret.length);
+ }
+ return ret;
+ } finally {
+ instrumentation.log();
+ }
+ }
+ LineInfo getLineInfo(Source source) {
+ InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-getLineInfo");
+ try {
+ instrumentation.metric3("contextId", _contextId);
+ return _basis.getLineInfo(source);
+ } finally {
+ instrumentation.log();
+ }
+ }
+ Namespace getPublicNamespace(LibraryElement library) => _basis.getPublicNamespace(library);
+ Namespace getPublicNamespace2(Source source) => _basis.getPublicNamespace2(source);
+ CompilationUnit getResolvedCompilationUnit(Source unitSource, LibraryElement library) {
+ InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-getResolvedCompilationUnit");
+ try {
+ instrumentation.metric3("contextId", _contextId);
+ return _basis.getResolvedCompilationUnit(unitSource, library);
+ } finally {
+ instrumentation.log();
+ }
+ }
+ CompilationUnit getResolvedCompilationUnit2(Source unitSource, Source librarySource) {
+ InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-getResolvedCompilationUnit");
+ try {
+ instrumentation.metric3("contextId", _contextId);
+ return _basis.getResolvedCompilationUnit2(unitSource, librarySource);
+ } finally {
+ instrumentation.log();
+ }
+ }
+ SourceFactory get sourceFactory {
+ InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-getSourceFactory");
+ try {
+ instrumentation.metric3("contextId", _contextId);
+ return _basis.sourceFactory;
+ } finally {
+ instrumentation.log();
+ }
+ }
+ bool isClientLibrary(Source librarySource) {
+ InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-isClientLibrary");
+ try {
+ instrumentation.metric3("contextId", _contextId);
+ return _basis.isClientLibrary(librarySource);
+ } finally {
+ instrumentation.log();
+ }
+ }
+ bool isServerLibrary(Source librarySource) {
+ InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-isServerLibrary");
+ try {
+ instrumentation.metric3("contextId", _contextId);
+ return _basis.isServerLibrary(librarySource);
+ } finally {
+ instrumentation.log();
+ }
+ }
+ void mergeContext(AnalysisContext context) {
+ InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-mergeContext");
+ try {
+ instrumentation.metric3("contextId", _contextId);
+ if (context is InstrumentedAnalysisContextImpl) {
+ context = ((context as InstrumentedAnalysisContextImpl))._basis;
+ }
+ _basis.mergeContext(context);
+ } finally {
+ instrumentation.log();
+ }
+ }
+ CompilationUnit parseCompilationUnit(Source source) {
+ InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-parseCompilationUnit");
+ try {
+ instrumentation.metric3("contextId", _contextId);
+ return _basis.parseCompilationUnit(source);
+ } on AnalysisException catch (e) {
+ recordAnalysisException(instrumentation, e);
+ throw e;
+ } finally {
+ instrumentation.log();
+ }
+ }
+ HtmlUnit parseHtmlUnit(Source source) {
+ InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-parseHtmlUnit");
+ try {
+ instrumentation.metric3("contextId", _contextId);
+ return _basis.parseHtmlUnit(source);
+ } on AnalysisException catch (e) {
+ recordAnalysisException(instrumentation, e);
+ throw e;
+ } finally {
+ instrumentation.log();
+ }
+ }
+ List<ChangeNotice> performAnalysisTask() {
+ InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-performAnalysisTask");
+ try {
+ instrumentation.metric3("contextId", _contextId);
+ List<ChangeNotice> ret = _basis.performAnalysisTask();
+ if (ret != null) {
+ instrumentation.metric2("ChangeNotice-count", ret.length);
+ }
+ return ret;
+ } finally {
+ instrumentation.log();
+ }
+ }
+ void recordLibraryElements(Map<Source, LibraryElement> elementMap) {
+ _basis.recordLibraryElements(elementMap);
+ }
+ void recordResolutionErrors(Source source, List<AnalysisError> errors, LineInfo lineInfo) {
+ _basis.recordResolutionErrors(source, errors, lineInfo);
+ }
+ void recordResolvedCompilationUnit(Source source, CompilationUnit unit) {
+ _basis.recordResolvedCompilationUnit(source, unit);
+ }
+ CompilationUnit resolveCompilationUnit(Source unitSource, LibraryElement library) {
+ InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-resolveCompilationUnit");
+ try {
+ instrumentation.metric3("contextId", _contextId);
+ return _basis.resolveCompilationUnit(unitSource, library);
+ } on AnalysisException catch (e) {
+ recordAnalysisException(instrumentation, e);
+ throw e;
+ } finally {
+ instrumentation.log();
+ }
+ }
+ CompilationUnit resolveCompilationUnit2(Source unitSource, Source librarySource) {
+ InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-resolveCompilationUnit");
+ try {
+ instrumentation.metric3("contextId", _contextId);
+ return _basis.resolveCompilationUnit2(unitSource, librarySource);
+ } on AnalysisException catch (e) {
+ recordAnalysisException(instrumentation, e);
+ throw e;
+ } finally {
+ instrumentation.log();
+ }
+ }
+ HtmlUnit resolveHtmlUnit(Source htmlSource) {
+ InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-resolveHtmlUnit");
+ try {
+ instrumentation.metric3("contextId", _contextId);
+ return _basis.resolveHtmlUnit(htmlSource);
+ } on AnalysisException catch (e) {
+ recordAnalysisException(instrumentation, e);
+ throw e;
+ } finally {
+ instrumentation.log();
+ }
+ }
+ void setContents(Source source, String contents) {
+ InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-setContents");
+ try {
+ instrumentation.metric3("contextId", _contextId);
+ _basis.setContents(source, contents);
+ } finally {
+ instrumentation.log();
+ }
+ }
+ void set sourceFactory(SourceFactory factory) {
+ InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-setSourceFactory");
+ try {
+ instrumentation.metric3("contextId", _contextId);
+ _basis.sourceFactory = factory;
+ } finally {
+ instrumentation.log();
+ }
+ }
+ Iterable<Source> sourcesToResolve(List<Source> changedSources) {
+ InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-sourcesToResolve");
+ try {
+ instrumentation.metric3("contextId", _contextId);
+ return _basis.sourcesToResolve(changedSources);
+ } finally {
+ instrumentation.log();
+ }
+ }
+}
+/**
+ * The interface {@code InternalAnalysisContext} defines additional behavior for an analysis context
+ * that is required by internal users of the context.
+ */
+abstract class InternalAnalysisContext implements AnalysisContext {
+ /**
+ * Add the given source with the given information to this context.
+ * @param source the source to be added
+ * @param info the information about the source
+ */
+ void addSourceInfo(Source source, SourceInfo info);
+ /**
+ * Return an AST structure corresponding to the given source, but ensure that the structure has
+ * not already been resolved and will not be resolved by any other threads or in any other
+ * library.
+ * @param source the compilation unit for which an AST structure should be returned
+ * @return the AST structure representing the content of the source
+ * @throws AnalysisException if the analysis could not be performed
+ */
+ CompilationUnit computeResolvableCompilationUnit(Source source);
+ /**
+ * Initialize the specified context by removing the specified sources from the receiver and adding
+ * them to the specified context.
+ * @param container the container containing sources that should be removed from this context and
+ * added to the returned context
+ * @param newContext the context to be initialized
+ * @return the analysis context that was initialized
+ */
+ InternalAnalysisContext extractContextInto(SourceContainer container, InternalAnalysisContext newContext);
+ /**
+ * Return a namespace containing mappings for all of the public names defined by the given
+ * library.
+ * @param library the library whose public namespace is to be returned
+ * @return the public namespace of the given library
+ */
+ Namespace getPublicNamespace(LibraryElement library);
+ /**
+ * Return a namespace containing mappings for all of the public names defined by the library
+ * defined by the given source.
+ * @param source the source defining the library whose public namespace is to be returned
+ * @return the public namespace corresponding to the library defined by the given source
+ * @throws AnalysisException if the public namespace could not be computed
+ */
+ Namespace getPublicNamespace2(Source source);
+ /**
+ * Given a table mapping the source for the libraries represented by the corresponding elements to
+ * the elements representing the libraries, record those mappings.
+ * @param elementMap a table mapping the source for the libraries represented by the elements to
+ * the elements representing the libraries
+ */
+ void recordLibraryElements(Map<Source, LibraryElement> elementMap);
+ /**
+ * Give the resolution errors and line info associated with the given source, add the information
+ * to the cache.
+ * @param source the source with which the information is associated
+ * @param errors the resolution errors associated with the source
+ * @param lineInfo the line information associated with the source
+ */
+ void recordResolutionErrors(Source source, List<AnalysisError> errors, LineInfo lineInfo);
+ /**
+ * Give the resolved compilation unit associated with the given source, add the unit to the cache.
+ * @param source the source with which the unit is associated
+ * @param unit the compilation unit associated with the source
+ */
+ void recordResolvedCompilationUnit(Source source, CompilationUnit unit);
+}
+/**
* Instances of the class {@code LibraryInfo} maintain the information cached by an analysis context
* about an individual library.
* @coverage dart.engine
@@ -2113,6 +3143,15 @@
*/
LibraryElement _element;
/**
+ * The state of the cached unit sources.
+ */
+ CacheState _unitSourcesState = CacheState.INVALID;
+ /**
+ * The sources of the compilation units that compose the library, including both the defining
+ * compilation unit and any parts.
+ */
+ List<Source> _unitSources = Source.EMPTY_ARRAY;
+ /**
* The state of the cached public namespace.
*/
CacheState _publicNamespaceState = CacheState.INVALID;
@@ -2133,35 +3172,23 @@
*/
int _bitmask = 0;
/**
- * The sources for the HTML files that reference this library (via a script tag), or {@code null}if there are no HTML files that reference the library or if the HTML files are not yet known.
- */
- List<Source> _htmlSources = null;
- /**
* Initialize a newly created information holder to be empty.
*/
LibraryInfo() : super() {
}
/**
- * Add the given source to the list of sources for the HTML files that reference this library.
- * @param source the source to be added to the list
- */
- void addHtmlSource(Source source) {
- if (_htmlSources == null) {
- _htmlSources = new List<Source>();
- }
- _htmlSources.add(source);
- }
- /**
* Remove the library element from the cache.
*/
void clearElement() {
_element = null;
+ _elementState = CacheState.FLUSHED;
}
/**
* Remove the public namespace from the cache.
*/
void clearPublicNamespace() {
_publicNamespace = null;
+ _publicNamespaceState = CacheState.FLUSHED;
}
LibraryInfo copy() {
LibraryInfo copy = new LibraryInfo();
@@ -2174,16 +3201,6 @@
* @return the element representing the library
*/
LibraryElement get element => _element;
- /**
- * Return the sources for the HTML files that reference this library.
- * @return the sources for the HTML files that reference this library
- */
- List<Source> get htmlSources {
- if (_htmlSources == null) {
- return Source.EMPTY_ARRAY;
- }
- return new List.from(_htmlSources);
- }
SourceKind get kind => SourceKind.LIBRARY;
/**
* Return the public namespace of the library, or {@code null} if the namespace is not currently
@@ -2192,6 +3209,12 @@
*/
Namespace get publicNamespace => _publicNamespace;
/**
+ * Return the sources of the compilation units that compose the library, including both the
+ * defining compilation unit and any parts.
+ * @return the sources of the compilation units that compose the library
+ */
+ List<Source> get unitSources => _unitSources;
+ /**
* Return {@code true} if the client/ server flag needs to be recomputed.
* @return {@code true} if the client/ server flag needs to be recomputed
*/
@@ -2240,38 +3263,32 @@
_publicNamespace = null;
}
/**
- * Return <code>true</code> if this library is client based code: the library depends on the html
+ * Mark the compilation unit sources as needing to be recomputed.
+ */
+ void invalidateUnitSources() {
+ _unitSourcesState = CacheState.INVALID;
+ _unitSources = Source.EMPTY_ARRAY;
+ }
+ /**
+ * Return {@code true} if this library is client based code: the library depends on the html
* library.
- * @return <code>true</code> if this library is client based code: the library depends on the html
+ * @return {@code true} if this library is client based code: the library depends on the html
* library
*/
bool isClient() => (_bitmask & _CLIENT_CODE) != 0;
/**
- * Return <code>true</code> if this library is launchable: the file includes a main method.
- * @return <code>true</code> if this library is launchable: the file includes a main method
+ * Return {@code true} if this library is launchable: the file includes a main method.
+ * @return {@code true} if this library is launchable: the file includes a main method
*/
bool isLaunchable() => (_bitmask & _LAUNCHABLE) != 0;
/**
- * Return <code>true</code> if this library is server based code: the library does not depends on
- * the html library.
- * @return <code>true</code> if this library is server based code: the library does not depends on
- * the html library
+ * Return {@code true} if this library is server based code: the library does not depends on the
+ * html library.
+ * @return {@code true} if this library is server based code: the library does not depends on the
+ * html library
*/
bool isServer() => (_bitmask & _CLIENT_CODE) == 0;
/**
- * Remove the given source from the list of sources for the HTML files that reference this
- * library.
- * @param source the source to be removed to the list
- */
- void removeHtmlSource(Source source) {
- if (_htmlSources != null) {
- _htmlSources.remove(source);
- if (_htmlSources.isEmpty) {
- _htmlSources = null;
- }
- }
- }
- /**
* Sets the value of the client/ server flag.
* <p>
* <b>Note:</b> Do not use this method to invalidate the flag, use{@link #invalidateClientServer()}.
@@ -2291,8 +3308,8 @@
* <b>Note:</b> Do not use this method to clear or invalidate the element. Use either{@link #clearElement()} or {@link #invalidateElement()}.
* @param element the element representing the library
*/
- void set element(LibraryElement element20) {
- this._element = element20;
+ void set element(LibraryElement element2) {
+ this._element = element2;
_elementState = CacheState.VALID;
}
/**
@@ -2319,6 +3336,14 @@
_publicNamespace = namespace;
_publicNamespaceState = CacheState.VALID;
}
+ /**
+ * Set the sources of the compilation units that compose the library to the given sources.
+ * @param sources the sources of the compilation units that compose the library
+ */
+ void set unitSources(List<Source> sources) {
+ _unitSourcesState = CacheState.VALID;
+ _unitSources = sources;
+ }
void copyFrom(SourceInfo info) {
super.copyFrom(info);
}
@@ -2364,16 +3389,87 @@
}
}
void onError(AnalysisError event) {
- Source source9 = event.source;
- List<AnalysisError> errorsForSource = _errors[source9];
- if (_errors[source9] == null) {
+ Source source2 = event.source;
+ List<AnalysisError> errorsForSource = _errors[source2];
+ if (_errors[source2] == null) {
errorsForSource = new List<AnalysisError>();
- _errors[source9] = errorsForSource;
+ _errors[source2] = errorsForSource;
}
errorsForSource.add(event);
}
}
/**
+ * Instances of the class {@code ResolutionEraser} remove any resolution information from an AST
+ * structure when used to visit that structure.
+ */
+class ResolutionEraser extends GeneralizingASTVisitor<Object> {
+ Object visitAssignmentExpression(AssignmentExpression node) {
+ node.element = null;
+ return super.visitAssignmentExpression(node);
+ }
+ Object visitBinaryExpression(BinaryExpression node) {
+ node.element = null;
+ return super.visitBinaryExpression(node);
+ }
+ Object visitCompilationUnit(CompilationUnit node) {
+ node.element = null;
+ return super.visitCompilationUnit(node);
+ }
+ Object visitConstructorDeclaration(ConstructorDeclaration node) {
+ node.element = null;
+ return super.visitConstructorDeclaration(node);
+ }
+ Object visitConstructorName(ConstructorName node) {
+ node.element = null;
+ return super.visitConstructorName(node);
+ }
+ Object visitDirective(Directive node) {
+ node.element = null;
+ return super.visitDirective(node);
+ }
+ Object visitExpression(Expression node) {
+ node.staticType = null;
+ node.propagatedType = null;
+ return super.visitExpression(node);
+ }
+ Object visitFunctionExpression(FunctionExpression node) {
+ node.element = null;
+ return super.visitFunctionExpression(node);
+ }
+ Object visitFunctionExpressionInvocation(FunctionExpressionInvocation node) {
+ node.element = null;
+ return super.visitFunctionExpressionInvocation(node);
+ }
+ Object visitIndexExpression(IndexExpression node) {
+ node.element = null;
+ return super.visitIndexExpression(node);
+ }
+ Object visitInstanceCreationExpression(InstanceCreationExpression node) {
+ node.element = null;
+ return super.visitInstanceCreationExpression(node);
+ }
+ Object visitPostfixExpression(PostfixExpression node) {
+ node.element = null;
+ return super.visitPostfixExpression(node);
+ }
+ Object visitPrefixExpression(PrefixExpression node) {
+ node.element = null;
+ return super.visitPrefixExpression(node);
+ }
+ Object visitRedirectingConstructorInvocation(RedirectingConstructorInvocation node) {
+ node.element = null;
+ return super.visitRedirectingConstructorInvocation(node);
+ }
+ Object visitSimpleIdentifier(SimpleIdentifier node) {
+ node.element = null;
+ return super.visitSimpleIdentifier(node);
+ }
+ Object visitSuperConstructorInvocation(SuperConstructorInvocation node) {
+ node.element = null;
+ return super.visitSuperConstructorInvocation(node);
+ }
+}
+/**
* Instances of the class {@code SourceInfo} maintain the information cached by an analysis context
* about an individual source.
* @coverage dart.engine
@@ -2398,6 +3494,7 @@
*/
void clearLineInfo() {
_lineInfo = null;
+ _lineInfoState = CacheState.FLUSHED;
}
/**
* Return a copy of this information holder.
diff --git a/pkg/analyzer_experimental/lib/src/generated/error.dart b/pkg/analyzer_experimental/lib/src/generated/error.dart
index 39e05e7..177546d 100644
--- a/pkg/analyzer_experimental/lib/src/generated/error.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/error.dart
@@ -12,7 +12,7 @@
* Instances of the enumeration {@code ErrorSeverity} represent the severity of an {@link ErrorCode}.
* @coverage dart.engine.error
*/
-class ErrorSeverity {
+class ErrorSeverity implements Comparable<ErrorSeverity> {
/**
* The severity representing a non-error. This is never used for any error code, but is useful for
* clients.
@@ -64,6 +64,7 @@
* @return the most sever of this or the given severity
*/
ErrorSeverity max(ErrorSeverity severity) => this.ordinal >= severity.ordinal ? this : severity;
+ int compareTo(ErrorSeverity other) => __ordinal - other.__ordinal;
String toString() => __name;
}
/**
@@ -122,8 +123,8 @@
* the default source to be used.
* @param source the source to be used when reporting errors
*/
- void set source(Source source7) {
- this._source = source7 == null ? _defaultSource : source7;
+ void set source(Source source2) {
+ this._source = source2 == null ? _defaultSource : source2;
}
}
/**
@@ -138,6 +139,28 @@
*/
static List<AnalysisError> NO_ERRORS = new List<AnalysisError>(0);
/**
+ * A {@link Comparator} that sorts by the name of the file that the {@link AnalysisError} was
+ * found.
+ */
+ static Comparator<AnalysisError> FILE_COMPARATOR = (AnalysisError o1, AnalysisError o2) => o1.source.shortName.compareTo(o2.source.shortName);
+ /**
+ * A {@link Comparator} that sorts error codes first by their severity (errors first, warnings
+ * second), and then by the the error code type.
+ */
+ static Comparator<AnalysisError> ERROR_CODE_COMPARATOR = (AnalysisError o1, AnalysisError o2) {
+ ErrorCode errorCode1 = o1.errorCode;
+ ErrorCode errorCode2 = o2.errorCode;
+ ErrorSeverity errorSeverity1 = errorCode1.errorSeverity;
+ ErrorSeverity errorSeverity2 = errorCode2.errorSeverity;
+ ErrorType errorType1 = errorCode1.type;
+ ErrorType errorType2 = errorCode2.type;
+ if (errorSeverity1 == errorSeverity2) {
+ return errorType1.compareTo(errorType2);
+ } else {
+ return errorSeverity2.compareTo(errorSeverity1);
+ }
+ };
+ /**
* The error code associated with the error.
*/
ErrorCode _errorCode;
@@ -166,9 +189,9 @@
* @param arguments the arguments used to build the error message
*/
AnalysisError.con1(Source source2, ErrorCode errorCode2, List<Object> arguments) {
- _jtd_constructor_130_impl(source2, errorCode2, arguments);
+ _jtd_constructor_131_impl(source2, errorCode2, arguments);
}
- _jtd_constructor_130_impl(Source source2, ErrorCode errorCode2, List<Object> arguments) {
+ _jtd_constructor_131_impl(Source source2, ErrorCode errorCode2, List<Object> arguments) {
this._source = source2;
this._errorCode = errorCode2;
this._message = JavaString.format(errorCode2.message, arguments);
@@ -181,15 +204,15 @@
* @param errorCode the error code to be associated with this error
* @param arguments the arguments used to build the error message
*/
- AnalysisError.con2(Source source3, int offset2, int length11, ErrorCode errorCode3, List<Object> arguments) {
- _jtd_constructor_131_impl(source3, offset2, length11, errorCode3, arguments);
+ AnalysisError.con2(Source source2, int offset2, int length2, ErrorCode errorCode2, List<Object> arguments) {
+ _jtd_constructor_132_impl(source2, offset2, length2, errorCode2, arguments);
}
- _jtd_constructor_131_impl(Source source3, int offset2, int length11, ErrorCode errorCode3, List<Object> arguments) {
- this._source = source3;
+ _jtd_constructor_132_impl(Source source2, int offset2, int length2, ErrorCode errorCode2, List<Object> arguments) {
+ this._source = source2;
this._offset = offset2;
- this._length = length11;
- this._errorCode = errorCode3;
- this._message = JavaString.format(errorCode3.message, arguments);
+ this._length = length2;
+ this._errorCode = errorCode2;
+ this._message = JavaString.format(errorCode2.message, arguments);
}
/**
* Return the error code associated with the error.
@@ -228,8 +251,8 @@
* Set the source in which the error occurred to the given source.
* @param source the source in which the error occurred
*/
- void set source(Source source4) {
- this._source = source4;
+ void set source(Source source2) {
+ this._source = source2;
}
String toString() {
JavaStringBuilder builder = new JavaStringBuilder();
@@ -276,7 +299,7 @@
* Instances of the enumeration {@code ErrorType} represent the type of an {@link ErrorCode}.
* @coverage dart.engine.error
*/
-class ErrorType {
+class ErrorType implements Comparable<ErrorType> {
/**
* Compile-time errors are errors that preclude execution. A compile time error must be reported
* by a Dart compiler before the erroneous code is executed.
@@ -316,6 +339,7 @@
* @return the severity of this type of error
*/
ErrorSeverity get severity => _severity;
+ int compareTo(ErrorType other) => __ordinal - other.__ordinal;
String toString() => __name;
}
/**
@@ -325,7 +349,7 @@
* when appropriate, how the problem can be corrected.
* @coverage dart.engine.error
*/
-class CompileTimeErrorCode implements ErrorCode {
+class CompileTimeErrorCode implements Comparable<CompileTimeErrorCode>, ErrorCode {
/**
* 14.2 Exports: It is a compile-time error if a name <i>N</i> is re-exported by a library
* <i>L</i> and <i>N</i> is introduced into the export namespace of <i>L</i> by more than one
@@ -380,65 +404,60 @@
*/
static final CompileTimeErrorCode COMPILE_TIME_CONSTANT_RAISES_EXCEPTION = new CompileTimeErrorCode('COMPILE_TIME_CONSTANT_RAISES_EXCEPTION', 8, "");
/**
- * 12.1 Constants: It is a compile-time error if evaluation of a compile-time constant would raise
- * an exception.
+ * 7.6 Constructors: A constructor name always begins with the name of its immediately enclosing
+ * class, and may optionally be followed by a dot and an identifier <i>id</i>. It is a
+ * compile-time error if <i>id</i> is the name of a member declared in the immediately enclosing
+ * class.
*/
- static final CompileTimeErrorCode COMPILE_TIME_CONSTANT_RAISES_EXCEPTION_DIVIDE_BY_ZERO = new CompileTimeErrorCode('COMPILE_TIME_CONSTANT_RAISES_EXCEPTION_DIVIDE_BY_ZERO', 9, "Cannot divide by zero");
+ static final CompileTimeErrorCode CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD = new CompileTimeErrorCode('CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD', 9, "'%s' cannot be used to name a constructor and a method in this class");
/**
* 7.6 Constructors: A constructor name always begins with the name of its immediately enclosing
* class, and may optionally be followed by a dot and an identifier <i>id</i>. It is a
* compile-time error if <i>id</i> is the name of a member declared in the immediately enclosing
* class.
*/
- static final CompileTimeErrorCode CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD = new CompileTimeErrorCode('CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD', 10, "'%s' cannot be used to name a constructor and a method in this class");
- /**
- * 7.6 Constructors: A constructor name always begins with the name of its immediately enclosing
- * class, and may optionally be followed by a dot and an identifier <i>id</i>. It is a
- * compile-time error if <i>id</i> is the name of a member declared in the immediately enclosing
- * class.
- */
- static final CompileTimeErrorCode CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD = new CompileTimeErrorCode('CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD', 11, "'%s' cannot be used to name a constructor and a field in this class");
+ static final CompileTimeErrorCode CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD = new CompileTimeErrorCode('CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD', 10, "'%s' cannot be used to name a constructor and a field in this class");
/**
* 7.6.3 Constant Constructors: It is a compile-time error if a constant constructor is declared
* by a class that has a non-final instance variable.
*/
- static final CompileTimeErrorCode CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD = new CompileTimeErrorCode('CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD', 12, "Classes with non-final fields cannot define 'const' constructors");
+ static final CompileTimeErrorCode CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD = new CompileTimeErrorCode('CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD', 11, "Classes with non-final fields cannot define 'const' constructors");
/**
* 6.2 Formal Parameters: It is a compile-time error if a formal parameter is declared as a
* constant variable.
*/
- static final CompileTimeErrorCode CONST_FORMAL_PARAMETER = new CompileTimeErrorCode('CONST_FORMAL_PARAMETER', 13, "Parameters cannot be 'const'");
+ static final CompileTimeErrorCode CONST_FORMAL_PARAMETER = new CompileTimeErrorCode('CONST_FORMAL_PARAMETER', 12, "Parameters cannot be 'const'");
/**
* 5 Variables: A constant variable must be initialized to a compile-time constant or a
* compile-time error occurs.
*/
- static final CompileTimeErrorCode CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE = new CompileTimeErrorCode('CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE', 14, "'const' variables must be constant value");
+ static final CompileTimeErrorCode CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE = new CompileTimeErrorCode('CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE', 13, "'const' variables must be constant value");
/**
* 12.11.2 Const: It is a compile-time error if evaluation of a constant object results in an
* uncaught exception being thrown.
*/
- static final CompileTimeErrorCode CONST_EVAL_THROWS_EXCEPTION = new CompileTimeErrorCode('CONST_EVAL_THROWS_EXCEPTION', 15, "'const' constructors cannot throw exceptions");
+ static final CompileTimeErrorCode CONST_EVAL_THROWS_EXCEPTION = new CompileTimeErrorCode('CONST_EVAL_THROWS_EXCEPTION', 14, "'const' constructors cannot throw exceptions");
/**
* 12.11.2 Const: If <i>T</i> is a parameterized type <i>S<U<sub>1</sub>, …,
* U<sub>m</sub>></i>, let <i>R = S</i>; It is a compile time error if <i>S</i> is not a
* generic type with <i>m</i> type parameters.
* @param typeName the name of the type being referenced (<i>S</i>)
- * @param argumentCount the number of type arguments provided
* @param parameterCount the number of type parameters that were declared
+ * @param argumentCount the number of type arguments provided
*/
- static final CompileTimeErrorCode CONST_WITH_INVALID_TYPE_PARAMETERS = new CompileTimeErrorCode('CONST_WITH_INVALID_TYPE_PARAMETERS', 16, "The type '%s' is declared with %d type parameters, but %d type arguments were given");
+ static final CompileTimeErrorCode CONST_WITH_INVALID_TYPE_PARAMETERS = new CompileTimeErrorCode('CONST_WITH_INVALID_TYPE_PARAMETERS', 15, "The type '%s' is declared with %d type parameters, but %d type arguments were given");
/**
* 12.11.2 Const: If <i>e</i> is of the form <i>const T(a<sub>1</sub>, …, a<sub>n</sub>,
* x<sub>n+1</sub>: a<sub>n+1</sub>, …, x<sub>n+k</sub>: a<sub>n+k</sub>)</i> it is a
* compile-time error if the type <i>T</i> does not declare a constant constructor with the same
* name as the declaration of <i>T</i>.
*/
- static final CompileTimeErrorCode CONST_WITH_NON_CONST = new CompileTimeErrorCode('CONST_WITH_NON_CONST', 17, "The constructor being called is not a 'const' constructor");
+ static final CompileTimeErrorCode CONST_WITH_NON_CONST = new CompileTimeErrorCode('CONST_WITH_NON_CONST', 16, "The constructor being called is not a 'const' constructor");
/**
* 12.11.2 Const: In all of the above cases, it is a compile-time error if <i>a<sub>i</sub>, 1
* <= i <= n + k</i>, is not a compile-time constant expression.
*/
- static final CompileTimeErrorCode CONST_WITH_NON_CONSTANT_ARGUMENT = new CompileTimeErrorCode('CONST_WITH_NON_CONSTANT_ARGUMENT', 18, "");
+ static final CompileTimeErrorCode CONST_WITH_NON_CONSTANT_ARGUMENT = new CompileTimeErrorCode('CONST_WITH_NON_CONSTANT_ARGUMENT', 17, "");
/**
* 12.11.2 Const: It is a compile-time error if <i>T</i> is not a class accessible in the current
* scope, optionally followed by type arguments.
@@ -448,53 +467,54 @@
* compile-time error if <i>T</i> is not a class accessible in the current scope, optionally
* followed by type arguments.
*/
- static final CompileTimeErrorCode CONST_WITH_NON_TYPE = new CompileTimeErrorCode('CONST_WITH_NON_TYPE', 19, "");
+ static final CompileTimeErrorCode CONST_WITH_NON_TYPE = new CompileTimeErrorCode('CONST_WITH_NON_TYPE', 18, "");
/**
* 12.11.2 Const: It is a compile-time error if <i>T</i> includes any type parameters.
*/
- static final CompileTimeErrorCode CONST_WITH_TYPE_PARAMETERS = new CompileTimeErrorCode('CONST_WITH_TYPE_PARAMETERS', 20, "");
+ static final CompileTimeErrorCode CONST_WITH_TYPE_PARAMETERS = new CompileTimeErrorCode('CONST_WITH_TYPE_PARAMETERS', 19, "");
/**
* 12.11.2 Const: It is a compile-time error if <i>T.id</i> is not the name of a constant
* constructor declared by the type <i>T</i>.
*/
- static final CompileTimeErrorCode CONST_WITH_UNDEFINED_CONSTRUCTOR = new CompileTimeErrorCode('CONST_WITH_UNDEFINED_CONSTRUCTOR', 21, "");
+ static final CompileTimeErrorCode CONST_WITH_UNDEFINED_CONSTRUCTOR = new CompileTimeErrorCode('CONST_WITH_UNDEFINED_CONSTRUCTOR', 20, "");
/**
* 15.3.1 Typedef: It is a compile-time error if any default values are specified in the signature
* of a function type alias.
*/
- static final CompileTimeErrorCode DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS = new CompileTimeErrorCode('DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS', 22, "Default values aren't allowed in typedefs");
+ static final CompileTimeErrorCode DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS = new CompileTimeErrorCode('DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS', 21, "Default values aren't allowed in typedefs");
/**
* 3.1 Scoping: It is a compile-time error if there is more than one entity with the same name
* declared in the same scope.
* @param duplicateName the name of the duplicate entity
*/
- static final CompileTimeErrorCode DUPLICATE_DEFINITION = new CompileTimeErrorCode('DUPLICATE_DEFINITION', 23, "The name '%s' is already defined");
+ static final CompileTimeErrorCode DUPLICATE_DEFINITION = new CompileTimeErrorCode('DUPLICATE_DEFINITION', 22, "The name '%s' is already defined");
/**
* 7 Classes: It is a compile-time error if a class declares two members of the same name.
*/
- static final CompileTimeErrorCode DUPLICATE_MEMBER_NAME = new CompileTimeErrorCode('DUPLICATE_MEMBER_NAME', 24, "");
+ static final CompileTimeErrorCode DUPLICATE_MEMBER_NAME = new CompileTimeErrorCode('DUPLICATE_MEMBER_NAME', 23, "");
/**
* 7 Classes: It is a compile-time error if a class has an instance member and a static member
* with the same name.
*/
- static final CompileTimeErrorCode DUPLICATE_MEMBER_NAME_INSTANCE_STATIC = new CompileTimeErrorCode('DUPLICATE_MEMBER_NAME_INSTANCE_STATIC', 25, "");
+ static final CompileTimeErrorCode DUPLICATE_MEMBER_NAME_INSTANCE_STATIC = new CompileTimeErrorCode('DUPLICATE_MEMBER_NAME_INSTANCE_STATIC', 24, "");
/**
* 12.14.2 Binding Actuals to Formals: It is a compile-time error if <i>q<sub>i</sub> =
* q<sub>j</sub></i> for any <i>i != j</i> [where <i>q<sub>i</sub></i> is the label for a named
* argument].
*/
- static final CompileTimeErrorCode DUPLICATE_NAMED_ARGUMENT = new CompileTimeErrorCode('DUPLICATE_NAMED_ARGUMENT', 26, "");
+ static final CompileTimeErrorCode DUPLICATE_NAMED_ARGUMENT = new CompileTimeErrorCode('DUPLICATE_NAMED_ARGUMENT', 25, "");
/**
* 14.2 Exports: It is a compile-time error if the compilation unit found at the specified URI is
* not a library declaration.
+ * @param uri the uri pointing to a non-library declaration
*/
- static final CompileTimeErrorCode EXPORT_OF_NON_LIBRARY = new CompileTimeErrorCode('EXPORT_OF_NON_LIBRARY', 27, "");
+ static final CompileTimeErrorCode EXPORT_OF_NON_LIBRARY = new CompileTimeErrorCode('EXPORT_OF_NON_LIBRARY', 26, "The exported library '%s' must not have a part-of directive");
/**
* 7.9 Superclasses: It is a compile-time error if the extends clause of a class <i>C</i> includes
* a type expression that does not denote a class available in the lexical scope of <i>C</i>.
* @param typeName the name of the superclass that was not found
*/
- static final CompileTimeErrorCode EXTENDS_NON_CLASS = new CompileTimeErrorCode('EXTENDS_NON_CLASS', 28, "Classes can only extend other classes");
+ static final CompileTimeErrorCode EXTENDS_NON_CLASS = new CompileTimeErrorCode('EXTENDS_NON_CLASS', 27, "Classes can only extend other classes");
/**
* 12.2 Null: It is a compile-time error for a class to attempt to extend or implement Null.
* <p>
@@ -511,7 +531,7 @@
* @param typeName the name of the type that cannot be extended
* @see #IMPLEMENTS_DISALLOWED_CLASS
*/
- static final CompileTimeErrorCode EXTENDS_DISALLOWED_CLASS = new CompileTimeErrorCode('EXTENDS_DISALLOWED_CLASS', 29, "Classes cannot extend '%s'");
+ static final CompileTimeErrorCode EXTENDS_DISALLOWED_CLASS = new CompileTimeErrorCode('EXTENDS_DISALLOWED_CLASS', 28, "Classes cannot extend '%s'");
/**
* 12.2 Null: It is a compile-time error for a class to attempt to extend or implement Null.
* <p>
@@ -528,158 +548,203 @@
* @param typeName the name of the type that cannot be implemented
* @see #EXTENDS_DISALLOWED_CLASS
*/
- static final CompileTimeErrorCode IMPLEMENTS_DISALLOWED_CLASS = new CompileTimeErrorCode('IMPLEMENTS_DISALLOWED_CLASS', 30, "Classes cannot implement '%s'");
+ static final CompileTimeErrorCode IMPLEMENTS_DISALLOWED_CLASS = new CompileTimeErrorCode('IMPLEMENTS_DISALLOWED_CLASS', 29, "Classes cannot implement '%s'");
/**
* 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It is a compile time
* error if more than one initializer corresponding to a given instance variable appears in
* <i>k</i>’s list.
*/
- static final CompileTimeErrorCode FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS = new CompileTimeErrorCode('FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS', 31, "");
+ static final CompileTimeErrorCode FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS = new CompileTimeErrorCode('FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS', 30, "The field '%s' cannot be initialized twice in the same constructor");
/**
* 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It is a compile time
* error if <i>k</i>’s initializer list contains an initializer for a final variable <i>f</i>
* whose declaration includes an initialization expression.
*/
- static final CompileTimeErrorCode FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION = new CompileTimeErrorCode('FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION', 32, "Values cannot be set in the constructor if they are final, and have already been set");
+ static final CompileTimeErrorCode FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION = new CompileTimeErrorCode('FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION', 31, "Values cannot be set in the constructor if they are final, and have already been set");
/**
* 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It is a compile time
* error if <i>k</i>’s initializer list contains an initializer for a variable that is initialized
* by means of an initializing formal of <i>k</i>.
*/
- static final CompileTimeErrorCode FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER = new CompileTimeErrorCode('FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER', 33, "Fields cannot be initialized in both the parameter list and the initializers");
+ static final CompileTimeErrorCode FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER = new CompileTimeErrorCode('FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER', 32, "Fields cannot be initialized in both the parameter list and the initializers");
/**
* 7.6.1 Generative Constructors: It is a compile-time error if an initializing formal is used by
* a function other than a non-redirecting generative constructor.
*/
- static final CompileTimeErrorCode FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR = new CompileTimeErrorCode('FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR', 34, "Initializing formal fields can only be used in constructors");
+ static final CompileTimeErrorCode FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR = new CompileTimeErrorCode('FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR', 33, "Initializing formal fields can only be used in constructors");
/**
* 5 Variables: It is a compile-time error if a final instance variable that has been initialized
* at its point of declaration is also initialized in a constructor.
+ * @param name the name of the field in question
*/
- static final CompileTimeErrorCode FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR = new CompileTimeErrorCode('FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR', 35, "");
+ static final CompileTimeErrorCode FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR = new CompileTimeErrorCode('FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR', 34, "'%s' is final and was given a value when it was declared, so it cannot be set to a new value");
/**
* 5 Variables: It is a compile-time error if a final instance variable that has is initialized by
* means of an initializing formal of a constructor is also initialized elsewhere in the same
* constructor.
+ * @param name the name of the field in question
*/
- static final CompileTimeErrorCode FINAL_INITIALIZED_MULTIPLE_TIMES = new CompileTimeErrorCode('FINAL_INITIALIZED_MULTIPLE_TIMES', 36, "");
+ static final CompileTimeErrorCode FINAL_INITIALIZED_MULTIPLE_TIMES = new CompileTimeErrorCode('FINAL_INITIALIZED_MULTIPLE_TIMES', 35, "'%s' is a final field and so can only be set once");
/**
* 5 Variables: It is a compile-time error if a library, static or local variable <i>v</i> is
* final and <i>v</i> is not initialized at its point of declaration.
+ * @param name the name of the variable in question
*/
- static final CompileTimeErrorCode FINAL_NOT_INITIALIZED = new CompileTimeErrorCode('FINAL_NOT_INITIALIZED', 37, "");
+ static final CompileTimeErrorCode FINAL_NOT_INITIALIZED = new CompileTimeErrorCode('FINAL_NOT_INITIALIZED', 36, "The final variable '%s' must be initialized");
/**
* 7.2 Getters: It is a compile-time error if a class has both a getter and a method with the same
* name.
*/
- static final CompileTimeErrorCode GETTER_AND_METHOD_WITH_SAME_NAME = new CompileTimeErrorCode('GETTER_AND_METHOD_WITH_SAME_NAME', 38, "");
+ static final CompileTimeErrorCode GETTER_AND_METHOD_WITH_SAME_NAME = new CompileTimeErrorCode('GETTER_AND_METHOD_WITH_SAME_NAME', 37, "");
/**
* 7.10 Superinterfaces: It is a compile-time error if the implements clause of a class includes
* type dynamic.
*/
- static final CompileTimeErrorCode IMPLEMENTS_DYNAMIC = new CompileTimeErrorCode('IMPLEMENTS_DYNAMIC', 39, "");
+ static final CompileTimeErrorCode IMPLEMENTS_DYNAMIC = new CompileTimeErrorCode('IMPLEMENTS_DYNAMIC', 38, "Classes cannot implement 'dynamic'");
/**
* 7.10 Superinterfaces: It is a compile-time error if the implements clause of a class <i>C</i>
* includes a type expression that does not denote a class available in the lexical scope of
* <i>C</i>.
* @param typeName the name of the interface that was not found
*/
- static final CompileTimeErrorCode IMPLEMENTS_NON_CLASS = new CompileTimeErrorCode('IMPLEMENTS_NON_CLASS', 40, "Classes can only implement other classes");
+ static final CompileTimeErrorCode IMPLEMENTS_NON_CLASS = new CompileTimeErrorCode('IMPLEMENTS_NON_CLASS', 39, "Classes can only implement other classes");
/**
* 7.10 Superinterfaces: It is a compile-time error if a type <i>T</i> appears more than once in
* the implements clause of a class.
+ * @param name the name of the type in question
*/
- static final CompileTimeErrorCode IMPLEMENTS_REPEATED = new CompileTimeErrorCode('IMPLEMENTS_REPEATED', 41, "");
+ static final CompileTimeErrorCode IMPLEMENTS_REPEATED = new CompileTimeErrorCode('IMPLEMENTS_REPEATED', 40, "'%s' can only be implemented once");
/**
* 7.10 Superinterfaces: It is a compile-time error if the interface of a class <i>C</i> is a
* superinterface of itself.
+ * @param name the name of the type in question
*/
- static final CompileTimeErrorCode IMPLEMENTS_SELF = new CompileTimeErrorCode('IMPLEMENTS_SELF', 42, "");
+ static final CompileTimeErrorCode IMPLEMENTS_SELF = new CompileTimeErrorCode('IMPLEMENTS_SELF', 41, "'%s' cannot implement itself");
/**
* 14.1 Imports: It is a compile-time error to import two different libraries with the same name.
*/
- static final CompileTimeErrorCode IMPORT_DUPLICATED_LIBRARY_NAME = new CompileTimeErrorCode('IMPORT_DUPLICATED_LIBRARY_NAME', 43, "");
+ static final CompileTimeErrorCode IMPORT_DUPLICATED_LIBRARY_NAME = new CompileTimeErrorCode('IMPORT_DUPLICATED_LIBRARY_NAME', 42, "");
/**
* 14.1 Imports: It is a compile-time error if the compilation unit found at the specified URI is
* not a library declaration.
+ * @param uri the uri pointing to a non-library declaration
*/
- static final CompileTimeErrorCode IMPORT_OF_NON_LIBRARY = new CompileTimeErrorCode('IMPORT_OF_NON_LIBRARY', 44, "");
+ static final CompileTimeErrorCode IMPORT_OF_NON_LIBRARY = new CompileTimeErrorCode('IMPORT_OF_NON_LIBRARY', 43, "The imported library '%s' must not have a part-of directive");
/**
* 13.9 Switch: It is a compile-time error if values of the expressions <i>e<sub>k</sub></i> are
* not instances of the same class <i>C</i>, for all <i>1 <= k <= n</i>.
+ * @param expressionSource the expression source code that is the unexpected type
+ * @param expectedType the name of the expected type
*/
- static final CompileTimeErrorCode INCONSITENT_CASE_EXPRESSION_TYPES = new CompileTimeErrorCode('INCONSITENT_CASE_EXPRESSION_TYPES', 45, "");
+ static final CompileTimeErrorCode INCONSISTENT_CASE_EXPRESSION_TYPES = new CompileTimeErrorCode('INCONSISTENT_CASE_EXPRESSION_TYPES', 44, "Case expressions must have the same types, '%s' is not a %s'");
+ /**
+ * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It is a compile-time
+ * error if <i>k</i>'s initializer list contains an initializer for a variable that is not an
+ * instance variable declared in the immediately surrounding class.
+ * @param id the name of the initializing formal that is not an instance variable in the
+ * immediately enclosing class
+ * @see #INITIALIZING_FORMAL_FOR_NON_EXISTANT_FIELD
+ */
+ static final CompileTimeErrorCode INITIALIZER_FOR_NON_EXISTANT_FIELD = new CompileTimeErrorCode('INITIALIZER_FOR_NON_EXISTANT_FIELD', 45, "'%s' is not a variable in the enclosing class");
+ /**
+ * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It is a compile-time
+ * error if <i>k</i>'s initializer list contains an initializer for a variable that is not an
+ * instance variable declared in the immediately surrounding class.
+ * @param id the name of the initializing formal that is a static variable in the immediately
+ * enclosing class
+ * @see #INITIALIZING_FORMAL_FOR_STATIC_FIELD
+ */
+ static final CompileTimeErrorCode INITIALIZER_FOR_STATIC_FIELD = new CompileTimeErrorCode('INITIALIZER_FOR_STATIC_FIELD', 46, "'%s' is a static variable in the enclosing class, variables initialized in a constructor cannot be static");
/**
* 7.6.1 Generative Constructors: An initializing formal has the form <i>this.id</i>. It is a
* compile-time error if <i>id</i> is not the name of an instance variable of the immediately
* enclosing class.
+ * @param id the name of the initializing formal that is not an instance variable in the
+ * immediately enclosing class
+ * @see #INITIALIZING_FORMAL_FOR_STATIC_FIELD
+ * @see #INITIALIZER_FOR_NON_EXISTANT_FIELD
*/
- static final CompileTimeErrorCode INITIALIZER_FOR_NON_EXISTANT_FIELD = new CompileTimeErrorCode('INITIALIZER_FOR_NON_EXISTANT_FIELD', 46, "");
+ static final CompileTimeErrorCode INITIALIZING_FORMAL_FOR_NON_EXISTANT_FIELD = new CompileTimeErrorCode('INITIALIZING_FORMAL_FOR_NON_EXISTANT_FIELD', 47, "'%s' is not a variable in the enclosing class");
+ /**
+ * 7.6.1 Generative Constructors: An initializing formal has the form <i>this.id</i>. It is a
+ * compile-time error if <i>id</i> is not the name of an instance variable of the immediately
+ * enclosing class.
+ * @param id the name of the initializing formal that is a static variable in the immediately
+ * enclosing class
+ * @see #INITIALIZER_FOR_STATIC_FIELD
+ */
+ static final CompileTimeErrorCode INITIALIZING_FORMAL_FOR_STATIC_FIELD = new CompileTimeErrorCode('INITIALIZING_FORMAL_FOR_STATIC_FIELD', 48, "'%s' is a static variable in the enclosing class, variables initialized in a constructor cannot be static");
/**
* TODO(brianwilkerson) Remove this when we have decided on how to report errors in compile-time
* constants. Until then, this acts as a placeholder for more informative errors.
*/
- static final CompileTimeErrorCode INVALID_CONSTANT = new CompileTimeErrorCode('INVALID_CONSTANT', 47, "");
+ static final CompileTimeErrorCode INVALID_CONSTANT = new CompileTimeErrorCode('INVALID_CONSTANT', 49, "");
/**
* 7.6 Constructors: It is a compile-time error if the name of a constructor is not a constructor
* name.
*/
- static final CompileTimeErrorCode INVALID_CONSTRUCTOR_NAME = new CompileTimeErrorCode('INVALID_CONSTRUCTOR_NAME', 48, "");
+ static final CompileTimeErrorCode INVALID_CONSTRUCTOR_NAME = new CompileTimeErrorCode('INVALID_CONSTRUCTOR_NAME', 50, "");
/**
* 7.6.2 Factories: It is a compile-time error if <i>M</i> is not the name of the immediately
* enclosing class.
*/
- static final CompileTimeErrorCode INVALID_FACTORY_NAME_NOT_A_CLASS = new CompileTimeErrorCode('INVALID_FACTORY_NAME_NOT_A_CLASS', 49, "");
+ static final CompileTimeErrorCode INVALID_FACTORY_NAME_NOT_A_CLASS = new CompileTimeErrorCode('INVALID_FACTORY_NAME_NOT_A_CLASS', 51, "");
/**
* 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i> overrides an
* instance member <i>m2</i>, the signature of <i>m2</i> explicitly specifies a default value for
* a formal parameter <i>p</i> and the signature of <i>m1</i> specifies a different default value
* for <i>p</i>.
*/
- static final CompileTimeErrorCode INVALID_OVERRIDE_DEFAULT_VALUE = new CompileTimeErrorCode('INVALID_OVERRIDE_DEFAULT_VALUE', 50, "");
+ static final CompileTimeErrorCode INVALID_OVERRIDE_DEFAULT_VALUE = new CompileTimeErrorCode('INVALID_OVERRIDE_DEFAULT_VALUE', 52, "");
/**
* 7.1: It is a compile-time error if an instance method <i>m1</i> overrides an instance member
* <i>m2</i> and <i>m1</i> does not declare all the named parameters declared by <i>m2</i>.
*/
- static final CompileTimeErrorCode INVALID_OVERRIDE_NAMED = new CompileTimeErrorCode('INVALID_OVERRIDE_NAMED', 51, "");
+ static final CompileTimeErrorCode INVALID_OVERRIDE_NAMED = new CompileTimeErrorCode('INVALID_OVERRIDE_NAMED', 53, "");
/**
* 7.1 Instance Methods: It is a compile-time error if an instance method m1 overrides an instance
* member <i>m2</i> and <i>m1</i> has fewer optional positional parameters than <i>m2</i>.
*/
- static final CompileTimeErrorCode INVALID_OVERRIDE_POSITIONAL = new CompileTimeErrorCode('INVALID_OVERRIDE_POSITIONAL', 52, "");
+ static final CompileTimeErrorCode INVALID_OVERRIDE_POSITIONAL = new CompileTimeErrorCode('INVALID_OVERRIDE_POSITIONAL', 54, "");
/**
* 7.1 Instance Methods: It is a compile-time error if an instance method <i>m1</i> overrides an
* instance member <i>m2</i> and <i>m1</i> has a different number of required parameters than
* <i>m2</i>.
*/
- static final CompileTimeErrorCode INVALID_OVERRIDE_REQUIRED = new CompileTimeErrorCode('INVALID_OVERRIDE_REQUIRED', 53, "");
+ static final CompileTimeErrorCode INVALID_OVERRIDE_REQUIRED = new CompileTimeErrorCode('INVALID_OVERRIDE_REQUIRED', 55, "");
/**
* 12.10 This: It is a compile-time error if this appears in a top-level function or variable
* initializer, in a factory constructor, or in a static method or variable initializer, or in the
* initializer of an instance variable.
*/
- static final CompileTimeErrorCode INVALID_REFERENCE_TO_THIS = new CompileTimeErrorCode('INVALID_REFERENCE_TO_THIS', 54, "");
+ static final CompileTimeErrorCode INVALID_REFERENCE_TO_THIS = new CompileTimeErrorCode('INVALID_REFERENCE_TO_THIS', 56, "");
/**
* 12.7 Maps: It is a compile-time error if the first type argument to a map literal is not
* String.
*/
- static final CompileTimeErrorCode INVALID_TYPE_ARGUMENT_FOR_KEY = new CompileTimeErrorCode('INVALID_TYPE_ARGUMENT_FOR_KEY', 55, "");
+ static final CompileTimeErrorCode INVALID_TYPE_ARGUMENT_FOR_KEY = new CompileTimeErrorCode('INVALID_TYPE_ARGUMENT_FOR_KEY', 57, "The first type argument to a map literal must be 'String'");
/**
* 12.6 Lists: It is a compile time error if the type argument of a constant list literal includes
* a type parameter.
*/
- static final CompileTimeErrorCode INVALID_TYPE_ARGUMENT_IN_CONST_LIST = new CompileTimeErrorCode('INVALID_TYPE_ARGUMENT_IN_CONST_LIST', 56, "");
+ static final CompileTimeErrorCode INVALID_TYPE_ARGUMENT_IN_CONST_LIST = new CompileTimeErrorCode('INVALID_TYPE_ARGUMENT_IN_CONST_LIST', 58, "");
/**
* 12.7 Maps: It is a compile time error if the type arguments of a constant map literal include a
* type parameter.
*/
- static final CompileTimeErrorCode INVALID_TYPE_ARGUMENT_IN_CONST_MAP = new CompileTimeErrorCode('INVALID_TYPE_ARGUMENT_IN_CONST_MAP', 57, "");
+ static final CompileTimeErrorCode INVALID_TYPE_ARGUMENT_IN_CONST_MAP = new CompileTimeErrorCode('INVALID_TYPE_ARGUMENT_IN_CONST_MAP', 59, "");
/**
- * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It is a compile-time
- * error if <i>k</i>'s initializer list contains an initializer for a variable that is not an
- * instance variable declared in the immediately surrounding class.
+ * 14.2 Exports: It is a compile-time error if the compilation unit found at the specified URI is
+ * not a library declaration.
+ * <p>
+ * 14.1 Imports: It is a compile-time error if the compilation unit found at the specified URI is
+ * not a library declaration.
+ * <p>
+ * 14.3 Parts: It is a compile time error if the contents of the URI are not a valid part
+ * declaration.
+ * @param uri the uri pointing to a non-library declaration
*/
- static final CompileTimeErrorCode INVALID_VARIABLE_IN_INITIALIZER = new CompileTimeErrorCode('INVALID_VARIABLE_IN_INITIALIZER', 58, "");
+ static final CompileTimeErrorCode INVALID_URI = new CompileTimeErrorCode('INVALID_URI', 60, "'%s' is not a valid uri");
/**
* 13.13 Break: It is a compile-time error if no such statement <i>s<sub>E</sub></i> exists within
* the innermost function in which <i>s<sub>b</sub></i> occurs.
@@ -688,7 +753,7 @@
* <i>s<sub>E</sub></i> exists within the innermost function in which <i>s<sub>c</sub></i> occurs.
* @param labelName the name of the unresolvable label
*/
- static final CompileTimeErrorCode LABEL_IN_OUTER_SCOPE = new CompileTimeErrorCode('LABEL_IN_OUTER_SCOPE', 59, "Cannot reference label '%s' declared in an outer method");
+ static final CompileTimeErrorCode LABEL_IN_OUTER_SCOPE = new CompileTimeErrorCode('LABEL_IN_OUTER_SCOPE', 61, "Cannot reference label '%s' declared in an outer method");
/**
* 13.13 Break: It is a compile-time error if no such statement <i>s<sub>E</sub></i> exists within
* the innermost function in which <i>s<sub>b</sub></i> occurs.
@@ -697,60 +762,60 @@
* <i>s<sub>E</sub></i> exists within the innermost function in which <i>s<sub>c</sub></i> occurs.
* @param labelName the name of the unresolvable label
*/
- static final CompileTimeErrorCode LABEL_UNDEFINED = new CompileTimeErrorCode('LABEL_UNDEFINED', 60, "Cannot reference undefined label '%s'");
+ static final CompileTimeErrorCode LABEL_UNDEFINED = new CompileTimeErrorCode('LABEL_UNDEFINED', 62, "Cannot reference undefined label '%s'");
/**
* 7 Classes: It is a compile time error if a class <i>C</i> declares a member with the same name
* as <i>C</i>.
*/
- static final CompileTimeErrorCode MEMBER_WITH_CLASS_NAME = new CompileTimeErrorCode('MEMBER_WITH_CLASS_NAME', 61, "");
+ static final CompileTimeErrorCode MEMBER_WITH_CLASS_NAME = new CompileTimeErrorCode('MEMBER_WITH_CLASS_NAME', 63, "");
/**
* 9 Mixins: It is a compile-time error if a declared or derived mixin explicitly declares a
* constructor.
*/
- static final CompileTimeErrorCode MIXIN_DECLARES_CONSTRUCTOR = new CompileTimeErrorCode('MIXIN_DECLARES_CONSTRUCTOR', 62, "");
+ static final CompileTimeErrorCode MIXIN_DECLARES_CONSTRUCTOR = new CompileTimeErrorCode('MIXIN_DECLARES_CONSTRUCTOR', 64, "");
/**
* 9 Mixins: It is a compile-time error if a mixin is derived from a class whose superclass is not
* Object.
*/
- static final CompileTimeErrorCode MIXIN_INHERITS_FROM_NOT_OBJECT = new CompileTimeErrorCode('MIXIN_INHERITS_FROM_NOT_OBJECT', 63, "");
+ static final CompileTimeErrorCode MIXIN_INHERITS_FROM_NOT_OBJECT = new CompileTimeErrorCode('MIXIN_INHERITS_FROM_NOT_OBJECT', 65, "");
/**
* 9.1 Mixin Application: It is a compile-time error if <i>M</i> does not denote a class or mixin
* available in the immediately enclosing scope.
* @param typeName the name of the mixin that was not found
*/
- static final CompileTimeErrorCode MIXIN_OF_NON_CLASS = new CompileTimeErrorCode('MIXIN_OF_NON_CLASS', 64, "Classes can only mixin other classes");
+ static final CompileTimeErrorCode MIXIN_OF_NON_CLASS = new CompileTimeErrorCode('MIXIN_OF_NON_CLASS', 66, "Classes can only mixin other classes");
/**
* 9.1 Mixin Application: If <i>M</i> is a class, it is a compile time error if a well formed
* mixin cannot be derived from <i>M</i>.
*/
- static final CompileTimeErrorCode MIXIN_OF_NON_MIXIN = new CompileTimeErrorCode('MIXIN_OF_NON_MIXIN', 65, "");
+ static final CompileTimeErrorCode MIXIN_OF_NON_MIXIN = new CompileTimeErrorCode('MIXIN_OF_NON_MIXIN', 67, "");
/**
* 9 Mixins: It is a compile-time error if a declared or derived mixin refers to super.
*/
- static final CompileTimeErrorCode MIXIN_REFERENCES_SUPER = new CompileTimeErrorCode('MIXIN_REFERENCES_SUPER', 66, "");
+ static final CompileTimeErrorCode MIXIN_REFERENCES_SUPER = new CompileTimeErrorCode('MIXIN_REFERENCES_SUPER', 68, "");
/**
* 9.1 Mixin Application: It is a compile-time error if <i>S</i> does not denote a class available
* in the immediately enclosing scope.
*/
- static final CompileTimeErrorCode MIXIN_WITH_NON_CLASS_SUPERCLASS = new CompileTimeErrorCode('MIXIN_WITH_NON_CLASS_SUPERCLASS', 67, "");
+ static final CompileTimeErrorCode MIXIN_WITH_NON_CLASS_SUPERCLASS = new CompileTimeErrorCode('MIXIN_WITH_NON_CLASS_SUPERCLASS', 69, "");
/**
* 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. Then <i>k</i> may
* include at most one superinitializer in its initializer list or a compile time error occurs.
*/
- static final CompileTimeErrorCode MULTIPLE_SUPER_INITIALIZERS = new CompileTimeErrorCode('MULTIPLE_SUPER_INITIALIZERS', 68, "");
+ static final CompileTimeErrorCode MULTIPLE_SUPER_INITIALIZERS = new CompileTimeErrorCode('MULTIPLE_SUPER_INITIALIZERS', 70, "");
/**
* 12.11.1 New: It is a compile time error if <i>S</i> is not a generic type with <i>m</i> type
* parameters.
* @param typeName the name of the type being referenced (<i>S</i>)
- * @param argumentCount the number of type arguments provided
* @param parameterCount the number of type parameters that were declared
+ * @param argumentCount the number of type arguments provided
*/
- static final CompileTimeErrorCode NEW_WITH_INVALID_TYPE_PARAMETERS = new CompileTimeErrorCode('NEW_WITH_INVALID_TYPE_PARAMETERS', 69, "The type '%s' is declared with %d type parameters, but %d type arguments were given");
+ static final CompileTimeErrorCode NEW_WITH_INVALID_TYPE_PARAMETERS = new CompileTimeErrorCode('NEW_WITH_INVALID_TYPE_PARAMETERS', 71, "The type '%s' is declared with %d type parameters, but %d type arguments were given");
/**
* 13.2 Expression Statements: It is a compile-time error if a non-constant map literal that has
* no explicit type arguments appears in a place where a statement is expected.
*/
- static final CompileTimeErrorCode NON_CONST_MAP_AS_EXPRESSION_STATEMENT = new CompileTimeErrorCode('NON_CONST_MAP_AS_EXPRESSION_STATEMENT', 70, "");
+ static final CompileTimeErrorCode NON_CONST_MAP_AS_EXPRESSION_STATEMENT = new CompileTimeErrorCode('NON_CONST_MAP_AS_EXPRESSION_STATEMENT', 72, "");
/**
* 13.9 Switch: Given a switch statement of the form <i>switch (e) { label<sub>11</sub> …
* label<sub>1j1</sub> case e<sub>1</sub>: s<sub>1</sub> … label<sub>n1</sub> …
@@ -760,121 +825,122 @@
* s<sub>n</sub>}</i>, it is a compile-time error if the expressions <i>e<sub>k</sub></i> are not
* compile-time constants, for all <i>1 <= k <= n</i>.
*/
- static final CompileTimeErrorCode NON_CONSTANT_CASE_EXPRESSION = new CompileTimeErrorCode('NON_CONSTANT_CASE_EXPRESSION', 71, "Case expressions must be constant");
+ static final CompileTimeErrorCode NON_CONSTANT_CASE_EXPRESSION = new CompileTimeErrorCode('NON_CONSTANT_CASE_EXPRESSION', 73, "Case expressions must be constant");
/**
* 6.2.2 Optional Formals: It is a compile-time error if the default value of an optional
* parameter is not a compile-time constant.
*/
- static final CompileTimeErrorCode NON_CONSTANT_DEFAULT_VALUE = new CompileTimeErrorCode('NON_CONSTANT_DEFAULT_VALUE', 72, "Default values of an optional parameter must be constant");
+ static final CompileTimeErrorCode NON_CONSTANT_DEFAULT_VALUE = new CompileTimeErrorCode('NON_CONSTANT_DEFAULT_VALUE', 74, "Default values of an optional parameter must be constant");
/**
* 12.6 Lists: It is a compile time error if an element of a constant list literal is not a
* compile-time constant.
*/
- static final CompileTimeErrorCode NON_CONSTANT_LIST_ELEMENT = new CompileTimeErrorCode('NON_CONSTANT_LIST_ELEMENT', 73, "'const' lists must have all constant values");
+ static final CompileTimeErrorCode NON_CONSTANT_LIST_ELEMENT = new CompileTimeErrorCode('NON_CONSTANT_LIST_ELEMENT', 75, "'const' lists must have all constant values");
/**
* 12.7 Maps: It is a compile time error if either a key or a value of an entry in a constant map
* literal is not a compile-time constant.
*/
- static final CompileTimeErrorCode NON_CONSTANT_MAP_KEY = new CompileTimeErrorCode('NON_CONSTANT_MAP_KEY', 74, "The keys in a map must be constant");
+ static final CompileTimeErrorCode NON_CONSTANT_MAP_KEY = new CompileTimeErrorCode('NON_CONSTANT_MAP_KEY', 76, "The keys in a map must be constant");
/**
* 12.7 Maps: It is a compile time error if either a key or a value of an entry in a constant map
* literal is not a compile-time constant.
*/
- static final CompileTimeErrorCode NON_CONSTANT_MAP_VALUE = new CompileTimeErrorCode('NON_CONSTANT_MAP_VALUE', 75, "The values in a 'const' map must be constant");
+ static final CompileTimeErrorCode NON_CONSTANT_MAP_VALUE = new CompileTimeErrorCode('NON_CONSTANT_MAP_VALUE', 77, "The values in a 'const' map must be constant");
/**
* 7.6.3 Constant Constructors: Any expression that appears within the initializer list of a
* constant constructor must be a potentially constant expression, or a compile-time error occurs.
*/
- static final CompileTimeErrorCode NON_CONSTANT_VALUE_IN_INITIALIZER = new CompileTimeErrorCode('NON_CONSTANT_VALUE_IN_INITIALIZER', 76, "");
+ static final CompileTimeErrorCode NON_CONSTANT_VALUE_IN_INITIALIZER = new CompileTimeErrorCode('NON_CONSTANT_VALUE_IN_INITIALIZER', 78, "");
/**
* 7.9 Superclasses: It is a compile-time error to specify an extends clause for class Object.
*/
- static final CompileTimeErrorCode OBJECT_CANNOT_EXTEND_ANOTHER_CLASS = new CompileTimeErrorCode('OBJECT_CANNOT_EXTEND_ANOTHER_CLASS', 77, "");
+ static final CompileTimeErrorCode OBJECT_CANNOT_EXTEND_ANOTHER_CLASS = new CompileTimeErrorCode('OBJECT_CANNOT_EXTEND_ANOTHER_CLASS', 79, "");
/**
* 7.1.1 Operators: It is a compile-time error to declare an optional parameter in an operator.
*/
- static final CompileTimeErrorCode OPTIONAL_PARAMETER_IN_OPERATOR = new CompileTimeErrorCode('OPTIONAL_PARAMETER_IN_OPERATOR', 78, "");
+ static final CompileTimeErrorCode OPTIONAL_PARAMETER_IN_OPERATOR = new CompileTimeErrorCode('OPTIONAL_PARAMETER_IN_OPERATOR', 80, "");
/**
* 8 Interfaces: It is a compile-time error if an interface member <i>m1</i> overrides an
* interface member <i>m2</i> and <i>m1</i> does not declare all the named parameters declared by
* <i>m2</i> in the same order.
*/
- static final CompileTimeErrorCode OVERRIDE_MISSING_NAMED_PARAMETERS = new CompileTimeErrorCode('OVERRIDE_MISSING_NAMED_PARAMETERS', 79, "");
+ static final CompileTimeErrorCode OVERRIDE_MISSING_NAMED_PARAMETERS = new CompileTimeErrorCode('OVERRIDE_MISSING_NAMED_PARAMETERS', 81, "");
/**
* 8 Interfaces: It is a compile-time error if an interface member <i>m1</i> overrides an
* interface member <i>m2</i> and <i>m1</i> has a different number of required parameters than
* <i>m2</i>.
*/
- static final CompileTimeErrorCode OVERRIDE_MISSING_REQUIRED_PARAMETERS = new CompileTimeErrorCode('OVERRIDE_MISSING_REQUIRED_PARAMETERS', 80, "");
+ static final CompileTimeErrorCode OVERRIDE_MISSING_REQUIRED_PARAMETERS = new CompileTimeErrorCode('OVERRIDE_MISSING_REQUIRED_PARAMETERS', 82, "");
/**
* 14.3 Parts: It is a compile time error if the contents of the URI are not a valid part
* declaration.
+ * @param uri the uri pointing to a non-library declaration
*/
- static final CompileTimeErrorCode PART_OF_NON_PART = new CompileTimeErrorCode('PART_OF_NON_PART', 81, "");
+ static final CompileTimeErrorCode PART_OF_NON_PART = new CompileTimeErrorCode('PART_OF_NON_PART', 83, "The included part '%s' must have a part-of directive");
/**
* 14.1 Imports: It is a compile-time error if the current library declares a top-level member
* named <i>p</i>.
*/
- static final CompileTimeErrorCode PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER = new CompileTimeErrorCode('PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER', 82, "");
+ static final CompileTimeErrorCode PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER = new CompileTimeErrorCode('PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER', 84, "");
/**
* 6.2.2 Optional Formals: It is a compile-time error if the name of a named optional parameter
* begins with an ‘_’ character.
*/
- static final CompileTimeErrorCode PRIVATE_OPTIONAL_PARAMETER = new CompileTimeErrorCode('PRIVATE_OPTIONAL_PARAMETER', 83, "");
+ static final CompileTimeErrorCode PRIVATE_OPTIONAL_PARAMETER = new CompileTimeErrorCode('PRIVATE_OPTIONAL_PARAMETER', 85, "");
/**
* 12.1 Constants: It is a compile-time error if the value of a compile-time constant expression
* depends on itself.
*/
- static final CompileTimeErrorCode RECURSIVE_COMPILE_TIME_CONSTANT = new CompileTimeErrorCode('RECURSIVE_COMPILE_TIME_CONSTANT', 84, "");
+ static final CompileTimeErrorCode RECURSIVE_COMPILE_TIME_CONSTANT = new CompileTimeErrorCode('RECURSIVE_COMPILE_TIME_CONSTANT', 86, "");
/**
* 7.6.2 Factories: It is a compile-time error if a redirecting factory constructor redirects to
* itself, either directly or indirectly via a sequence of redirections.
*/
- static final CompileTimeErrorCode RECURSIVE_FACTORY_REDIRECT = new CompileTimeErrorCode('RECURSIVE_FACTORY_REDIRECT', 85, "");
+ static final CompileTimeErrorCode RECURSIVE_FACTORY_REDIRECT = new CompileTimeErrorCode('RECURSIVE_FACTORY_REDIRECT', 87, "");
/**
* 15.3.1 Typedef: It is a compile-time error if a typedef refers to itself via a chain of
* references that does not include a class type.
*/
- static final CompileTimeErrorCode RECURSIVE_FUNCTION_TYPE_ALIAS = new CompileTimeErrorCode('RECURSIVE_FUNCTION_TYPE_ALIAS', 86, "");
+ static final CompileTimeErrorCode RECURSIVE_FUNCTION_TYPE_ALIAS = new CompileTimeErrorCode('RECURSIVE_FUNCTION_TYPE_ALIAS', 88, "");
/**
* 8.1 Superinterfaces: It is a compile-time error if an interface is a superinterface of itself.
*/
- static final CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE = new CompileTimeErrorCode('RECURSIVE_INTERFACE_INHERITANCE', 87, "");
+ static final CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE = new CompileTimeErrorCode('RECURSIVE_INTERFACE_INHERITANCE', 89, "");
/**
* 7.6.2 Factories: It is a compile-time error if <i>k</i> is prefixed with the const modifier but
* <i>k’</i> is not a constant constructor.
*/
- static final CompileTimeErrorCode REDIRECT_TO_NON_CONST_CONSTRUCTOR = new CompileTimeErrorCode('REDIRECT_TO_NON_CONST_CONSTRUCTOR', 88, "");
+ static final CompileTimeErrorCode REDIRECT_TO_NON_CONST_CONSTRUCTOR = new CompileTimeErrorCode('REDIRECT_TO_NON_CONST_CONSTRUCTOR', 90, "");
/**
* 13.3 Local Variable Declaration: It is a compile-time error if <i>e</i> refers to the name
* <i>v</i> or the name <i>v=</i>.
*/
- static final CompileTimeErrorCode REFERENCE_TO_DECLARED_VARIABLE_IN_INITIALIZER = new CompileTimeErrorCode('REFERENCE_TO_DECLARED_VARIABLE_IN_INITIALIZER', 89, "");
+ static final CompileTimeErrorCode REFERENCE_TO_DECLARED_VARIABLE_IN_INITIALIZER = new CompileTimeErrorCode('REFERENCE_TO_DECLARED_VARIABLE_IN_INITIALIZER', 91, "");
/**
* 16.1.1 Reserved Words: A reserved word may not be used as an identifier; it is a compile-time
* error if a reserved word is used where an identifier is expected.
*/
- static final CompileTimeErrorCode RESERVED_WORD_AS_IDENTIFIER = new CompileTimeErrorCode('RESERVED_WORD_AS_IDENTIFIER', 90, "");
+ static final CompileTimeErrorCode RESERVED_WORD_AS_IDENTIFIER = new CompileTimeErrorCode('RESERVED_WORD_AS_IDENTIFIER', 92, "");
/**
* 12.8.1 Rethrow: It is a compile-time error if an expression of the form <i>rethrow;</i> is not
* enclosed within a on-catch clause.
*/
- static final CompileTimeErrorCode RETHROW_OUTSIDE_CATCH = new CompileTimeErrorCode('RETHROW_OUTSIDE_CATCH', 91, "rethrow must be inside of a catch clause");
+ static final CompileTimeErrorCode RETHROW_OUTSIDE_CATCH = new CompileTimeErrorCode('RETHROW_OUTSIDE_CATCH', 93, "rethrow must be inside of a catch clause");
/**
* 13.11 Return: It is a compile-time error if a return statement of the form <i>return e;</i>
* appears in a generative constructor.
*/
- static final CompileTimeErrorCode RETURN_IN_GENERATIVE_CONSTRUCTOR = new CompileTimeErrorCode('RETURN_IN_GENERATIVE_CONSTRUCTOR', 92, "");
+ static final CompileTimeErrorCode RETURN_IN_GENERATIVE_CONSTRUCTOR = new CompileTimeErrorCode('RETURN_IN_GENERATIVE_CONSTRUCTOR', 94, "");
/**
* 6.1 Function Declarations: It is a compile-time error to preface a function declaration with
* the built-in identifier static.
*/
- static final CompileTimeErrorCode STATIC_TOP_LEVEL_FUNCTION = new CompileTimeErrorCode('STATIC_TOP_LEVEL_FUNCTION', 93, "");
+ static final CompileTimeErrorCode STATIC_TOP_LEVEL_FUNCTION = new CompileTimeErrorCode('STATIC_TOP_LEVEL_FUNCTION', 95, "");
/**
* 5 Variables: It is a compile-time error to preface a top level variable declaration with the
* built-in identifier static.
*/
- static final CompileTimeErrorCode STATIC_TOP_LEVEL_VARIABLE = new CompileTimeErrorCode('STATIC_TOP_LEVEL_VARIABLE', 94, "");
+ static final CompileTimeErrorCode STATIC_TOP_LEVEL_VARIABLE = new CompileTimeErrorCode('STATIC_TOP_LEVEL_VARIABLE', 96, "");
/**
* 12.15.4 Super Invocation: A super method invocation <i>i</i> has the form
* <i>super.m(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n+1</sub>, …
@@ -883,12 +949,12 @@
* initializer list, in class Object, in a factory constructor, or in a static method or variable
* initializer.
*/
- static final CompileTimeErrorCode SUPER_IN_INVALID_CONTEXT = new CompileTimeErrorCode('SUPER_IN_INVALID_CONTEXT', 95, "");
+ static final CompileTimeErrorCode SUPER_IN_INVALID_CONTEXT = new CompileTimeErrorCode('SUPER_IN_INVALID_CONTEXT', 97, "");
/**
* 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It is a compile-time
* error if a generative constructor of class Object includes a superinitializer.
*/
- static final CompileTimeErrorCode SUPER_INITIALIZER_IN_OBJECT = new CompileTimeErrorCode('SUPER_INITIALIZER_IN_OBJECT', 96, "");
+ static final CompileTimeErrorCode SUPER_INITIALIZER_IN_OBJECT = new CompileTimeErrorCode('SUPER_INITIALIZER_IN_OBJECT', 98, "");
/**
* 12.11 Instance Creation: It is a compile-time error if a constructor of a non-generic type
* invoked by a new expression or a constant object expression is passed any type arguments.
@@ -897,14 +963,14 @@
* <i>G<T<sub>1</sub>, …, T<sub>n</sub>></i> and <i>G</i> is not a generic type with
* <i>n</i> type parameters.
*/
- static final CompileTimeErrorCode TYPE_ARGUMENTS_FOR_NON_GENERIC_CLASS = new CompileTimeErrorCode('TYPE_ARGUMENTS_FOR_NON_GENERIC_CLASS', 97, "");
+ static final CompileTimeErrorCode TYPE_ARGUMENTS_FOR_NON_GENERIC_CLASS = new CompileTimeErrorCode('TYPE_ARGUMENTS_FOR_NON_GENERIC_CLASS', 99, "");
/**
* 7.6.1 Generative Constructors: Let <i>C</i> be the class in which the superinitializer appears
* and let <i>S</i> be the superclass of <i>C</i>. Let <i>k</i> be a generative constructor. It is
* a compile-time error if class <i>S</i> does not declare a generative constructor named <i>S</i>
* (respectively <i>S.id</i>)
*/
- static final CompileTimeErrorCode UNDEFINED_CONSTRUCTOR_IN_INITIALIZER = new CompileTimeErrorCode('UNDEFINED_CONSTRUCTOR_IN_INITIALIZER', 98, "");
+ static final CompileTimeErrorCode UNDEFINED_CONSTRUCTOR_IN_INITIALIZER = new CompileTimeErrorCode('UNDEFINED_CONSTRUCTOR_IN_INITIALIZER', 100, "");
/**
* 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. Each final instance
* variable <i>f</i> declared in the immediately enclosing class must have an initializer in
@@ -916,7 +982,7 @@
* </ol>
* or a compile-time error occurs.
*/
- static final CompileTimeErrorCode UNINITIALIZED_FINAL_FIELD = new CompileTimeErrorCode('UNINITIALIZED_FINAL_FIELD', 99, "");
+ static final CompileTimeErrorCode UNINITIALIZED_FINAL_FIELD = new CompileTimeErrorCode('UNINITIALIZED_FINAL_FIELD', 101, "");
/**
* 14.1 Imports: It is a compile-time error if <i>x</i> is not a compile-time constant, or if
* <i>x</i> involves string interpolation.
@@ -927,7 +993,7 @@
* 14.5 URIs: It is a compile-time error if the string literal <i>x</i> that describes a URI is
* not a compile-time constant, or if <i>x</i> involves string interpolation.
*/
- static final CompileTimeErrorCode URI_WITH_INTERPOLATION = new CompileTimeErrorCode('URI_WITH_INTERPOLATION', 100, "URIs cannot use string interpolation");
+ static final CompileTimeErrorCode URI_WITH_INTERPOLATION = new CompileTimeErrorCode('URI_WITH_INTERPOLATION', 102, "URIs cannot use string interpolation");
/**
* 7.1.1 Operators: It is a compile-time error if the arity of the user-declared operator []= is
* not 2. It is a compile time error if the arity of a user-declared operator with one of the
@@ -935,12 +1001,12 @@
* It is a compile time error if the arity of the user-declared operator - is not 0 or 1. It is a
* compile time error if the arity of the user-declared operator ~ is not 0.
*/
- static final CompileTimeErrorCode WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR = new CompileTimeErrorCode('WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR', 101, "");
+ static final CompileTimeErrorCode WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR = new CompileTimeErrorCode('WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR', 103, "");
/**
* 7.3 Setters: It is a compile-time error if a setter’s formal parameter list does not include
* exactly one required formal parameter <i>p</i>.
*/
- static final CompileTimeErrorCode WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER = new CompileTimeErrorCode('WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER', 102, "");
+ static final CompileTimeErrorCode WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER = new CompileTimeErrorCode('WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER', 104, "");
/**
* 12.11 Instance Creation: It is a compile-time error if a constructor of a generic type with
* <i>n</i> type parameters invoked by a new expression or a constant object expression is passed
@@ -950,8 +1016,8 @@
* <i>G<T<sub>1</sub>, …, T<sub>n</sub>></i> and <i>G</i> is not a generic type with
* <i>n</i> type parameters.
*/
- static final CompileTimeErrorCode WRONG_NUMBER_OF_TYPE_ARGUMENTS = new CompileTimeErrorCode('WRONG_NUMBER_OF_TYPE_ARGUMENTS', 103, "");
- static final List<CompileTimeErrorCode> values = [AMBIGUOUS_EXPORT, AMBIGUOUS_IMPORT, ARGUMENT_DEFINITION_TEST_NON_PARAMETER, BUILT_IN_IDENTIFIER_AS_TYPE, BUILT_IN_IDENTIFIER_AS_TYPE_NAME, BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME, BUILT_IN_IDENTIFIER_AS_TYPE_VARIABLE_NAME, CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS, COMPILE_TIME_CONSTANT_RAISES_EXCEPTION, COMPILE_TIME_CONSTANT_RAISES_EXCEPTION_DIVIDE_BY_ZERO, CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD, CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD, CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD, CONST_FORMAL_PARAMETER, CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE, CONST_EVAL_THROWS_EXCEPTION, CONST_WITH_INVALID_TYPE_PARAMETERS, CONST_WITH_NON_CONST, CONST_WITH_NON_CONSTANT_ARGUMENT, CONST_WITH_NON_TYPE, CONST_WITH_TYPE_PARAMETERS, CONST_WITH_UNDEFINED_CONSTRUCTOR, DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS, DUPLICATE_DEFINITION, DUPLICATE_MEMBER_NAME, DUPLICATE_MEMBER_NAME_INSTANCE_STATIC, DUPLICATE_NAMED_ARGUMENT, EXPORT_OF_NON_LIBRARY, EXTENDS_NON_CLASS, EXTENDS_DISALLOWED_CLASS, IMPLEMENTS_DISALLOWED_CLASS, FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS, FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION, FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER, FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR, FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR, FINAL_INITIALIZED_MULTIPLE_TIMES, FINAL_NOT_INITIALIZED, GETTER_AND_METHOD_WITH_SAME_NAME, IMPLEMENTS_DYNAMIC, IMPLEMENTS_NON_CLASS, IMPLEMENTS_REPEATED, IMPLEMENTS_SELF, IMPORT_DUPLICATED_LIBRARY_NAME, IMPORT_OF_NON_LIBRARY, INCONSITENT_CASE_EXPRESSION_TYPES, INITIALIZER_FOR_NON_EXISTANT_FIELD, INVALID_CONSTANT, INVALID_CONSTRUCTOR_NAME, INVALID_FACTORY_NAME_NOT_A_CLASS, INVALID_OVERRIDE_DEFAULT_VALUE, INVALID_OVERRIDE_NAMED, INVALID_OVERRIDE_POSITIONAL, INVALID_OVERRIDE_REQUIRED, INVALID_REFERENCE_TO_THIS, INVALID_TYPE_ARGUMENT_FOR_KEY, INVALID_TYPE_ARGUMENT_IN_CONST_LIST, INVALID_TYPE_ARGUMENT_IN_CONST_MAP, INVALID_VARIABLE_IN_INITIALIZER, LABEL_IN_OUTER_SCOPE, LABEL_UNDEFINED, MEMBER_WITH_CLASS_NAME, MIXIN_DECLARES_CONSTRUCTOR, MIXIN_INHERITS_FROM_NOT_OBJECT, MIXIN_OF_NON_CLASS, MIXIN_OF_NON_MIXIN, MIXIN_REFERENCES_SUPER, MIXIN_WITH_NON_CLASS_SUPERCLASS, MULTIPLE_SUPER_INITIALIZERS, NEW_WITH_INVALID_TYPE_PARAMETERS, NON_CONST_MAP_AS_EXPRESSION_STATEMENT, NON_CONSTANT_CASE_EXPRESSION, NON_CONSTANT_DEFAULT_VALUE, NON_CONSTANT_LIST_ELEMENT, NON_CONSTANT_MAP_KEY, NON_CONSTANT_MAP_VALUE, NON_CONSTANT_VALUE_IN_INITIALIZER, OBJECT_CANNOT_EXTEND_ANOTHER_CLASS, OPTIONAL_PARAMETER_IN_OPERATOR, OVERRIDE_MISSING_NAMED_PARAMETERS, OVERRIDE_MISSING_REQUIRED_PARAMETERS, PART_OF_NON_PART, PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER, PRIVATE_OPTIONAL_PARAMETER, RECURSIVE_COMPILE_TIME_CONSTANT, RECURSIVE_FACTORY_REDIRECT, RECURSIVE_FUNCTION_TYPE_ALIAS, RECURSIVE_INTERFACE_INHERITANCE, REDIRECT_TO_NON_CONST_CONSTRUCTOR, REFERENCE_TO_DECLARED_VARIABLE_IN_INITIALIZER, RESERVED_WORD_AS_IDENTIFIER, RETHROW_OUTSIDE_CATCH, RETURN_IN_GENERATIVE_CONSTRUCTOR, STATIC_TOP_LEVEL_FUNCTION, STATIC_TOP_LEVEL_VARIABLE, SUPER_IN_INVALID_CONTEXT, SUPER_INITIALIZER_IN_OBJECT, TYPE_ARGUMENTS_FOR_NON_GENERIC_CLASS, UNDEFINED_CONSTRUCTOR_IN_INITIALIZER, UNINITIALIZED_FINAL_FIELD, URI_WITH_INTERPOLATION, WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR, WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER, WRONG_NUMBER_OF_TYPE_ARGUMENTS];
+ static final CompileTimeErrorCode WRONG_NUMBER_OF_TYPE_ARGUMENTS = new CompileTimeErrorCode('WRONG_NUMBER_OF_TYPE_ARGUMENTS', 105, "");
+ static final List<CompileTimeErrorCode> values = [AMBIGUOUS_EXPORT, AMBIGUOUS_IMPORT, ARGUMENT_DEFINITION_TEST_NON_PARAMETER, BUILT_IN_IDENTIFIER_AS_TYPE, BUILT_IN_IDENTIFIER_AS_TYPE_NAME, BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME, BUILT_IN_IDENTIFIER_AS_TYPE_VARIABLE_NAME, CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS, COMPILE_TIME_CONSTANT_RAISES_EXCEPTION, CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD, CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD, CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD, CONST_FORMAL_PARAMETER, CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE, CONST_EVAL_THROWS_EXCEPTION, CONST_WITH_INVALID_TYPE_PARAMETERS, CONST_WITH_NON_CONST, CONST_WITH_NON_CONSTANT_ARGUMENT, CONST_WITH_NON_TYPE, CONST_WITH_TYPE_PARAMETERS, CONST_WITH_UNDEFINED_CONSTRUCTOR, DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS, DUPLICATE_DEFINITION, DUPLICATE_MEMBER_NAME, DUPLICATE_MEMBER_NAME_INSTANCE_STATIC, DUPLICATE_NAMED_ARGUMENT, EXPORT_OF_NON_LIBRARY, EXTENDS_NON_CLASS, EXTENDS_DISALLOWED_CLASS, IMPLEMENTS_DISALLOWED_CLASS, FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS, FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION, FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER, FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR, FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR, FINAL_INITIALIZED_MULTIPLE_TIMES, FINAL_NOT_INITIALIZED, GETTER_AND_METHOD_WITH_SAME_NAME, IMPLEMENTS_DYNAMIC, IMPLEMENTS_NON_CLASS, IMPLEMENTS_REPEATED, IMPLEMENTS_SELF, IMPORT_DUPLICATED_LIBRARY_NAME, IMPORT_OF_NON_LIBRARY, INCONSISTENT_CASE_EXPRESSION_TYPES, INITIALIZER_FOR_NON_EXISTANT_FIELD, INITIALIZER_FOR_STATIC_FIELD, INITIALIZING_FORMAL_FOR_NON_EXISTANT_FIELD, INITIALIZING_FORMAL_FOR_STATIC_FIELD, INVALID_CONSTANT, INVALID_CONSTRUCTOR_NAME, INVALID_FACTORY_NAME_NOT_A_CLASS, INVALID_OVERRIDE_DEFAULT_VALUE, INVALID_OVERRIDE_NAMED, INVALID_OVERRIDE_POSITIONAL, INVALID_OVERRIDE_REQUIRED, INVALID_REFERENCE_TO_THIS, INVALID_TYPE_ARGUMENT_FOR_KEY, INVALID_TYPE_ARGUMENT_IN_CONST_LIST, INVALID_TYPE_ARGUMENT_IN_CONST_MAP, INVALID_URI, LABEL_IN_OUTER_SCOPE, LABEL_UNDEFINED, MEMBER_WITH_CLASS_NAME, MIXIN_DECLARES_CONSTRUCTOR, MIXIN_INHERITS_FROM_NOT_OBJECT, MIXIN_OF_NON_CLASS, MIXIN_OF_NON_MIXIN, MIXIN_REFERENCES_SUPER, MIXIN_WITH_NON_CLASS_SUPERCLASS, MULTIPLE_SUPER_INITIALIZERS, NEW_WITH_INVALID_TYPE_PARAMETERS, NON_CONST_MAP_AS_EXPRESSION_STATEMENT, NON_CONSTANT_CASE_EXPRESSION, NON_CONSTANT_DEFAULT_VALUE, NON_CONSTANT_LIST_ELEMENT, NON_CONSTANT_MAP_KEY, NON_CONSTANT_MAP_VALUE, NON_CONSTANT_VALUE_IN_INITIALIZER, OBJECT_CANNOT_EXTEND_ANOTHER_CLASS, OPTIONAL_PARAMETER_IN_OPERATOR, OVERRIDE_MISSING_NAMED_PARAMETERS, OVERRIDE_MISSING_REQUIRED_PARAMETERS, PART_OF_NON_PART, PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER, PRIVATE_OPTIONAL_PARAMETER, RECURSIVE_COMPILE_TIME_CONSTANT, RECURSIVE_FACTORY_REDIRECT, RECURSIVE_FUNCTION_TYPE_ALIAS, RECURSIVE_INTERFACE_INHERITANCE, REDIRECT_TO_NON_CONST_CONSTRUCTOR, REFERENCE_TO_DECLARED_VARIABLE_IN_INITIALIZER, RESERVED_WORD_AS_IDENTIFIER, RETHROW_OUTSIDE_CATCH, RETURN_IN_GENERATIVE_CONSTRUCTOR, STATIC_TOP_LEVEL_FUNCTION, STATIC_TOP_LEVEL_VARIABLE, SUPER_IN_INVALID_CONTEXT, SUPER_INITIALIZER_IN_OBJECT, TYPE_ARGUMENTS_FOR_NON_GENERIC_CLASS, UNDEFINED_CONSTRUCTOR_IN_INITIALIZER, UNINITIALIZED_FINAL_FIELD, URI_WITH_INTERPOLATION, WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR, WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER, WRONG_NUMBER_OF_TYPE_ARGUMENTS];
final String __name;
final int __ordinal;
int get ordinal => __ordinal;
@@ -970,6 +1036,7 @@
String get message => _message;
ErrorType get type => ErrorType.COMPILE_TIME_ERROR;
bool needsRecompilation() => true;
+ int compareTo(CompileTimeErrorCode other) => __ordinal - other.__ordinal;
String toString() => __name;
}
/**
@@ -979,7 +1046,7 @@
* appropriate, how the problem can be corrected.
* @coverage dart.engine.error
*/
-class StaticWarningCode implements ErrorCode {
+class StaticWarningCode implements Comparable<StaticWarningCode>, ErrorCode {
/**
* 12.11.1 New: It is a static warning if the static type of <i>a<sub>i</sub>, 1 <= i <= n+
* k</i> may not be assigned to the type of the corresponding formal parameter of the constructor
@@ -1243,20 +1310,31 @@
* x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. It is a static warning if <i>C</i> does not denote a
* class in the current scope.
*/
- static final StaticWarningCode UNDEFINED_CLASS = new StaticWarningCode('UNDEFINED_CLASS', 42, "");
+ static final StaticWarningCode UNDEFINED_CLASS = new StaticWarningCode('UNDEFINED_CLASS', 42, "Undefined class '%s'");
/**
* 12.17 Getter Invocation: It is a static warning if there is no class <i>C</i> in the enclosing
* lexical scope of <i>i</i>, or if <i>C</i> does not declare, implicitly or explicitly, a getter
* named <i>m</i>.
+ * @param getterName the name of the getter
+ * @param enclosingType the name of the enclosing type where the getter is being looked for
*/
- static final StaticWarningCode UNDEFINED_GETTER = new StaticWarningCode('UNDEFINED_GETTER', 43, "");
+ static final StaticWarningCode UNDEFINED_GETTER = new StaticWarningCode('UNDEFINED_GETTER', 43, "There is no such getter '%s' in '%s'");
/**
* 12.30 Identifier Reference: It is as static warning if an identifier expression of the form
* <i>id</i> occurs inside a top level or static function (be it function, method, getter, or
* setter) or variable initializer and there is no declaration <i>d</i> with name <i>id</i> in the
* lexical scope enclosing the expression.
*/
- static final StaticWarningCode UNDEFINED_IDENTIFIER = new StaticWarningCode('UNDEFINED_IDENTIFIER', 44, "");
+ static final StaticWarningCode UNDEFINED_IDENTIFIER = new StaticWarningCode('UNDEFINED_IDENTIFIER', 44, "Undefined name '%s'");
+ /**
+ * 12.30 Identifier Reference: It is as static warning if an identifier expression of the form
+ * <i>id</i> occurs inside a top level or static function (be it function, method, getter, or
+ * setter) or variable initializer and there is no declaration <i>d</i> with name <i>id</i> in the
+ * lexical scope enclosing the expression.
+ * @param operator the name of the operator
+ * @param enclosingType the name of the enclosing type where the operator is being looked for
+ */
+ static final StaticWarningCode UNDEFINED_OPERATOR = new StaticWarningCode('UNDEFINED_OPERATOR', 45, "There is no such operator '%s' in '%s'");
/**
* 12.18 Assignment: It is as static warning if an assignment of the form <i>v = e</i> occurs
* inside a top level or static function (be it function, method, getter, or setter) or variable
@@ -1266,14 +1344,18 @@
* 12.18 Assignment: It is a static warning if there is no class <i>C</i> in the enclosing lexical
* scope of the assignment, or if <i>C</i> does not declare, implicitly or explicitly, a setter
* <i>v=</i>.
+ * @param setterName the name of the getter
+ * @param enclosingType the name of the enclosing type where the setter is being looked for
*/
- static final StaticWarningCode UNDEFINED_SETTER = new StaticWarningCode('UNDEFINED_SETTER', 45, "");
+ static final StaticWarningCode UNDEFINED_SETTER = new StaticWarningCode('UNDEFINED_SETTER', 46, "There is no such setter '%s' in '%s'");
/**
* 12.15.3 Static Invocation: It is a static warning if <i>C</i> does not declare a static method
* or getter <i>m</i>.
+ * @param methodName the name of the method
+ * @param enclosingType the name of the enclosing type where the method is being looked for
*/
- static final StaticWarningCode UNDEFINED_STATIC_METHOD_OR_GETTER = new StaticWarningCode('UNDEFINED_STATIC_METHOD_OR_GETTER', 46, "");
- static final List<StaticWarningCode> values = [ARGUMENT_TYPE_NOT_ASSIGNABLE, ASSIGNMENT_TO_FINAL, CASE_BLOCK_NOT_TERMINATED, CAST_TO_NON_TYPE, COMMENT_REFERENCE_CONSTRUCTOR_NOT_VISIBLE, COMMENT_REFERENCE_IDENTIFIER_NOT_VISIBLE, COMMENT_REFERENCE_UNDECLARED_CONSTRUCTOR, COMMENT_REFERENCE_UNDECLARED_IDENTIFIER, COMMENT_REFERENCE_URI_NOT_LIBRARY, CONCRETE_CLASS_WITH_ABSTRACT_MEMBER, CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER, CONFLICTING_INSTANCE_SETTER_AND_SUPERCLASS_MEMBER, CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTER, CONFLICTING_STATIC_SETTER_AND_INSTANCE_GETTER, CONST_WITH_ABSTRACT_CLASS, EQUAL_KEYS_IN_MAP, FIELD_INITIALIZER_WITH_INVALID_TYPE, INCORRECT_NUMBER_OF_ARGUMENTS, INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STATIC, INVALID_FACTORY_NAME, INVALID_OVERRIDE_GETTER_TYPE, INVALID_OVERRIDE_RETURN_TYPE, INVALID_OVERRIDE_SETTER_RETURN_TYPE, INVOCATION_OF_NON_FUNCTION, MISMATCHED_GETTER_AND_SETTER_TYPES, NEW_WITH_ABSTRACT_CLASS, NEW_WITH_NON_TYPE, NEW_WITH_UNDEFINED_CONSTRUCTOR, NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER, NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_METHOD, NON_TYPE, NON_TYPE_IN_CATCH_CLAUSE, NON_VOID_RETURN_FOR_OPERATOR, NON_VOID_RETURN_FOR_SETTER, OVERRIDE_NOT_SUBTYPE, OVERRIDE_WITH_DIFFERENT_DEFAULT, PART_OF_DIFFERENT_LIBRARY, REDIRECT_TO_INVALID_RETURN_TYPE, REDIRECT_TO_MISSING_CONSTRUCTOR, REDIRECT_TO_NON_CLASS, RETURN_WITHOUT_VALUE, SWITCH_EXPRESSION_NOT_ASSIGNABLE, UNDEFINED_CLASS, UNDEFINED_GETTER, UNDEFINED_IDENTIFIER, UNDEFINED_SETTER, UNDEFINED_STATIC_METHOD_OR_GETTER];
+ static final StaticWarningCode UNDEFINED_STATIC_METHOD_OR_GETTER = new StaticWarningCode('UNDEFINED_STATIC_METHOD_OR_GETTER', 47, "There is no such static method '%s' in '%s'");
+ static final List<StaticWarningCode> values = [ARGUMENT_TYPE_NOT_ASSIGNABLE, ASSIGNMENT_TO_FINAL, CASE_BLOCK_NOT_TERMINATED, CAST_TO_NON_TYPE, COMMENT_REFERENCE_CONSTRUCTOR_NOT_VISIBLE, COMMENT_REFERENCE_IDENTIFIER_NOT_VISIBLE, COMMENT_REFERENCE_UNDECLARED_CONSTRUCTOR, COMMENT_REFERENCE_UNDECLARED_IDENTIFIER, COMMENT_REFERENCE_URI_NOT_LIBRARY, CONCRETE_CLASS_WITH_ABSTRACT_MEMBER, CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER, CONFLICTING_INSTANCE_SETTER_AND_SUPERCLASS_MEMBER, CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTER, CONFLICTING_STATIC_SETTER_AND_INSTANCE_GETTER, CONST_WITH_ABSTRACT_CLASS, EQUAL_KEYS_IN_MAP, FIELD_INITIALIZER_WITH_INVALID_TYPE, INCORRECT_NUMBER_OF_ARGUMENTS, INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STATIC, INVALID_FACTORY_NAME, INVALID_OVERRIDE_GETTER_TYPE, INVALID_OVERRIDE_RETURN_TYPE, INVALID_OVERRIDE_SETTER_RETURN_TYPE, INVOCATION_OF_NON_FUNCTION, MISMATCHED_GETTER_AND_SETTER_TYPES, NEW_WITH_ABSTRACT_CLASS, NEW_WITH_NON_TYPE, NEW_WITH_UNDEFINED_CONSTRUCTOR, NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER, NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_METHOD, NON_TYPE, NON_TYPE_IN_CATCH_CLAUSE, NON_VOID_RETURN_FOR_OPERATOR, NON_VOID_RETURN_FOR_SETTER, OVERRIDE_NOT_SUBTYPE, OVERRIDE_WITH_DIFFERENT_DEFAULT, PART_OF_DIFFERENT_LIBRARY, REDIRECT_TO_INVALID_RETURN_TYPE, REDIRECT_TO_MISSING_CONSTRUCTOR, REDIRECT_TO_NON_CLASS, RETURN_WITHOUT_VALUE, SWITCH_EXPRESSION_NOT_ASSIGNABLE, UNDEFINED_CLASS, UNDEFINED_GETTER, UNDEFINED_IDENTIFIER, UNDEFINED_OPERATOR, UNDEFINED_SETTER, UNDEFINED_STATIC_METHOD_OR_GETTER];
final String __name;
final int __ordinal;
int get ordinal => __ordinal;
@@ -1292,6 +1374,7 @@
String get message => _message;
ErrorType get type => ErrorType.STATIC_WARNING;
bool needsRecompilation() => true;
+ int compareTo(StaticWarningCode other) => __ordinal - other.__ordinal;
String toString() => __name;
}
/**
@@ -1300,11 +1383,19 @@
*/
abstract class AnalysisErrorListener {
/**
+ * An error listener that ignores errors that are reported to it.
+ */
+ AnalysisErrorListener _NULL_LISTENER = new AnalysisErrorListener_4();
+ /**
* This method is invoked when an error has been found by the analysis engine.
* @param error the error that was just found (not {@code null})
*/
void onError(AnalysisError error);
}
+class AnalysisErrorListener_4 implements AnalysisErrorListener {
+ void onError(AnalysisError event) {
+ }
+}
/**
* The enumeration {@code StaticTypeWarningCode} defines the error codes used for static type
* warnings. The convention for this class is for the name of the error code to indicate the problem
@@ -1312,7 +1403,7 @@
* when appropriate, how the problem can be corrected.
* @coverage dart.engine.error
*/
-class StaticTypeWarningCode implements ErrorCode {
+class StaticTypeWarningCode implements Comparable<StaticTypeWarningCode>, ErrorCode {
/**
* 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>. It is a static type
* warning if <i>T</i> does not have an accessible instance setter named <i>v=</i>.
@@ -1349,10 +1440,10 @@
* <p>
* 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>. It is a static type
* warning if the static type of <i>e<sub>2</sub></i> may not be assigned to <i>T</i>.
- * @param lhsTypeName the name of the left hand side type
* @param rhsTypeName the name of the right hand side type
+ * @param lhsTypeName the name of the left hand side type
*/
- static final StaticTypeWarningCode INVALID_ASSIGNMENT = new StaticTypeWarningCode('INVALID_ASSIGNMENT', 2, "The type '%s' can't be assigned a '%s'");
+ static final StaticTypeWarningCode INVALID_ASSIGNMENT = new StaticTypeWarningCode('INVALID_ASSIGNMENT', 2, "A value of type '%s' cannot be assigned to a variable of type '%s'");
/**
* 12.14.4 Function Expression Invocation: A function expression invocation <i>i</i> has the form
* <i>e<sub>f</sub>(a<sub>1</sub>, … a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n+1</sub>,
@@ -1405,8 +1496,11 @@
/**
* 13.11 Return: It is a static type warning if the type of <i>e</i> may not be assigned to the
* declared return type of the immediately enclosing function.
+ * @param actualReturnType the return type as declared in the return statement
+ * @param expectedReturnType the expected return type as defined by the method
+ * @param methodName the name of the method
*/
- static final StaticTypeWarningCode RETURN_OF_INVALID_TYPE = new StaticTypeWarningCode('RETURN_OF_INVALID_TYPE', 8, "The return type '%s' is not a '%s', as defined by the method");
+ static final StaticTypeWarningCode RETURN_OF_INVALID_TYPE = new StaticTypeWarningCode('RETURN_OF_INVALID_TYPE', 8, "The return type '%s' is not a '%s', as defined by the method '%s'");
/**
* 12.11 Instance Creation: It is a static type warning if any of the type arguments to a
* constructor of a generic type <i>G</i> invoked by a new expression or a constant object
@@ -1430,16 +1524,33 @@
*/
static final StaticTypeWarningCode TYPE_ARGUMENT_VIOLATES_BOUNDS = new StaticTypeWarningCode('TYPE_ARGUMENT_VIOLATES_BOUNDS', 10, "");
/**
+ * Specification reference needed. This is equivalent to {@link #UNDEFINED_METHOD}, but for
+ * top-level functions.
+ * @param methodName the name of the method that is undefined
+ */
+ static final StaticTypeWarningCode UNDEFINED_FUNCTION = new StaticTypeWarningCode('UNDEFINED_FUNCTION', 11, "The FUNCTION '%s' is not defined");
+ /**
* 12.17 Getter Invocation: Let <i>T</i> be the static type of <i>e</i>. It is a static type
* warning if <i>T</i> does not have a getter named <i>m</i>.
+ * @param getterName the name of the getter
+ * @param enclosingType the name of the enclosing type where the getter is being looked for
*/
- static final StaticTypeWarningCode UNDEFINED_GETTER = new StaticTypeWarningCode('UNDEFINED_GETTER', 11, "There is no such getter '%s' in '%s'");
+ static final StaticTypeWarningCode UNDEFINED_GETTER = new StaticTypeWarningCode('UNDEFINED_GETTER', 12, "There is no such getter '%s' in '%s'");
+ /**
+ * 12.15.1 Ordinary Invocation: Let <i>T</i> be the static type of <i>o</i>. It is a static type
+ * warning if <i>T</i> does not have an accessible instance member named <i>m</i>.
+ * @param methodName the name of the method that is undefined
+ * @param typeName the resolved type name that the method lookup is happening on
+ */
+ static final StaticTypeWarningCode UNDEFINED_METHOD = new StaticTypeWarningCode('UNDEFINED_METHOD', 13, "The method '%s' is not defined for the class '%s'");
/**
* 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>. It is a static type
* warning if <i>T</i> does not have an accessible instance setter named <i>v=</i>.
+ * @param setterName the name of the setter
+ * @param enclosingType the name of the enclosing type where the setter is being looked for
* @see #INACCESSIBLE_SETTER
*/
- static final StaticTypeWarningCode UNDEFINED_SETTER = new StaticTypeWarningCode('UNDEFINED_SETTER', 12, "There is no such setter '%s' in '%s'");
+ static final StaticTypeWarningCode UNDEFINED_SETTER = new StaticTypeWarningCode('UNDEFINED_SETTER', 14, "There is no such setter '%s' in '%s'");
/**
* 12.15.4 Super Invocation: A super method invocation <i>i</i> has the form
* <i>super.m(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n+1</sub>, …
@@ -1448,16 +1559,16 @@
* @param methodName the name of the method that is undefined
* @param typeName the resolved type name that the method lookup is happening on
*/
- static final StaticTypeWarningCode UNDEFINED_SUPER_METHOD = new StaticTypeWarningCode('UNDEFINED_SUPER_METHOD', 13, "There is no such method '%s' in '%s'");
+ static final StaticTypeWarningCode UNDEFINED_SUPER_METHOD = new StaticTypeWarningCode('UNDEFINED_SUPER_METHOD', 15, "There is no such method '%s' in '%s'");
/**
* 15.8 Parameterized Types: It is a static type warning if <i>G</i> is not an accessible generic
* type declaration with <i>n</i> type parameters.
* @param typeName the name of the type being referenced (<i>G</i>)
- * @param argumentCount the number of type arguments provided
* @param parameterCount the number of type parameters that were declared
+ * @param argumentCount the number of type arguments provided
*/
- static final StaticTypeWarningCode WRONG_NUMBER_OF_TYPE_ARGUMENTS = new StaticTypeWarningCode('WRONG_NUMBER_OF_TYPE_ARGUMENTS', 14, "The type '%s' is declared with %d type parameters, but %d type arguments were given");
- static final List<StaticTypeWarningCode> values = [INACCESSIBLE_SETTER, INCONSISTENT_METHOD_INHERITANCE, INVALID_ASSIGNMENT, INVOCATION_OF_NON_FUNCTION, NON_BOOL_CONDITION, NON_BOOL_EXPRESSION, NON_TYPE_AS_TYPE_ARGUMENT, REDIRECT_WITH_INVALID_TYPE_PARAMETERS, RETURN_OF_INVALID_TYPE, TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, TYPE_ARGUMENT_VIOLATES_BOUNDS, UNDEFINED_GETTER, UNDEFINED_SETTER, UNDEFINED_SUPER_METHOD, WRONG_NUMBER_OF_TYPE_ARGUMENTS];
+ static final StaticTypeWarningCode WRONG_NUMBER_OF_TYPE_ARGUMENTS = new StaticTypeWarningCode('WRONG_NUMBER_OF_TYPE_ARGUMENTS', 16, "The type '%s' is declared with %d type parameters, but %d type arguments were given");
+ static final List<StaticTypeWarningCode> values = [INACCESSIBLE_SETTER, INCONSISTENT_METHOD_INHERITANCE, INVALID_ASSIGNMENT, INVOCATION_OF_NON_FUNCTION, NON_BOOL_CONDITION, NON_BOOL_EXPRESSION, NON_TYPE_AS_TYPE_ARGUMENT, REDIRECT_WITH_INVALID_TYPE_PARAMETERS, RETURN_OF_INVALID_TYPE, TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, TYPE_ARGUMENT_VIOLATES_BOUNDS, UNDEFINED_FUNCTION, UNDEFINED_GETTER, UNDEFINED_METHOD, UNDEFINED_SETTER, UNDEFINED_SUPER_METHOD, WRONG_NUMBER_OF_TYPE_ARGUMENTS];
final String __name;
final int __ordinal;
int get ordinal => __ordinal;
@@ -1476,5 +1587,6 @@
String get message => _message;
ErrorType get type => ErrorType.STATIC_TYPE_WARNING;
bool needsRecompilation() => true;
+ int compareTo(StaticTypeWarningCode other) => __ordinal - other.__ordinal;
String toString() => __name;
}
\ No newline at end of file
diff --git a/pkg/analyzer_experimental/lib/src/generated/html.dart b/pkg/analyzer_experimental/lib/src/generated/html.dart
index 3ec31be..58f2161 100644
--- a/pkg/analyzer_experimental/lib/src/generated/html.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/html.dart
@@ -5,6 +5,7 @@
import 'dart:collection';
import 'java_core.dart';
+import 'java_engine.dart';
import 'source.dart';
import 'error.dart';
import 'instrumentation.dart';
@@ -42,10 +43,10 @@
* @param offset the offset from the beginning of the file to the first character in the token
*/
Token.con1(TokenType type, int offset) {
- _jtd_constructor_148_impl(type, offset);
+ _jtd_constructor_150_impl(type, offset);
}
- _jtd_constructor_148_impl(TokenType type, int offset) {
- _jtd_constructor_149_impl(type, offset, type.lexeme);
+ _jtd_constructor_150_impl(TokenType type, int offset) {
+ _jtd_constructor_151_impl(type, offset, type.lexeme);
}
/**
* Initialize a newly created token.
@@ -53,13 +54,13 @@
* @param offset the offset from the beginning of the file to the first character in the token
* @param value the lexeme represented by this token (not {@code null})
*/
- Token.con2(TokenType type4, int offset3, String value7) {
- _jtd_constructor_149_impl(type4, offset3, value7);
+ Token.con2(TokenType type2, int offset2, String value2) {
+ _jtd_constructor_151_impl(type2, offset2, value2);
}
- _jtd_constructor_149_impl(TokenType type4, int offset3, String value7) {
- this._type = type4;
- this._value = value7;
- this._offset = offset3;
+ _jtd_constructor_151_impl(TokenType type2, int offset2, String value2) {
+ this._type = type2;
+ this._value = StringUtilities.intern(value2);
+ this._offset = offset2;
}
/**
* Return the offset from the beginning of the file to the character after last character of the
@@ -134,7 +135,7 @@
* The unit containing the parsed information (not {@code null}).
*/
HtmlUnit _unit;
- HtmlParseResult(Token token, List<int> lineStarts, HtmlUnit unit) : super(token, lineStarts) {
+ HtmlParseResult(int modificationTime, Token token, List<int> lineStarts, HtmlUnit unit) : super(modificationTime, token, lineStarts) {
this._unit = unit;
}
/**
@@ -204,12 +205,12 @@
* @return the number of characters in the node's source range
*/
int get length {
- Token beginToken4 = beginToken;
- Token endToken4 = endToken;
- if (beginToken4 == null || endToken4 == null) {
+ Token beginToken2 = beginToken;
+ Token endToken2 = endToken;
+ if (beginToken2 == null || endToken2 == null) {
return -1;
}
- return endToken4.offset + endToken4.length - beginToken4.offset;
+ return endToken2.offset + endToken2.length - beginToken2.offset;
}
/**
* Return the offset from the beginning of the file to the first character in the node's source
@@ -218,8 +219,8 @@
* range
*/
int get offset {
- Token beginToken5 = beginToken;
- if (beginToken5 == null) {
+ Token beginToken2 = beginToken;
+ if (beginToken2 == null) {
return -1;
}
return beginToken.offset;
@@ -232,6 +233,11 @@
* @return the parent of this node, or {@code null} if none
*/
XmlNode get parent => _parent;
+ String toString() {
+ PrintStringWriter writer = new PrintStringWriter();
+ accept(new ToSourceVisitor(writer));
+ return writer.toString();
+ }
/**
* Use the given visitor to visit all of the children of this node. The children will be visited
* in source order.
@@ -243,12 +249,13 @@
* @param children the nodes that will become the children of this node
* @return the nodes that were made children of this node
*/
- List<XmlNode> becomeParentOf(List<XmlNode> children) {
+ List becomeParentOf(List children) {
if (children != null) {
- for (JavaIterator<XmlNode> iter = new JavaIterator(children); iter.hasNext;) {
+ for (JavaIterator iter = new JavaIterator(children); iter.hasNext;) {
XmlNode node = iter.next();
node.parent = this;
}
+ return new List.from(children);
}
return children;
}
@@ -548,6 +555,10 @@
*/
class HtmlScanResult {
/**
+ * The time at which the contents of the source were last set.
+ */
+ int _modificationTime = 0;
+ /**
* The first token in the token stream (not {@code null}).
*/
Token _token;
@@ -555,7 +566,8 @@
* The line start information that was produced.
*/
List<int> _lineStarts;
- HtmlScanResult(Token token, List<int> lineStarts) {
+ HtmlScanResult(int modificationTime, Token token, List<int> lineStarts) {
+ this._modificationTime = modificationTime;
this._token = token;
this._lineStarts = lineStarts;
}
@@ -565,6 +577,11 @@
*/
List<int> get lineStarts => _lineStarts;
/**
+ * Return the time at which the contents of the source were last set.
+ * @return the time at which the contents of the source were last set
+ */
+ int get modificationTime => _modificationTime;
+ /**
* Answer the first token in the token stream.
* @return the token (not {@code null})
*/
@@ -599,8 +616,8 @@
this._charOffset = -1;
}
int get offset => _charOffset;
- void set offset(int offset12) {
- _charOffset = offset12;
+ void set offset(int offset2) {
+ _charOffset = offset2;
}
int advance() {
if (++_charOffset < _stringLength) {
@@ -662,11 +679,80 @@
}
}
/**
+ * Instances of the class {@code ToSourceVisitor} write a source representation of a visited XML
+ * node (and all of it's children) to a writer.
+ * @coverage dart.engine.html
+ */
+class ToSourceVisitor implements XmlVisitor<Object> {
+ /**
+ * The writer to which the source is to be written.
+ */
+ PrintWriter _writer;
+ /**
+ * Initialize a newly created visitor to write source code representing the visited nodes to the
+ * given writer.
+ * @param writer the writer to which the source is to be written
+ */
+ ToSourceVisitor(PrintWriter writer) {
+ this._writer = writer;
+ }
+ Object visitHtmlUnit(HtmlUnit node) {
+ for (XmlTagNode child in node.tagNodes) {
+ visit(child);
+ }
+ return null;
+ }
+ Object visitXmlAttributeNode(XmlAttributeNode node) {
+ String name2 = node.name.lexeme;
+ Token value2 = node.value;
+ if (name2.length == 0) {
+ _writer.print("__");
+ } else {
+ _writer.print(name2);
+ }
+ _writer.print("=");
+ if (value2 == null) {
+ _writer.print("__");
+ } else {
+ _writer.print(value2.lexeme);
+ }
+ return null;
+ }
+ Object visitXmlTagNode(XmlTagNode node) {
+ _writer.print("<");
+ String tagName = node.tag.lexeme;
+ _writer.print(tagName);
+ for (XmlAttributeNode attribute in node.attributes) {
+ _writer.print(" ");
+ visit(attribute);
+ }
+ _writer.print(node.attributeEnd.lexeme);
+ if (node.closingTag != null) {
+ for (XmlTagNode child in node.tagNodes) {
+ visit(child);
+ }
+ _writer.print("</");
+ _writer.print(tagName);
+ _writer.print(">");
+ }
+ return null;
+ }
+ /**
+ * Safely visit the given node.
+ * @param node the node to be visited
+ */
+ void visit(XmlNode node) {
+ if (node != null) {
+ node.accept(this);
+ }
+ }
+}
+/**
* The enumeration {@code TokenType} defines the types of tokens that can be returned by the
* scanner.
* @coverage dart.engine.html
*/
-class TokenType {
+class TokenType implements Comparable<TokenType> {
/**
* The type of the token that marks the end of the input.
*/
@@ -700,6 +786,7 @@
* @return the lexeme that defines this type of token
*/
String get lexeme => _lexeme;
+ int compareTo(TokenType other) => __ordinal - other.__ordinal;
String toString() => __name;
}
class TokenType_EOF extends TokenType {
@@ -801,6 +888,10 @@
*/
Source _source;
/**
+ * The time at which the contents of the source were last set.
+ */
+ int _modificationTime = 0;
+ /**
* The scanner used to scan the source
*/
AbstractScanner _scanner;
@@ -815,12 +906,14 @@
HtmlScanner(Source source) {
this._source = source;
}
- accept(CharBuffer contents) {
+ void accept(CharBuffer contents, int modificationTime2) {
+ this._modificationTime = modificationTime2;
_scanner = new CharBufferScanner(_source, contents);
_scanner.passThroughElements = _SCRIPT_TAG;
_token = _scanner.tokenize();
}
- void accept2(String contents) {
+ void accept2(String contents, int modificationTime2) {
+ this._modificationTime = modificationTime2;
_scanner = new StringScanner(_source, contents);
_scanner.passThroughElements = _SCRIPT_TAG;
_token = _scanner.tokenize();
@@ -829,7 +922,7 @@
* Answer the result of scanning the source
* @return the result (not {@code null})
*/
- HtmlScanResult get result => new HtmlScanResult(_token, _scanner.lineStarts);
+ HtmlScanResult get result => new HtmlScanResult(_modificationTime, _token, _scanner.lineStarts);
}
/**
* Instances of the class {@code XmlParser} are used to parse tokens into a AST structure comprised
@@ -936,8 +1029,8 @@
* @return a collection of zero or more attributes (not {@code null}, contains no {@code null}s)
*/
List<XmlAttributeNode> parseAttributes() {
- TokenType type11 = _currentToken.type;
- if (identical(type11, TokenType.GT) || identical(type11, TokenType.SLASH_GT) || identical(type11, TokenType.EOF)) {
+ TokenType type2 = _currentToken.type;
+ if (identical(type2, TokenType.GT) || identical(type2, TokenType.SLASH_GT) || identical(type2, TokenType.EOF)) {
return XmlTagNode.NO_ATTRIBUTES;
}
List<XmlAttributeNode> attributes = new List<XmlAttributeNode>();
@@ -961,8 +1054,8 @@
* @return a list of nodes (not {@code null}, contains no {@code null}s)
*/
List<XmlTagNode> parseChildTagNodes() {
- TokenType type12 = _currentToken.type;
- if (identical(type12, TokenType.LT_SLASH) || identical(type12, TokenType.EOF)) {
+ TokenType type2 = _currentToken.type;
+ if (identical(type2, TokenType.LT_SLASH) || identical(type2, TokenType.EOF)) {
return XmlTagNode.NO_TAG_NODES;
}
List<XmlTagNode> nodes = new List<XmlTagNode>();
@@ -1122,9 +1215,9 @@
XmlTagNode(Token nodeStart, Token tag, List<XmlAttributeNode> attributes, Token attributeEnd, List<XmlTagNode> tagNodes, Token contentEnd, Token closingTag, Token nodeEnd) {
this._nodeStart = nodeStart;
this._tag = tag;
- this._attributes = becomeParentOf(attributes);
+ this._attributes = becomeParentOfEmpty(attributes, NO_ATTRIBUTES);
this._attributeEnd = attributeEnd;
- this._tagNodes = becomeParentOf(tagNodes);
+ this._tagNodes = becomeParentOfEmpty(tagNodes, NO_TAG_NODES);
this._contentEnd = contentEnd;
this._closingTag = closingTag;
this._nodeEnd = nodeEnd;
@@ -1234,6 +1327,15 @@
node.accept(visitor);
}
}
+ /**
+ * Same as {@link #becomeParentOf(List)}, but returns given "ifEmpty" if "children" is empty
+ */
+ List becomeParentOfEmpty(List children, List ifEmpty) {
+ if (children != null && children.isEmpty) {
+ return ifEmpty;
+ }
+ return becomeParentOf(children);
+ }
}
/**
* Instances of the class {@code HtmlParser} are used to parse tokens into a AST structure comprised
@@ -1257,7 +1359,7 @@
Token firstToken = scanResult.token;
List<XmlTagNode> tagNodes = parseTopTagNodes(firstToken);
HtmlUnit unit = new HtmlUnit(firstToken, tagNodes, currentToken);
- return new HtmlParseResult(firstToken, scanResult.lineStarts, unit);
+ return new HtmlParseResult(scanResult.modificationTime, firstToken, scanResult.lineStarts, unit);
}
/**
* Scan then parse the specified source.
@@ -1322,8 +1424,8 @@
* Set the element associated with this HTML unit.
* @param element the element
*/
- void set element(HtmlElementImpl element18) {
- this._element = element18;
+ void set element(HtmlElementImpl element2) {
+ this._element = element2;
}
void visitChildren(XmlVisitor<Object> visitor) {
for (XmlTagNode node in _tagNodes) {
diff --git a/pkg/analyzer_experimental/lib/src/generated/instrumentation.dart b/pkg/analyzer_experimental/lib/src/generated/instrumentation.dart
index 1de88d7..29c963d 100644
--- a/pkg/analyzer_experimental/lib/src/generated/instrumentation.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/instrumentation.dart
@@ -34,12 +34,12 @@
/**
* A builder that will silently ignore all data and logging requests.
*/
- static InstrumentationBuilder _NULL_INSTRUMENTATION_BUILDER = new InstrumentationBuilder_9();
+ static InstrumentationBuilder _NULL_INSTRUMENTATION_BUILDER = new InstrumentationBuilder_13();
/**
* An instrumentation logger that can be used when no other instrumentation logger has been
* configured. This logger will silently ignore all data and logging requests.
*/
- static InstrumentationLogger _NULL_LOGGER = new InstrumentationLogger_10();
+ static InstrumentationLogger _NULL_LOGGER = new InstrumentationLogger_14();
/**
* The current instrumentation logger.
*/
@@ -57,16 +57,26 @@
*/
static InstrumentationBuilder builder2(String name) => _CURRENT_LOGGER.createBuilder(name);
/**
+ * Get the currently active instrumentation logger
+ */
+ static InstrumentationLogger get logger => _CURRENT_LOGGER;
+ /**
* Return a builder that will silently ignore all data and logging requests.
* @return the builder (not {@code null})
*/
static InstrumentationBuilder get nullBuilder => _NULL_INSTRUMENTATION_BUILDER;
/**
+ * Is this instrumentation system currently configured to drop instrumentation data provided to
+ * it?
+ * @return
+ */
+ static bool isNullLogger() => identical(_CURRENT_LOGGER, _NULL_LOGGER);
+ /**
* Set the logger that should receive instrumentation information to the given logger.
* @param logger the logger that should receive instrumentation information
*/
- static void set logger(InstrumentationLogger logger3) {
- _CURRENT_LOGGER = logger3 == null ? _NULL_LOGGER : logger3;
+ static void set logger(InstrumentationLogger logger2) {
+ _CURRENT_LOGGER = logger2 == null ? _NULL_LOGGER : logger2;
}
/**
* Prevent the creation of instances of this class
@@ -74,7 +84,7 @@
Instrumentation() {
}
}
-class InstrumentationBuilder_9 implements InstrumentationBuilder {
+class InstrumentationBuilder_13 implements InstrumentationBuilder {
InstrumentationBuilder data(String name, bool value) => this;
InstrumentationBuilder data2(String name, int value) => this;
InstrumentationBuilder data3(String name, String value) => this;
@@ -86,8 +96,9 @@
InstrumentationBuilder metric2(String name, int value) => this;
InstrumentationBuilder metric3(String name, String value) => this;
InstrumentationBuilder metric4(String name, List<String> value) => this;
+ InstrumentationBuilder record(Exception exception) => this;
}
-class InstrumentationLogger_10 implements InstrumentationLogger {
+class InstrumentationLogger_14 implements InstrumentationLogger {
InstrumentationBuilder createBuilder(String name) => Instrumentation._NULL_INSTRUMENTATION_BUILDER;
}
/**
@@ -181,6 +192,14 @@
* @return this builder
*/
InstrumentationBuilder metric4(String name, List<String> value);
+ /**
+ * Append the given exception to the information being collected by this builder. The exception's
+ * class name is captured using {@link #metric(String,String)}. Other aspects of the exception
+ * may contain either user identifiable or contains user intellectual property (but is not
+ * guaranteed to contain either) and thus are captured using the various data methods such as{@link #data(String,String)}.
+ * @param exception the exception (may be {@code null})
+ */
+ InstrumentationBuilder record(Exception exception);
}
/**
* The instrumentation recording level representing (1) recording {@link #EVERYTHING} recording of
@@ -188,7 +207,7 @@
* turned {@link #OFF} in which case nothing is recorded.
* @coverage dart.engine.utilities
*/
-class InstrumentationLevel {
+class InstrumentationLevel implements Comparable<InstrumentationLevel> {
/**
* Recording all instrumented information
*/
@@ -219,6 +238,7 @@
}
InstrumentationLevel(this.__name, this.__ordinal) {
}
+ int compareTo(InstrumentationLevel other) => __ordinal - other.__ordinal;
String toString() => __name;
}
/**
diff --git a/pkg/analyzer_experimental/lib/src/generated/java_core.dart b/pkg/analyzer_experimental/lib/src/generated/java_core.dart
index d90e510..0c40a7e 100644
--- a/pkg/analyzer_experimental/lib/src/generated/java_core.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/java_core.dart
@@ -42,6 +42,11 @@
if (oTypeName == "${tTypeName}Impl") {
return true;
}
+ if (tTypeName == "MethodElement") {
+ if (oTypeName == "MethodMember") {
+ return true;
+ }
+ }
if (tTypeName == "ExecutableElement") {
if (oTypeName == "MethodElementImpl" || oTypeName == "FunctionElementImpl") {
return true;
@@ -171,13 +176,13 @@
abstract class PrintWriter {
void print(x);
- void println() {
+ void newLine() {
this.print('\n');
}
- void printlnObject(String s) {
+ void println(String s) {
this.print(s);
- this.println();
+ this.newLine();
}
void printf(String fmt, List args) {
@@ -291,6 +296,10 @@
elements.addAll(iterable);
}
+ void setAll(int index, Iterable<E> iterable) {
+ elements.setAll(iterable);
+ }
+
void sort([int compare(E a, E b)]) {
elements.sort(compare);
}
@@ -303,6 +312,10 @@
elements.insert(index, element);
}
+ void insertAll(int index, Iterable<E> iterable) {
+ elements.insertAll(index, iterable);
+ }
+
int lastIndexOf(E element, [int start]) {
return elements.lastIndexOf(element, start);
}
@@ -329,16 +342,20 @@
List<E> getRange(int start, int length) => sublist(start, start + length);
- void setRange(int start, int length, List<E> from, [int startFrom]) {
- elements.setRange(start, length, from, startFrom);
+ void setRange(int start, int end, Iterable<E> iterable, [int skipCount = 0]) {
+ elements.setRange(start, end, iterable, skipCount);
}
- void removeRange(int start, int length) {
- elements.removeRange(start, length);
+ void removeRange(int start, int end) {
+ elements.removeRange(start, end);
}
- void insertRange(int start, int length, [E fill]) {
- elements.insertRange(start, length, fill);
+ void replaceRange(int start, int end, Iterable<E> iterable) {
+ elements.replaceRange(start, end, iterable);
+ }
+
+ void fillRange(int start, int end, [E fillValue]) {
+ elements.fillRange(start, end, fillValue);
}
Map<int, E> asMap() {
diff --git a/pkg/analyzer_experimental/lib/src/generated/java_engine.dart b/pkg/analyzer_experimental/lib/src/generated/java_engine.dart
index 770acf5..e507ea3 100644
--- a/pkg/analyzer_experimental/lib/src/generated/java_engine.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/java_engine.dart
@@ -2,6 +2,17 @@
class StringUtilities {
static List<String> EMPTY_ARRAY = new List(0);
+ static String intern(String s) => s;
+ static String substringBefore(String str, String separator) {
+ if (str == null || str.isEmpty) {
+ return str;
+ }
+ int pos = str.indexOf(separator);
+ if (pos < 0) {
+ return str;
+ }
+ return str.substring(0, pos);
+ }
}
class FileNameUtilities {
@@ -16,3 +27,19 @@
return "";
}
}
+
+class ArrayUtils {
+ static List addAll(List target, List source) {
+ List result = new List.from(target);
+ result.addAll(source);
+ return result;
+ }
+}
+
+class UUID {
+ static int __nextId = 0;
+ final String id;
+ UUID(this.id);
+ String toString() => id;
+ static UUID randomUUID() => new UUID((__nextId).toString());
+}
diff --git a/pkg/analyzer_experimental/lib/src/generated/java_junit.dart b/pkg/analyzer_experimental/lib/src/generated/java_junit.dart
index 8d284eb..2ff97ad 100644
--- a/pkg/analyzer_experimental/lib/src/generated/java_junit.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/java_junit.dart
@@ -28,6 +28,9 @@
static void assertNotNull(x) {
expect(x, isNotNull);
}
+ static void assertNotNullMsg(String msg, x) {
+ expect(x, isNotNullMsg(msg));
+ }
static void assertEquals(expected, actual) {
expect(actual, equals(expected));
}
@@ -110,3 +113,19 @@
return mismatchDescription.replace(msg).add(" $item is not false");
}
}
+
+Matcher isNotNullMsg(String msg) => new _IsNotNullWithMessage(msg);
+class _IsNotNullWithMessage extends BaseMatcher {
+ final String msg;
+ const _IsNotNullWithMessage(this.msg);
+ bool matches(item, MatchState matchState) {
+ return item != null;
+ }
+ Description describe(Description mismatchDescription) {
+ return mismatchDescription.replace(msg);
+ }
+ Description describeMismatch(item, Description mismatchDescription,
+ MatchState matchState, bool verbose) {
+ return mismatchDescription.replace(msg).add(" $item is null");
+ }
+}
diff --git a/pkg/analyzer_experimental/lib/src/generated/parser.dart b/pkg/analyzer_experimental/lib/src/generated/parser.dart
index 7593ab6..2c0da74 100644
--- a/pkg/analyzer_experimental/lib/src/generated/parser.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/parser.dart
@@ -6,6 +6,7 @@
import 'dart:collection';
import 'java_core.dart';
import 'java_engine.dart';
+import 'instrumentation.dart';
import 'error.dart';
import 'source.dart';
import 'scanner.dart';
@@ -164,29 +165,29 @@
* Set the token representing the keyword 'abstract' to the given token.
* @param abstractKeyword the token representing the keyword 'abstract'
*/
- void set abstractKeyword(Token abstractKeyword4) {
- this._abstractKeyword = abstractKeyword4;
+ void set abstractKeyword(Token abstractKeyword2) {
+ this._abstractKeyword = abstractKeyword2;
}
/**
* Set the token representing the keyword 'const' to the given token.
* @param constKeyword the token representing the keyword 'const'
*/
- void set constKeyword(Token constKeyword3) {
- this._constKeyword = constKeyword3;
+ void set constKeyword(Token constKeyword2) {
+ this._constKeyword = constKeyword2;
}
/**
* Set the token representing the keyword 'external' to the given token.
* @param externalKeyword the token representing the keyword 'external'
*/
- void set externalKeyword(Token externalKeyword5) {
- this._externalKeyword = externalKeyword5;
+ void set externalKeyword(Token externalKeyword2) {
+ this._externalKeyword = externalKeyword2;
}
/**
* Set the token representing the keyword 'factory' to the given token.
* @param factoryKeyword the token representing the keyword 'factory'
*/
- void set factoryKeyword(Token factoryKeyword3) {
- this._factoryKeyword = factoryKeyword3;
+ void set factoryKeyword(Token factoryKeyword2) {
+ this._factoryKeyword = factoryKeyword2;
}
/**
* Set the token representing the keyword 'final' to the given token.
@@ -268,6 +269,7 @@
static String _OF = "of";
static String _ON = "on";
static String _SHOW = "show";
+ static String _NATIVE = "native";
/**
* Initialize a newly created parser.
* @param source the source being parsed
@@ -284,8 +286,13 @@
* @return the compilation unit that was parsed
*/
CompilationUnit parseCompilationUnit(Token token) {
- _currentToken = token;
- return parseCompilationUnit2();
+ InstrumentationBuilder instrumentation = Instrumentation.builder2("dart.engine.Parser.parseCompilationUnit");
+ try {
+ _currentToken = token;
+ return parseCompilationUnit2();
+ } finally {
+ instrumentation.log();
+ }
}
/**
* Parse an expression, starting with the given token.
@@ -294,8 +301,13 @@
* recognizable expression
*/
Expression parseExpression(Token token) {
- _currentToken = token;
- return parseExpression2();
+ InstrumentationBuilder instrumentation = Instrumentation.builder2("dart.engine.Parser.parseExpression");
+ try {
+ _currentToken = token;
+ return parseExpression2();
+ } finally {
+ instrumentation.log();
+ }
}
/**
* Parse a statement, starting with the given token.
@@ -304,8 +316,13 @@
* recognizable statement
*/
Statement parseStatement(Token token) {
- _currentToken = token;
- return parseStatement2();
+ InstrumentationBuilder instrumentation = Instrumentation.builder2("dart.engine.Parser.parseStatement");
+ try {
+ _currentToken = token;
+ return parseStatement2();
+ } finally {
+ instrumentation.log();
+ }
}
/**
* Parse a sequence of statements, starting with the given token.
@@ -314,8 +331,13 @@
* recognizable sequence of statements
*/
List<Statement> parseStatements(Token token) {
- _currentToken = token;
- return parseStatements2();
+ InstrumentationBuilder instrumentation = Instrumentation.builder2("dart.engine.Parser.parseStatements");
+ try {
+ _currentToken = token;
+ return parseStatements2();
+ } finally {
+ instrumentation.log();
+ }
}
void set currentToken(Token currentToken2) {
this._currentToken = currentToken2;
@@ -385,17 +407,22 @@
* Create a synthetic identifier.
* @return the synthetic identifier that was created
*/
- SimpleIdentifier createSyntheticIdentifier() => new SimpleIdentifier.full(createSyntheticToken(TokenType.IDENTIFIER));
+ SimpleIdentifier createSyntheticIdentifier() => new SimpleIdentifier.full(createSyntheticToken2(TokenType.IDENTIFIER));
/**
* Create a synthetic string literal.
* @return the synthetic string literal that was created
*/
- SimpleStringLiteral createSyntheticStringLiteral() => new SimpleStringLiteral.full(createSyntheticToken(TokenType.STRING), "");
+ SimpleStringLiteral createSyntheticStringLiteral() => new SimpleStringLiteral.full(createSyntheticToken2(TokenType.STRING), "");
+ /**
+ * Create a synthetic token representing the given keyword.
+ * @return the synthetic token that was created
+ */
+ Token createSyntheticToken(Keyword keyword) => new KeywordToken_11(keyword, _currentToken.offset);
/**
* Create a synthetic token with the given type.
* @return the synthetic token that was created
*/
- Token createSyntheticToken(TokenType type) => new StringToken(type, "", _currentToken.offset);
+ Token createSyntheticToken2(TokenType type) => new StringToken(type, "", _currentToken.offset);
/**
* Check that the given expression is assignable and report an error if it isn't.
* <pre>
@@ -541,8 +568,23 @@
if (token == null) {
return false;
}
- TokenType type21 = token.type;
- return identical(type21, TokenType.EQ) || identical(type21, TokenType.COMMA) || identical(type21, TokenType.SEMICOLON) || matches3(token, Keyword.IN);
+ TokenType type2 = token.type;
+ return identical(type2, TokenType.EQ) || identical(type2, TokenType.COMMA) || identical(type2, TokenType.SEMICOLON) || matches3(token, Keyword.IN);
+ }
+ /**
+ * Return {@code true} if the given token appears to be the beginning of an operator declaration.
+ * @param startToken the token that might be the start of an operator declaration
+ * @return {@code true} if the given token appears to be the beginning of an operator declaration
+ */
+ bool isOperator(Token startToken) {
+ if (startToken.isOperator()) {
+ Token token = startToken.next;
+ while (token.isOperator()) {
+ token = token.next;
+ }
+ return matches4(token, TokenType.OPEN_PAREN);
+ }
+ return false;
}
/**
* Return {@code true} if the current token appears to be the beginning of a switch member.
@@ -554,8 +596,8 @@
token = token.next.next;
}
if (identical(token.type, TokenType.KEYWORD)) {
- Keyword keyword30 = ((token as KeywordToken)).keyword;
- return identical(keyword30, Keyword.CASE) || identical(keyword30, Keyword.DEFAULT);
+ Keyword keyword2 = ((token as KeywordToken)).keyword;
+ return identical(keyword2, Keyword.CASE) || identical(keyword2, Keyword.DEFAULT);
}
return false;
}
@@ -572,8 +614,8 @@
int firstOffset = 2147483647;
for (Token token in tokens) {
if (token != null) {
- int offset5 = token.offset;
- if (offset5 < firstOffset) {
+ int offset2 = token.offset;
+ if (offset2 < firstOffset) {
first = token;
}
}
@@ -598,14 +640,14 @@
* @param keyword the keyword that is being tested for
* @return {@code true} if the given token matches the given keyword
*/
- bool matches3(Token token, Keyword keyword38) => identical(token.type, TokenType.KEYWORD) && identical(((token as KeywordToken)).keyword, keyword38);
+ bool matches3(Token token, Keyword keyword2) => identical(token.type, TokenType.KEYWORD) && identical(((token as KeywordToken)).keyword, keyword2);
/**
* Return {@code true} if the given token has the given type.
* @param token the token being tested
* @param type the type of token that is being tested for
* @return {@code true} if the given token has the given type
*/
- bool matches4(Token token, TokenType type31) => identical(token.type, type31);
+ bool matches4(Token token, TokenType type2) => identical(token.type, type2);
/**
* Return {@code true} if the current token has the given type. Note that this method, unlike
* other variants, will modify the token stream if possible to match a wider range of tokens. In
@@ -614,33 +656,33 @@
* @param type the type of token that can optionally appear in the current location
* @return {@code true} if the current token has the given type
*/
- bool matches5(TokenType type32) {
+ bool matches5(TokenType type2) {
TokenType currentType = _currentToken.type;
- if (currentType != type32) {
- if (identical(type32, TokenType.GT)) {
+ if (currentType != type2) {
+ if (identical(type2, TokenType.GT)) {
if (identical(currentType, TokenType.GT_GT)) {
- int offset6 = _currentToken.offset;
- Token first = new Token(TokenType.GT, offset6);
- Token second = new Token(TokenType.GT, offset6 + 1);
+ int offset2 = _currentToken.offset;
+ Token first = new Token(TokenType.GT, offset2);
+ Token second = new Token(TokenType.GT, offset2 + 1);
second.setNext(_currentToken.next);
first.setNext(second);
_currentToken.previous.setNext(first);
_currentToken = first;
return true;
} else if (identical(currentType, TokenType.GT_EQ)) {
- int offset7 = _currentToken.offset;
- Token first = new Token(TokenType.GT, offset7);
- Token second = new Token(TokenType.EQ, offset7 + 1);
+ int offset3 = _currentToken.offset;
+ Token first = new Token(TokenType.GT, offset3);
+ Token second = new Token(TokenType.EQ, offset3 + 1);
second.setNext(_currentToken.next);
first.setNext(second);
_currentToken.previous.setNext(first);
_currentToken = first;
return true;
} else if (identical(currentType, TokenType.GT_GT_EQ)) {
- int offset8 = _currentToken.offset;
- Token first = new Token(TokenType.GT, offset8);
- Token second = new Token(TokenType.GT, offset8 + 1);
- Token third = new Token(TokenType.EQ, offset8 + 2);
+ int offset4 = _currentToken.offset;
+ Token first = new Token(TokenType.GT, offset4);
+ Token second = new Token(TokenType.GT, offset4 + 1);
+ Token third = new Token(TokenType.EQ, offset4 + 2);
third.setNext(_currentToken.next);
second.setNext(third);
first.setNext(second);
@@ -718,7 +760,7 @@
* Parse an annotation.
* <pre>
* annotation ::=
- * '@' qualified (‘.’ identifier)? arguments?
+ * '@' qualified ('.' identifier)? arguments?
* </pre>
* @return the annotation that was parsed
*/
@@ -1141,8 +1183,8 @@
members = parseClassMembers(className, ((leftBracket as BeginToken)).endToken != null);
rightBracket = expect2(TokenType.CLOSE_CURLY_BRACKET);
} else {
- leftBracket = createSyntheticToken(TokenType.OPEN_CURLY_BRACKET);
- rightBracket = createSyntheticToken(TokenType.CLOSE_CURLY_BRACKET);
+ leftBracket = createSyntheticToken2(TokenType.OPEN_CURLY_BRACKET);
+ rightBracket = createSyntheticToken2(TokenType.CLOSE_CURLY_BRACKET);
reportError4(ParserErrorCode.MISSING_CLASS_BODY, []);
}
return new ClassDeclaration.full(commentAndMetadata.comment, commentAndMetadata.metadata, abstractKeyword, keyword, name, typeParameters, extendsClause, withClause, implementsClause, leftBracket, members, rightBracket);
@@ -1168,7 +1210,7 @@
} else if (matches(Keyword.SET) && matchesIdentifier2(peek())) {
validateModifiersForGetterOrSetterOrMethod(modifiers);
return parseSetter(commentAndMetadata, modifiers.externalKeyword, modifiers.staticKeyword, returnType);
- } else if (matches(Keyword.OPERATOR) && peek().isOperator()) {
+ } 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])) {
@@ -1181,6 +1223,11 @@
return parseInitializedIdentifierList(commentAndMetadata, modifiers.staticKeyword, validateModifiersForField(modifiers), returnType);
}
}
+ if (isOperator(peek())) {
+ validateModifiersForOperator(modifiers);
+ return parseOperator(commentAndMetadata, modifiers.externalKeyword, returnType);
+ }
+ reportError5(ParserErrorCode.EXPECTED_EXECUTABLE, _currentToken, []);
return null;
}
} else if (matches(Keyword.GET) && matchesIdentifier2(peek())) {
@@ -1189,10 +1236,15 @@
} else if (matches(Keyword.SET) && matchesIdentifier2(peek())) {
validateModifiersForGetterOrSetterOrMethod(modifiers);
return parseSetter(commentAndMetadata, modifiers.externalKeyword, modifiers.staticKeyword, null);
- } else if (matches(Keyword.OPERATOR) && peek().isOperator() && matches4(peek2(2), TokenType.OPEN_PAREN)) {
+ } else if (matches(Keyword.OPERATOR) && isOperator(peek())) {
validateModifiersForOperator(modifiers);
return parseOperator(commentAndMetadata, modifiers.externalKeyword, null);
} else if (!matchesIdentifier()) {
+ if (isOperator(peek())) {
+ validateModifiersForOperator(modifiers);
+ return parseOperator(commentAndMetadata, modifiers.externalKeyword, null);
+ }
+ reportError5(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());
@@ -1215,10 +1267,19 @@
} else if (matches(Keyword.SET) && matchesIdentifier2(peek())) {
validateModifiersForGetterOrSetterOrMethod(modifiers);
return parseSetter(commentAndMetadata, modifiers.externalKeyword, modifiers.staticKeyword, type);
- } else if (matches(Keyword.OPERATOR) && peek().isOperator() && matches4(peek2(2), TokenType.OPEN_PAREN)) {
+ } else if (matches(Keyword.OPERATOR) && isOperator(peek())) {
validateModifiersForOperator(modifiers);
return parseOperator(commentAndMetadata, modifiers.externalKeyword, type);
} else if (!matchesIdentifier()) {
+ if (matches5(TokenType.CLOSE_CURLY_BRACKET)) {
+ return parseInitializedIdentifierList(commentAndMetadata, modifiers.staticKeyword, validateModifiersForField(modifiers), type);
+ }
+ if (isOperator(peek())) {
+ validateModifiersForOperator(modifiers);
+ return parseOperator(commentAndMetadata, modifiers.externalKeyword, type);
+ }
+ reportError5(ParserErrorCode.EXPECTED_CLASS_MEMBER, _currentToken, []);
+ return null;
} else if (matches4(peek(), TokenType.OPEN_PAREN)) {
validateModifiersForGetterOrSetterOrMethod(modifiers);
return parseMethodDeclaration(commentAndMetadata, modifiers.externalKeyword, modifiers.staticKeyword, type);
@@ -1281,7 +1342,10 @@
abstractKeyword = andAdvance;
}
TypeName superclass = parseTypeName();
- WithClause withClause = parseWithClause();
+ WithClause withClause = null;
+ if (matches(Keyword.WITH)) {
+ withClause = parseWithClause();
+ }
ImplementsClause implementsClause = null;
if (matches(Keyword.IMPLEMENTS)) {
implementsClause = parseImplementsClause();
@@ -1351,7 +1415,7 @@
}
try {
List<bool> errorFound = [false];
- AnalysisErrorListener listener = new AnalysisErrorListener_8(errorFound);
+ AnalysisErrorListener listener = new AnalysisErrorListener_12(errorFound);
StringScanner scanner = new StringScanner(null, referenceSource, listener);
scanner.setSourceStart(1, 1, sourceOffset);
Token firstToken = scanner.tokenize();
@@ -1539,11 +1603,12 @@
if ((matches(Keyword.GET) || matches(Keyword.SET)) && matchesIdentifier2(peek())) {
validateModifiersForTopLevelFunction(modifiers);
return parseFunctionDeclaration(commentAndMetadata, modifiers.externalKeyword, null);
- } else if (matches(Keyword.OPERATOR) && peek().isOperator()) {
+ } else if (matches(Keyword.OPERATOR) && isOperator(peek())) {
+ reportError5(ParserErrorCode.TOP_LEVEL_OPERATOR, _currentToken, []);
return null;
} else if (matchesIdentifier() && matchesAny(peek(), [TokenType.OPEN_PAREN, TokenType.OPEN_CURLY_BRACKET, TokenType.FUNCTION])) {
validateModifiersForTopLevelFunction(modifiers);
- return parseFunctionDeclaration(commentAndMetadata, modifiers.externalKeyword, null);
+ return parseFunctionDeclaration(commentAndMetadata, modifiers.externalKeyword, returnType);
} else {
if (matchesIdentifier()) {
if (matchesAny(peek(), [TokenType.EQ, TokenType.COMMA, TokenType.SEMICOLON])) {
@@ -1551,14 +1616,17 @@
return new TopLevelVariableDeclaration.full(commentAndMetadata.comment, commentAndMetadata.metadata, parseVariableDeclarationList2(null, validateModifiersForTopLevelVariable(modifiers), null), expect2(TokenType.SEMICOLON));
}
}
+ reportError5(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) && peek().isOperator() && matches4(peek2(2), TokenType.OPEN_PAREN)) {
+ } else if (matches(Keyword.OPERATOR) && isOperator(peek())) {
+ reportError5(ParserErrorCode.TOP_LEVEL_OPERATOR, _currentToken, []);
return null;
} else if (!matchesIdentifier()) {
+ reportError5(ParserErrorCode.EXPECTED_EXECUTABLE, _currentToken, []);
return null;
} else if (matches4(peek(), TokenType.OPEN_PAREN)) {
validateModifiersForTopLevelFunction(modifiers);
@@ -1570,7 +1638,11 @@
if (matches(Keyword.GET) || matches(Keyword.SET)) {
validateModifiersForTopLevelFunction(modifiers);
return parseFunctionDeclaration(commentAndMetadata, modifiers.externalKeyword, returnType);
+ } else if (matches(Keyword.OPERATOR) && isOperator(peek())) {
+ reportError5(ParserErrorCode.TOP_LEVEL_OPERATOR, _currentToken, []);
+ return null;
} else if (!matchesIdentifier()) {
+ reportError5(ParserErrorCode.EXPECTED_EXECUTABLE, _currentToken, []);
return null;
}
if (matchesAny(peek(), [TokenType.OPEN_PAREN, TokenType.FUNCTION, TokenType.OPEN_CURLY_BRACKET])) {
@@ -2038,12 +2110,6 @@
* @return the formal parameters that were parsed
*/
FormalParameterList parseFormalParameterList() {
- if (matches5(TokenType.EQ) && matches4(peek(), TokenType.OPEN_PAREN)) {
- Token previous4 = _currentToken.previous;
- if ((matches4(previous4, TokenType.EQ_EQ) || matches4(previous4, TokenType.BANG_EQ)) && _currentToken.offset == previous4.offset + 2) {
- advance();
- }
- }
Token leftParenthesis = expect2(TokenType.OPEN_PAREN);
if (matches5(TokenType.CLOSE_PAREN)) {
return new FormalParameterList.full(leftParenthesis, null, null, null, andAdvance);
@@ -2067,9 +2133,10 @@
if (firstParameter) {
firstParameter = false;
} else if (!optional(TokenType.COMMA)) {
- if (((leftParenthesis as BeginToken)).endToken != null) {
+ if ((leftParenthesis is BeginToken) && ((leftParenthesis as BeginToken)).endToken != null) {
reportError4(ParserErrorCode.EXPECTED_TOKEN, [TokenType.COMMA.lexeme]);
} else {
+ reportError5(ParserErrorCode.MISSING_CLOSING_PARENTHESIS, _currentToken.previous, []);
break;
}
}
@@ -2185,11 +2252,11 @@
if (variableList == null) {
reportError4(ParserErrorCode.MISSING_VARIABLE_IN_FOR_EACH, []);
} else {
- NodeList<VariableDeclaration> variables3 = variableList.variables;
- if (variables3.length > 1) {
- reportError4(ParserErrorCode.MULTIPLE_VARIABLES_IN_FOR_EACH, [variables3.length.toString()]);
+ NodeList<VariableDeclaration> variables2 = variableList.variables;
+ if (variables2.length > 1) {
+ reportError4(ParserErrorCode.MULTIPLE_VARIABLES_IN_FOR_EACH, [variables2.length.toString()]);
}
- VariableDeclaration variable = variables3[0];
+ VariableDeclaration variable = variables2[0];
if (variable.initializer != null) {
reportError4(ParserErrorCode.INITIALIZED_VARIABLE_IN_FOR_EACH, []);
}
@@ -2255,13 +2322,13 @@
return new ExpressionFunctionBody.full(functionDefinition, expression, semicolon);
} else if (matches5(TokenType.OPEN_CURLY_BRACKET)) {
return new BlockFunctionBody.full(parseBlock());
- } else if (matches2("native")) {
- advance();
- parseStringLiteral();
- return new EmptyFunctionBody.full(andAdvance);
+ } else if (matches2(_NATIVE)) {
+ Token nativeToken = andAdvance;
+ StringLiteral stringLiteral = parseStringLiteral();
+ return new NativeFunctionBody.full(nativeToken, stringLiteral, expect2(TokenType.SEMICOLON));
} else {
reportError4(ParserErrorCode.MISSING_FUNCTION_BODY, []);
- return new EmptyFunctionBody.full(createSyntheticToken(TokenType.SEMICOLON));
+ return new EmptyFunctionBody.full(createSyntheticToken2(TokenType.SEMICOLON));
}
} finally {
_inLoop = wasInLoop;
@@ -2337,7 +2404,7 @@
* Parse a function expression.
* <pre>
* functionExpression ::=
- * (returnType? identifier)? formalParameterList functionExpressionBody
+ * formalParameterList functionExpressionBody
* </pre>
* @return the function expression that was parsed
*/
@@ -2371,10 +2438,11 @@
}
if (matches5(TokenType.SEMICOLON) || matches5(TokenType.EOF)) {
reportError4(ParserErrorCode.MISSING_TYPEDEF_PARAMETERS, []);
- FormalParameterList parameters = new FormalParameterList.full(createSyntheticToken(TokenType.OPEN_PAREN), null, null, null, createSyntheticToken(TokenType.CLOSE_PAREN));
+ FormalParameterList parameters = new FormalParameterList.full(createSyntheticToken2(TokenType.OPEN_PAREN), null, null, null, createSyntheticToken2(TokenType.CLOSE_PAREN));
Token semicolon = expect2(TokenType.SEMICOLON);
return new FunctionTypeAlias.full(commentAndMetadata.comment, commentAndMetadata.metadata, keyword, returnType, name, typeParameters, parameters, semicolon);
} else if (!matches5(TokenType.OPEN_PAREN)) {
+ reportError4(ParserErrorCode.MISSING_TYPEDEF_PARAMETERS, []);
return null;
}
FormalParameterList parameters = parseFormalParameterList();
@@ -2643,7 +2711,7 @@
return parseListLiteral(modifier, typeArguments);
}
reportError4(ParserErrorCode.EXPECTED_LIST_OR_MAP_LITERAL, []);
- return new ListLiteral.full(modifier, typeArguments, createSyntheticToken(TokenType.OPEN_SQUARE_BRACKET), null, createSyntheticToken(TokenType.CLOSE_SQUARE_BRACKET));
+ return new ListLiteral.full(modifier, typeArguments, createSyntheticToken2(TokenType.OPEN_SQUARE_BRACKET), null, createSyntheticToken2(TokenType.CLOSE_SQUARE_BRACKET));
}
/**
* Parse a logical and expression.
@@ -2901,34 +2969,34 @@
}
return parseBlock();
} else if (matches5(TokenType.KEYWORD) && !((_currentToken as KeywordToken)).keyword.isPseudoKeyword()) {
- Keyword keyword31 = ((_currentToken as KeywordToken)).keyword;
- if (identical(keyword31, Keyword.ASSERT)) {
+ Keyword keyword2 = ((_currentToken as KeywordToken)).keyword;
+ if (identical(keyword2, Keyword.ASSERT)) {
return parseAssertStatement();
- } else if (identical(keyword31, Keyword.BREAK)) {
+ } else if (identical(keyword2, Keyword.BREAK)) {
return parseBreakStatement();
- } else if (identical(keyword31, Keyword.CONTINUE)) {
+ } else if (identical(keyword2, Keyword.CONTINUE)) {
return parseContinueStatement();
- } else if (identical(keyword31, Keyword.DO)) {
+ } else if (identical(keyword2, Keyword.DO)) {
return parseDoStatement();
- } else if (identical(keyword31, Keyword.FOR)) {
+ } else if (identical(keyword2, Keyword.FOR)) {
return parseForStatement();
- } else if (identical(keyword31, Keyword.IF)) {
+ } else if (identical(keyword2, Keyword.IF)) {
return parseIfStatement();
- } else if (identical(keyword31, Keyword.RETHROW)) {
+ } else if (identical(keyword2, Keyword.RETHROW)) {
return new ExpressionStatement.full(parseRethrowExpression(), expect2(TokenType.SEMICOLON));
- } else if (identical(keyword31, Keyword.RETURN)) {
+ } else if (identical(keyword2, Keyword.RETURN)) {
return parseReturnStatement();
- } else if (identical(keyword31, Keyword.SWITCH)) {
+ } else if (identical(keyword2, Keyword.SWITCH)) {
return parseSwitchStatement();
- } else if (identical(keyword31, Keyword.THROW)) {
+ } else if (identical(keyword2, Keyword.THROW)) {
return new ExpressionStatement.full(parseThrowExpression(), expect2(TokenType.SEMICOLON));
- } else if (identical(keyword31, Keyword.TRY)) {
+ } else if (identical(keyword2, Keyword.TRY)) {
return parseTryStatement();
- } else if (identical(keyword31, Keyword.WHILE)) {
+ } else if (identical(keyword2, Keyword.WHILE)) {
return parseWhileStatement();
- } else if (identical(keyword31, Keyword.VAR) || identical(keyword31, Keyword.FINAL)) {
+ } else if (identical(keyword2, Keyword.VAR) || identical(keyword2, Keyword.FINAL)) {
return parseVariableDeclarationStatement(commentAndMetadata);
- } else if (identical(keyword31, Keyword.VOID)) {
+ } else if (identical(keyword2, Keyword.VOID)) {
TypeName returnType = parseReturnType();
if (matchesIdentifier() && matchesAny(peek(), [TokenType.OPEN_PAREN, TokenType.OPEN_CURLY_BRACKET, TokenType.FUNCTION])) {
return parseFunctionDeclarationStatement2(commentAndMetadata, returnType);
@@ -2938,10 +3006,13 @@
reportError(ParserErrorCode.VOID_VARIABLE, returnType, []);
return parseVariableDeclarationStatement(commentAndMetadata);
}
+ } else if (matches5(TokenType.CLOSE_CURLY_BRACKET)) {
+ return parseVariableDeclarationStatement2(commentAndMetadata, null, returnType);
}
+ reportError4(ParserErrorCode.MISSING_STATEMENT, []);
return null;
}
- } else if (identical(keyword31, Keyword.CONST)) {
+ } else if (identical(keyword2, Keyword.CONST)) {
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)) {
@@ -2953,9 +3024,10 @@
}
}
return parseVariableDeclarationStatement(commentAndMetadata);
- } else if (identical(keyword31, Keyword.NEW) || identical(keyword31, Keyword.TRUE) || identical(keyword31, Keyword.FALSE) || identical(keyword31, Keyword.NULL) || identical(keyword31, Keyword.SUPER) || identical(keyword31, Keyword.THIS)) {
+ } else if (identical(keyword2, Keyword.NEW) || identical(keyword2, Keyword.TRUE) || identical(keyword2, Keyword.FALSE) || identical(keyword2, Keyword.NULL) || identical(keyword2, Keyword.SUPER) || identical(keyword2, Keyword.THIS)) {
return new ExpressionStatement.full(parseExpression2(), expect2(TokenType.SEMICOLON));
} else {
+ reportError4(ParserErrorCode.MISSING_STATEMENT, []);
return null;
}
} else if (matches5(TokenType.SEMICOLON)) {
@@ -2966,7 +3038,7 @@
return parseFunctionDeclarationStatement();
} else if (matches5(TokenType.CLOSE_CURLY_BRACKET)) {
reportError4(ParserErrorCode.MISSING_STATEMENT, []);
- return new EmptyStatement.full(createSyntheticToken(TokenType.SEMICOLON));
+ return new EmptyStatement.full(createSyntheticToken2(TokenType.SEMICOLON));
} else {
return new ExpressionStatement.full(parseExpression2(), expect2(TokenType.SEMICOLON));
}
@@ -3004,9 +3076,9 @@
FormalParameterList parameters = parseFormalParameterList();
return new FunctionTypedFormalParameter.full(commentAndMetadata.comment, commentAndMetadata.metadata, holder.type, identifier, parameters);
}
- TypeName type22 = holder.type;
- if (type22 != null && matches3(type22.name.beginToken, Keyword.VOID)) {
- reportError5(ParserErrorCode.VOID_PARAMETER, type22.name.beginToken, []);
+ TypeName type2 = holder.type;
+ if (type2 != null && matches3(type2.name.beginToken, Keyword.VOID)) {
+ reportError5(ParserErrorCode.VOID_PARAMETER, type2.name.beginToken, []);
}
if (thisKeyword != null) {
return new FieldFormalParameter.full(commentAndMetadata.comment, commentAndMetadata.metadata, holder.keyword, holder.type, thisKeyword, period, identifier);
@@ -3029,11 +3101,24 @@
* @return the operator declaration that was parsed
*/
MethodDeclaration parseOperator(CommentAndMetadata commentAndMetadata, Token externalKeyword, TypeName returnType) {
- Token operatorKeyword = expect(Keyword.OPERATOR);
+ Token operatorKeyword;
+ if (matches(Keyword.OPERATOR)) {
+ operatorKeyword = andAdvance;
+ } else {
+ reportError5(ParserErrorCode.MISSING_KEYWORD_OPERATOR, _currentToken, []);
+ operatorKeyword = createSyntheticToken(Keyword.OPERATOR);
+ }
if (!_currentToken.isUserDefinableOperator()) {
reportError4(ParserErrorCode.NON_USER_DEFINABLE_OPERATOR, [_currentToken.lexeme]);
}
SimpleIdentifier name = new SimpleIdentifier.full(andAdvance);
+ if (matches5(TokenType.EQ)) {
+ Token previous2 = _currentToken.previous;
+ if ((matches4(previous2, TokenType.EQ_EQ) || matches4(previous2, TokenType.BANG_EQ)) && _currentToken.offset == previous2.offset + 2) {
+ reportError4(ParserErrorCode.INVALID_OPERATOR, ["${previous2.lexeme}${_currentToken.lexeme}"]);
+ advance();
+ }
+ }
FormalParameterList parameters = parseFormalParameterList();
validateFormalParameterList(parameters);
FunctionBody body = parseFunctionBody(true, false);
@@ -3524,6 +3609,7 @@
Expression expression = parseExpression2();
Token rightParenthesis = expect2(TokenType.CLOSE_PAREN);
Token leftBracket = expect2(TokenType.OPEN_CURLY_BRACKET);
+ Token defaultKeyword = null;
List<SwitchMember> members = new List<SwitchMember>();
while (!matches5(TokenType.EOF) && !matches5(TokenType.CLOSE_CURLY_BRACKET)) {
List<Label> labels = new List<Label>();
@@ -3543,8 +3629,14 @@
Expression caseExpression = parseExpression2();
Token colon = expect2(TokenType.COLON);
members.add(new SwitchCase.full(labels, caseKeyword, caseExpression, colon, parseStatements2()));
+ if (defaultKeyword != null) {
+ reportError5(ParserErrorCode.SWITCH_HAS_CASE_AFTER_DEFAULT_CASE, caseKeyword, []);
+ }
} else if (matches(Keyword.DEFAULT)) {
- Token defaultKeyword = andAdvance;
+ if (defaultKeyword != null) {
+ reportError5(ParserErrorCode.SWITCH_HAS_MULTIPLE_DEFAULT_CASES, peek(), []);
+ }
+ defaultKeyword = andAdvance;
Token colon = expect2(TokenType.COLON);
members.add(new SwitchDefault.full(labels, defaultKeyword, colon, parseStatements2()));
} else {
@@ -3785,9 +3877,9 @@
return new PrefixExpression.full(operator, parseUnaryExpression());
}
if (identical(operator.type, TokenType.MINUS_MINUS)) {
- int offset9 = operator.offset;
- Token firstOperator = new Token(TokenType.MINUS, offset9);
- Token secondOperator = new Token(TokenType.MINUS, offset9 + 1);
+ int offset2 = operator.offset;
+ Token firstOperator = new Token(TokenType.MINUS, offset2);
+ Token secondOperator = new Token(TokenType.MINUS, offset2 + 1);
secondOperator.setNext(_currentToken);
firstOperator.setNext(secondOperator);
operator.previous.setNext(firstOperator);
@@ -3841,8 +3933,7 @@
* variableDeclarationList ::=
* finalConstVarOrType variableDeclaration (',' variableDeclaration)
* </pre>
- * @param commentAndMetadata the metadata to be associated with the variable declaration list, or
- * <code>null</code> if there is no attempt at parsing the comment and metadata
+ * @param commentAndMetadata the metadata to be associated with the variable declaration list, or{@code null} if there is no attempt at parsing the comment and metadata
* @param keyword the token representing the 'final', 'const' or 'var' keyword, or {@code null} if
* there is no keyword
* @param type the type of the variables in the list
@@ -3863,6 +3954,8 @@
* variableDeclarationStatement ::=
* variableDeclarationList ';'
* </pre>
+ * @param commentAndMetadata the metadata to be associated with the variable declaration
+ * statement, or {@code null} if there is no attempt at parsing the comment and metadata
* @return the variable declaration statement that was parsed
*/
VariableDeclarationStatement parseVariableDeclarationStatement(CommentAndMetadata commentAndMetadata) {
@@ -3871,6 +3964,24 @@
return new VariableDeclarationStatement.full(variableList, semicolon);
}
/**
+ * Parse a variable declaration statement.
+ * <pre>
+ * variableDeclarationStatement ::=
+ * variableDeclarationList ';'
+ * </pre>
+ * @param commentAndMetadata the metadata to be associated with the variable declaration
+ * statement, or {@code null} if there is no attempt at parsing the comment and metadata
+ * @param keyword the token representing the 'final', 'const' or 'var' keyword, or {@code null} if
+ * there is no keyword
+ * @param type the type of the variables in the list
+ * @return the variable declaration statement that was parsed
+ */
+ VariableDeclarationStatement parseVariableDeclarationStatement2(CommentAndMetadata commentAndMetadata, Token keyword, TypeName type) {
+ VariableDeclarationList variableList = parseVariableDeclarationList2(commentAndMetadata, keyword, type);
+ Token semicolon = expect2(TokenType.SEMICOLON);
+ return new VariableDeclarationStatement.full(variableList, semicolon);
+ }
+ /**
* Parse a while statement.
* <pre>
* whileStatement ::=
@@ -3969,15 +4080,15 @@
*/
Token skipFinalConstVarOrType(Token startToken) {
if (matches3(startToken, Keyword.FINAL) || matches3(startToken, Keyword.CONST)) {
- Token next3 = startToken.next;
- if (matchesIdentifier2(next3.next) || matches4(next3.next, TokenType.LT) || matches3(next3.next, Keyword.THIS)) {
- return skipTypeName(next3);
+ Token next2 = startToken.next;
+ if (matchesIdentifier2(next2.next) || matches4(next2.next, TokenType.LT) || matches3(next2.next, Keyword.THIS)) {
+ return skipTypeName(next2);
}
} else if (matches3(startToken, Keyword.VAR)) {
return startToken.next;
} else if (matchesIdentifier2(startToken)) {
- Token next4 = startToken.next;
- if (matchesIdentifier2(next4) || matches4(next4, TokenType.LT) || matches3(next4, Keyword.THIS) || (matches4(next4, TokenType.PERIOD) && matchesIdentifier2(next4.next) && (matchesIdentifier2(next4.next.next) || matches4(next4.next.next, TokenType.LT) || matches3(next4.next.next, Keyword.THIS)))) {
+ Token next3 = startToken.next;
+ if (matchesIdentifier2(next3) || matches4(next3, TokenType.LT) || matches3(next3, Keyword.THIS) || (matches4(next3, TokenType.PERIOD) && matchesIdentifier2(next3.next) && (matchesIdentifier2(next3.next.next) || matches4(next3.next.next, TokenType.LT) || matches3(next3.next.next, Keyword.THIS)))) {
return skipReturnType(startToken);
}
}
@@ -4018,20 +4129,20 @@
if (!matches4(startToken, TokenType.OPEN_PAREN)) {
return null;
}
- Token next5 = startToken.next;
- if (matches4(next5, TokenType.CLOSE_PAREN)) {
- return next5.next;
+ Token next2 = startToken.next;
+ if (matches4(next2, TokenType.CLOSE_PAREN)) {
+ return next2.next;
}
- if (matchesAny(next5, [TokenType.AT, TokenType.OPEN_SQUARE_BRACKET, TokenType.OPEN_CURLY_BRACKET]) || matches3(next5, Keyword.VOID) || (matchesIdentifier2(next5) && (matchesAny(next5.next, [TokenType.COMMA, TokenType.CLOSE_PAREN])))) {
+ if (matchesAny(next2, [TokenType.AT, TokenType.OPEN_SQUARE_BRACKET, TokenType.OPEN_CURLY_BRACKET]) || matches3(next2, Keyword.VOID) || (matchesIdentifier2(next2) && (matchesAny(next2.next, [TokenType.COMMA, TokenType.CLOSE_PAREN])))) {
return skipPastMatchingToken(startToken);
}
- if (matchesIdentifier2(next5) && matches4(next5.next, TokenType.OPEN_PAREN)) {
- Token afterParameters = skipFormalParameterList(next5.next);
+ if (matchesIdentifier2(next2) && matches4(next2.next, TokenType.OPEN_PAREN)) {
+ Token afterParameters = skipFormalParameterList(next2.next);
if (afterParameters != null && (matchesAny(afterParameters, [TokenType.COMMA, TokenType.CLOSE_PAREN]))) {
return skipPastMatchingToken(startToken);
}
}
- Token afterType = skipFinalConstVarOrType(next5);
+ Token afterType = skipFinalConstVarOrType(next2);
if (afterType == null) {
return null;
}
@@ -4131,20 +4242,20 @@
*/
Token skipStringInterpolation(Token startToken) {
Token token = startToken;
- TokenType type23 = token.type;
- while (identical(type23, TokenType.STRING_INTERPOLATION_EXPRESSION) || identical(type23, TokenType.STRING_INTERPOLATION_IDENTIFIER)) {
- if (identical(type23, TokenType.STRING_INTERPOLATION_EXPRESSION)) {
+ TokenType type2 = token.type;
+ while (identical(type2, TokenType.STRING_INTERPOLATION_EXPRESSION) || identical(type2, TokenType.STRING_INTERPOLATION_IDENTIFIER)) {
+ if (identical(type2, TokenType.STRING_INTERPOLATION_EXPRESSION)) {
token = token.next;
- type23 = token.type;
+ type2 = token.type;
int bracketNestingLevel = 1;
while (bracketNestingLevel > 0) {
- if (identical(type23, TokenType.EOF)) {
+ if (identical(type2, TokenType.EOF)) {
return null;
- } else if (identical(type23, TokenType.OPEN_CURLY_BRACKET)) {
+ } else if (identical(type2, TokenType.OPEN_CURLY_BRACKET)) {
bracketNestingLevel++;
- } else if (identical(type23, TokenType.CLOSE_CURLY_BRACKET)) {
+ } else if (identical(type2, TokenType.CLOSE_CURLY_BRACKET)) {
bracketNestingLevel--;
- } else if (identical(type23, TokenType.STRING)) {
+ } else if (identical(type2, TokenType.STRING)) {
token = skipStringLiteral(token);
if (token == null) {
return null;
@@ -4152,10 +4263,10 @@
} else {
token = token.next;
}
- type23 = token.type;
+ type2 = token.type;
}
token = token.next;
- type23 = token.type;
+ type2 = token.type;
} else {
token = token.next;
if (token.type != TokenType.IDENTIFIER) {
@@ -4163,10 +4274,10 @@
}
token = token.next;
}
- type23 = token.type;
- if (identical(type23, TokenType.STRING)) {
+ type2 = token.type;
+ if (identical(type2, TokenType.STRING)) {
token = token.next;
- type23 = token.type;
+ type2 = token.type;
}
}
return token;
@@ -4189,8 +4300,8 @@
Token token = startToken;
while (token != null && matches4(token, TokenType.STRING)) {
token = token.next;
- TokenType type24 = token.type;
- if (identical(type24, TokenType.STRING_INTERPOLATION_EXPRESSION) || identical(type24, TokenType.STRING_INTERPOLATION_IDENTIFIER)) {
+ TokenType type2 = token.type;
+ if (identical(type2, TokenType.STRING_INTERPOLATION_EXPRESSION) || identical(type2, TokenType.STRING_INTERPOLATION_IDENTIFIER)) {
token = skipStringInterpolation(token);
}
}
@@ -4279,36 +4390,36 @@
return null;
}
int depth = 1;
- Token next6 = startToken.next;
+ Token next2 = startToken.next;
while (depth > 0) {
- if (matches4(next6, TokenType.EOF)) {
+ if (matches4(next2, TokenType.EOF)) {
return null;
- } else if (matches4(next6, TokenType.LT)) {
+ } else if (matches4(next2, TokenType.LT)) {
depth++;
- } else if (matches4(next6, TokenType.GT)) {
+ } else if (matches4(next2, TokenType.GT)) {
depth--;
- } else if (matches4(next6, TokenType.GT_EQ)) {
+ } else if (matches4(next2, TokenType.GT_EQ)) {
if (depth == 1) {
- Token fakeEquals = new Token(TokenType.EQ, next6.offset + 2);
- fakeEquals.setNextWithoutSettingPrevious(next6.next);
+ Token fakeEquals = new Token(TokenType.EQ, next2.offset + 2);
+ fakeEquals.setNextWithoutSettingPrevious(next2.next);
return fakeEquals;
}
depth--;
- } else if (matches4(next6, TokenType.GT_GT)) {
+ } else if (matches4(next2, TokenType.GT_GT)) {
depth -= 2;
- } else if (matches4(next6, TokenType.GT_GT_EQ)) {
+ } else if (matches4(next2, TokenType.GT_GT_EQ)) {
if (depth < 2) {
return null;
} else if (depth == 2) {
- Token fakeEquals = new Token(TokenType.EQ, next6.offset + 2);
- fakeEquals.setNextWithoutSettingPrevious(next6.next);
+ Token fakeEquals = new Token(TokenType.EQ, next2.offset + 2);
+ fakeEquals.setNextWithoutSettingPrevious(next2.next);
return fakeEquals;
}
depth -= 2;
}
- next6 = next6.next;
+ next2 = next2.next;
}
- return next6;
+ return next2;
}
/**
* Translate the characters at the given index in the given string, appending the translated
@@ -4324,10 +4435,10 @@
builder.appendChar(currentChar);
return index + 1;
}
- int length8 = lexeme.length;
+ int length2 = lexeme.length;
int currentIndex = index + 1;
- if (currentIndex >= length8) {
- return length8;
+ if (currentIndex >= length2) {
+ return length2;
}
currentChar = lexeme.codeUnitAt(currentIndex);
if (currentChar == 0x6E) {
@@ -4343,9 +4454,9 @@
} else if (currentChar == 0x76) {
builder.appendChar(0xB);
} else if (currentChar == 0x78) {
- if (currentIndex + 2 >= length8) {
+ if (currentIndex + 2 >= length2) {
reportError4(ParserErrorCode.INVALID_HEX_ESCAPE, []);
- return length8;
+ return length2;
}
int firstDigit = lexeme.codeUnitAt(currentIndex + 1);
int secondDigit = lexeme.codeUnitAt(currentIndex + 2);
@@ -4357,16 +4468,16 @@
return currentIndex + 3;
} else if (currentChar == 0x75) {
currentIndex++;
- if (currentIndex >= length8) {
+ if (currentIndex >= length2) {
reportError4(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
- return length8;
+ return length2;
}
currentChar = lexeme.codeUnitAt(currentIndex);
if (currentChar == 0x7B) {
currentIndex++;
- if (currentIndex >= length8) {
+ if (currentIndex >= length2) {
reportError4(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
- return length8;
+ return length2;
}
currentChar = lexeme.codeUnitAt(currentIndex);
int digitCount = 0;
@@ -4375,7 +4486,7 @@
if (!isHexDigit(currentChar)) {
reportError4(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
currentIndex++;
- while (currentIndex < length8 && lexeme.codeUnitAt(currentIndex) != 0x7D) {
+ while (currentIndex < length2 && lexeme.codeUnitAt(currentIndex) != 0x7D) {
currentIndex++;
}
return currentIndex + 1;
@@ -4383,9 +4494,9 @@
digitCount++;
value = (value << 4) + Character.digit(currentChar, 16);
currentIndex++;
- if (currentIndex >= length8) {
+ if (currentIndex >= length2) {
reportError4(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
- return length8;
+ return length2;
}
currentChar = lexeme.codeUnitAt(currentIndex);
}
@@ -4395,9 +4506,9 @@
appendScalarValue(builder, lexeme.substring(index, currentIndex + 1), value, index, currentIndex);
return currentIndex + 1;
} else {
- if (currentIndex + 3 >= length8) {
+ if (currentIndex + 3 >= length2) {
reportError4(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
- return length8;
+ return length2;
}
int firstDigit = currentChar;
int secondDigit = lexeme.codeUnitAt(currentIndex + 1);
@@ -4466,16 +4577,16 @@
if (modifiers.varKeyword != null) {
reportError5(ParserErrorCode.CONSTRUCTOR_WITH_RETURN_TYPE, modifiers.varKeyword, []);
}
- Token externalKeyword6 = modifiers.externalKeyword;
- Token constKeyword4 = modifiers.constKeyword;
- Token factoryKeyword4 = modifiers.factoryKeyword;
- if (externalKeyword6 != null && constKeyword4 != null && constKeyword4.offset < externalKeyword6.offset) {
- reportError5(ParserErrorCode.EXTERNAL_AFTER_CONST, externalKeyword6, []);
+ Token externalKeyword2 = modifiers.externalKeyword;
+ Token constKeyword2 = modifiers.constKeyword;
+ Token factoryKeyword2 = modifiers.factoryKeyword;
+ if (externalKeyword2 != null && constKeyword2 != null && constKeyword2.offset < externalKeyword2.offset) {
+ reportError5(ParserErrorCode.EXTERNAL_AFTER_CONST, externalKeyword2, []);
}
- if (externalKeyword6 != null && factoryKeyword4 != null && factoryKeyword4.offset < externalKeyword6.offset) {
- reportError5(ParserErrorCode.EXTERNAL_AFTER_FACTORY, externalKeyword6, []);
+ if (externalKeyword2 != null && factoryKeyword2 != null && factoryKeyword2.offset < externalKeyword2.offset) {
+ reportError5(ParserErrorCode.EXTERNAL_AFTER_FACTORY, externalKeyword2, []);
}
- return constKeyword4;
+ return constKeyword2;
}
/**
* Validate that the given set of modifiers is appropriate for a field and return the 'final',
@@ -4493,31 +4604,31 @@
if (modifiers.factoryKeyword != null) {
reportError5(ParserErrorCode.NON_CONSTRUCTOR_FACTORY, modifiers.factoryKeyword, []);
}
- Token staticKeyword3 = modifiers.staticKeyword;
- Token constKeyword5 = modifiers.constKeyword;
- Token finalKeyword3 = modifiers.finalKeyword;
- Token varKeyword3 = modifiers.varKeyword;
- if (constKeyword5 != null) {
- if (finalKeyword3 != null) {
- reportError5(ParserErrorCode.CONST_AND_FINAL, finalKeyword3, []);
+ Token staticKeyword2 = modifiers.staticKeyword;
+ Token constKeyword2 = modifiers.constKeyword;
+ Token finalKeyword2 = modifiers.finalKeyword;
+ Token varKeyword2 = modifiers.varKeyword;
+ if (constKeyword2 != null) {
+ if (finalKeyword2 != null) {
+ reportError5(ParserErrorCode.CONST_AND_FINAL, finalKeyword2, []);
}
- if (varKeyword3 != null) {
- reportError5(ParserErrorCode.CONST_AND_VAR, varKeyword3, []);
+ if (varKeyword2 != null) {
+ reportError5(ParserErrorCode.CONST_AND_VAR, varKeyword2, []);
}
- if (staticKeyword3 != null && constKeyword5.offset < staticKeyword3.offset) {
- reportError5(ParserErrorCode.STATIC_AFTER_CONST, staticKeyword3, []);
+ if (staticKeyword2 != null && constKeyword2.offset < staticKeyword2.offset) {
+ reportError5(ParserErrorCode.STATIC_AFTER_CONST, staticKeyword2, []);
}
- } else if (finalKeyword3 != null) {
- if (varKeyword3 != null) {
- reportError5(ParserErrorCode.FINAL_AND_VAR, varKeyword3, []);
+ } else if (finalKeyword2 != null) {
+ if (varKeyword2 != null) {
+ reportError5(ParserErrorCode.FINAL_AND_VAR, varKeyword2, []);
}
- if (staticKeyword3 != null && finalKeyword3.offset < staticKeyword3.offset) {
- reportError5(ParserErrorCode.STATIC_AFTER_FINAL, staticKeyword3, []);
+ if (staticKeyword2 != null && finalKeyword2.offset < staticKeyword2.offset) {
+ reportError5(ParserErrorCode.STATIC_AFTER_FINAL, staticKeyword2, []);
}
- } else if (varKeyword3 != null && staticKeyword3 != null && varKeyword3.offset < staticKeyword3.offset) {
- reportError5(ParserErrorCode.STATIC_AFTER_VAR, staticKeyword3, []);
+ } else if (varKeyword2 != null && staticKeyword2 != null && varKeyword2.offset < staticKeyword2.offset) {
+ reportError5(ParserErrorCode.STATIC_AFTER_VAR, staticKeyword2, []);
}
- return lexicallyFirst([constKeyword5, finalKeyword3, varKeyword3]);
+ return lexicallyFirst([constKeyword2, finalKeyword2, varKeyword2]);
}
/**
* Validate that the given set of modifiers is appropriate for a getter, setter, or method.
@@ -4539,10 +4650,10 @@
if (modifiers.varKeyword != null) {
reportError5(ParserErrorCode.VAR_RETURN_TYPE, modifiers.varKeyword, []);
}
- Token externalKeyword7 = modifiers.externalKeyword;
- Token staticKeyword4 = modifiers.staticKeyword;
- if (externalKeyword7 != null && staticKeyword4 != null && staticKeyword4.offset < externalKeyword7.offset) {
- reportError5(ParserErrorCode.EXTERNAL_AFTER_STATIC, externalKeyword7, []);
+ Token externalKeyword2 = modifiers.externalKeyword;
+ Token staticKeyword2 = modifiers.staticKeyword;
+ if (externalKeyword2 != null && staticKeyword2 != null && staticKeyword2.offset < externalKeyword2.offset) {
+ reportError5(ParserErrorCode.EXTERNAL_AFTER_STATIC, externalKeyword2, []);
}
}
/**
@@ -4614,22 +4725,22 @@
if (modifiers.externalKeyword != null) {
reportError5(ParserErrorCode.EXTERNAL_FIELD, modifiers.externalKeyword, []);
}
- Token constKeyword6 = modifiers.constKeyword;
- Token finalKeyword4 = modifiers.finalKeyword;
- Token varKeyword4 = modifiers.varKeyword;
- if (constKeyword6 != null) {
- if (finalKeyword4 != null) {
- reportError5(ParserErrorCode.CONST_AND_FINAL, finalKeyword4, []);
+ Token constKeyword2 = modifiers.constKeyword;
+ Token finalKeyword2 = modifiers.finalKeyword;
+ Token varKeyword2 = modifiers.varKeyword;
+ if (constKeyword2 != null) {
+ if (finalKeyword2 != null) {
+ reportError5(ParserErrorCode.CONST_AND_FINAL, finalKeyword2, []);
}
- if (varKeyword4 != null) {
- reportError5(ParserErrorCode.CONST_AND_VAR, varKeyword4, []);
+ if (varKeyword2 != null) {
+ reportError5(ParserErrorCode.CONST_AND_VAR, varKeyword2, []);
}
- } else if (finalKeyword4 != null) {
- if (varKeyword4 != null) {
- reportError5(ParserErrorCode.FINAL_AND_VAR, varKeyword4, []);
+ } else if (finalKeyword2 != null) {
+ if (varKeyword2 != null) {
+ reportError5(ParserErrorCode.FINAL_AND_VAR, varKeyword2, []);
}
}
- return lexicallyFirst([constKeyword6, finalKeyword4, varKeyword4]);
+ return lexicallyFirst([constKeyword2, finalKeyword2, varKeyword2]);
}
/**
* Validate that the given set of modifiers is appropriate for a class and return the 'abstract'
@@ -4655,9 +4766,13 @@
}
}
}
-class AnalysisErrorListener_8 implements AnalysisErrorListener {
+class KeywordToken_11 extends KeywordToken {
+ KeywordToken_11(Keyword arg0, int arg1) : super(arg0, arg1);
+ int get length => 0;
+}
+class AnalysisErrorListener_12 implements AnalysisErrorListener {
List<bool> errorFound;
- AnalysisErrorListener_8(this.errorFound);
+ AnalysisErrorListener_12(this.errorFound);
void onError(AnalysisError error) {
errorFound[0] = true;
}
@@ -4669,7 +4784,7 @@
* when appropriate, how the problem can be corrected.
* @coverage dart.engine.parser
*/
-class ParserErrorCode implements ErrorCode {
+class ParserErrorCode implements Comparable<ParserErrorCode>, ErrorCode {
static final ParserErrorCode ABSTRACT_CLASS_MEMBER = new ParserErrorCode.con2('ABSTRACT_CLASS_MEMBER', 0, "Members of classes cannot be declared to be 'abstract'");
static final ParserErrorCode ABSTRACT_STATIC_METHOD = new ParserErrorCode.con2('ABSTRACT_STATIC_METHOD', 1, "Static methods cannot be declared to be 'abstract'");
static final ParserErrorCode ABSTRACT_TOP_LEVEL_FUNCTION = new ParserErrorCode.con2('ABSTRACT_TOP_LEVEL_FUNCTION', 2, "Top-level functions cannot be declared to be 'abstract'");
@@ -4688,90 +4803,100 @@
static final ParserErrorCode DUPLICATE_LABEL_IN_SWITCH_STATEMENT = new ParserErrorCode.con2('DUPLICATE_LABEL_IN_SWITCH_STATEMENT', 15, "The label %s was already used in this switch statement");
static final ParserErrorCode DUPLICATED_MODIFIER = new ParserErrorCode.con2('DUPLICATED_MODIFIER', 16, "The modifier '%s' was already specified.");
static final ParserErrorCode EXPECTED_CASE_OR_DEFAULT = new ParserErrorCode.con2('EXPECTED_CASE_OR_DEFAULT', 17, "Expected 'case' or 'default'");
- static final ParserErrorCode EXPECTED_LIST_OR_MAP_LITERAL = new ParserErrorCode.con2('EXPECTED_LIST_OR_MAP_LITERAL', 18, "Expected a list or map literal");
- static final ParserErrorCode EXPECTED_STRING_LITERAL = new ParserErrorCode.con2('EXPECTED_STRING_LITERAL', 19, "Expected a string literal");
- static final ParserErrorCode EXPECTED_TOKEN = new ParserErrorCode.con2('EXPECTED_TOKEN', 20, "Expected to find '%s'");
- static final ParserErrorCode EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE = new ParserErrorCode.con2('EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE', 21, "Export directives must preceed part directives");
- static final ParserErrorCode EXTERNAL_AFTER_CONST = new ParserErrorCode.con2('EXTERNAL_AFTER_CONST', 22, "The modifier 'external' should be before the modifier 'const'");
- static final ParserErrorCode EXTERNAL_AFTER_FACTORY = new ParserErrorCode.con2('EXTERNAL_AFTER_FACTORY', 23, "The modifier 'external' should be before the modifier 'factory'");
- static final ParserErrorCode EXTERNAL_AFTER_STATIC = new ParserErrorCode.con2('EXTERNAL_AFTER_STATIC', 24, "The modifier 'external' should be before the modifier 'static'");
- static final ParserErrorCode EXTERNAL_CLASS = new ParserErrorCode.con2('EXTERNAL_CLASS', 25, "Classes cannot be declared to be 'external'");
- static final ParserErrorCode EXTERNAL_CONSTRUCTOR_WITH_BODY = new ParserErrorCode.con2('EXTERNAL_CONSTRUCTOR_WITH_BODY', 26, "External constructors cannot have a body");
- static final ParserErrorCode EXTERNAL_FIELD = new ParserErrorCode.con2('EXTERNAL_FIELD', 27, "Fields cannot be declared to be 'external'");
- static final ParserErrorCode EXTERNAL_GETTER_WITH_BODY = new ParserErrorCode.con2('EXTERNAL_GETTER_WITH_BODY', 28, "External getters cannot have a body");
- static final ParserErrorCode EXTERNAL_METHOD_WITH_BODY = new ParserErrorCode.con2('EXTERNAL_METHOD_WITH_BODY', 29, "External methods cannot have a body");
- static final ParserErrorCode EXTERNAL_OPERATOR_WITH_BODY = new ParserErrorCode.con2('EXTERNAL_OPERATOR_WITH_BODY', 30, "External operators cannot have a body");
- static final ParserErrorCode EXTERNAL_SETTER_WITH_BODY = new ParserErrorCode.con2('EXTERNAL_SETTER_WITH_BODY', 31, "External setters cannot have a body");
- static final ParserErrorCode EXTERNAL_TYPEDEF = new ParserErrorCode.con2('EXTERNAL_TYPEDEF', 32, "Type aliases cannot be declared to be 'external'");
- static final ParserErrorCode FACTORY_TOP_LEVEL_DECLARATION = new ParserErrorCode.con2('FACTORY_TOP_LEVEL_DECLARATION', 33, "Top-level declarations cannot be declared to be 'factory'");
- static final ParserErrorCode FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR = new ParserErrorCode.con2('FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR', 34, "Field initializers can only be used in a constructor");
- static final ParserErrorCode FINAL_AND_VAR = new ParserErrorCode.con2('FINAL_AND_VAR', 35, "Members cannot be declared to be both 'final' and 'var'");
- static final ParserErrorCode FINAL_CLASS = new ParserErrorCode.con2('FINAL_CLASS', 36, "Classes cannot be declared to be 'final'");
- static final ParserErrorCode FINAL_CONSTRUCTOR = new ParserErrorCode.con2('FINAL_CONSTRUCTOR', 37, "A constructor cannot be declared to be 'final'");
- static final ParserErrorCode FINAL_METHOD = new ParserErrorCode.con2('FINAL_METHOD', 38, "Getters, setters and methods cannot be declared to be 'final'");
- static final ParserErrorCode FINAL_TYPEDEF = new ParserErrorCode.con2('FINAL_TYPEDEF', 39, "Type aliases cannot be declared to be 'final'");
- static final ParserErrorCode GETTER_WITH_PARAMETERS = new ParserErrorCode.con2('GETTER_WITH_PARAMETERS', 40, "Getter should be declared without a parameter list");
- static final ParserErrorCode ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE = new ParserErrorCode.con2('ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE', 41, "Illegal assignment to non-assignable expression");
- static final ParserErrorCode IMPLEMENTS_BEFORE_EXTENDS = new ParserErrorCode.con2('IMPLEMENTS_BEFORE_EXTENDS', 42, "The extends clause must be before the implements clause");
- static final ParserErrorCode IMPLEMENTS_BEFORE_WITH = new ParserErrorCode.con2('IMPLEMENTS_BEFORE_WITH', 43, "The with clause must be before the implements clause");
- static final ParserErrorCode IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE = new ParserErrorCode.con2('IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE', 44, "Import directives must preceed part directives");
- static final ParserErrorCode INITIALIZED_VARIABLE_IN_FOR_EACH = new ParserErrorCode.con2('INITIALIZED_VARIABLE_IN_FOR_EACH', 45, "The loop variable in a for-each loop cannot be initialized");
- static final ParserErrorCode INVALID_CODE_POINT = new ParserErrorCode.con2('INVALID_CODE_POINT', 46, "The escape sequence '%s' is not a valid code point");
- static final ParserErrorCode INVALID_COMMENT_REFERENCE = new ParserErrorCode.con2('INVALID_COMMENT_REFERENCE', 47, "Comment references should contain a possibly prefixed identifier and can start with 'new', but should not contain anything else");
- static final ParserErrorCode INVALID_HEX_ESCAPE = new ParserErrorCode.con2('INVALID_HEX_ESCAPE', 48, "An escape sequence starting with '\\x' must be followed by 2 hexidecimal digits");
- static final ParserErrorCode INVALID_OPERATOR_FOR_SUPER = new ParserErrorCode.con2('INVALID_OPERATOR_FOR_SUPER', 49, "The operator '%s' cannot be used with 'super'");
- static final ParserErrorCode INVALID_UNICODE_ESCAPE = new ParserErrorCode.con2('INVALID_UNICODE_ESCAPE', 50, "An escape sequence starting with '\\u' must be followed by 4 hexidecimal digits or from 1 to 6 digits between '{' and '}'");
- static final ParserErrorCode LIBRARY_DIRECTIVE_NOT_FIRST = new ParserErrorCode.con2('LIBRARY_DIRECTIVE_NOT_FIRST', 51, "The library directive must appear before all other directives");
- static final ParserErrorCode MISSING_ASSIGNABLE_SELECTOR = new ParserErrorCode.con2('MISSING_ASSIGNABLE_SELECTOR', 52, "Missing selector such as \".<identifier>\" or \"[0]\"");
- static final ParserErrorCode MISSING_CATCH_OR_FINALLY = new ParserErrorCode.con2('MISSING_CATCH_OR_FINALLY', 53, "A try statement must have either a catch or finally clause");
- static final ParserErrorCode MISSING_CLASS_BODY = new ParserErrorCode.con2('MISSING_CLASS_BODY', 54, "A class definition must have a body, even if it is empty");
- static final ParserErrorCode MISSING_CONST_FINAL_VAR_OR_TYPE = new ParserErrorCode.con2('MISSING_CONST_FINAL_VAR_OR_TYPE', 55, "Variables must be declared using the keywords 'const', 'final', 'var' or a type name");
- static final ParserErrorCode MISSING_EXPRESSION_IN_THROW = new ParserErrorCode.con2('MISSING_EXPRESSION_IN_THROW', 56, "Throw expressions must compute the object to be thrown");
- static final ParserErrorCode MISSING_FUNCTION_BODY = new ParserErrorCode.con2('MISSING_FUNCTION_BODY', 57, "A function body must be provided");
- static final ParserErrorCode MISSING_FUNCTION_PARAMETERS = new ParserErrorCode.con2('MISSING_FUNCTION_PARAMETERS', 58, "Functions must have an explicit list of parameters");
- static final ParserErrorCode MISSING_IDENTIFIER = new ParserErrorCode.con2('MISSING_IDENTIFIER', 59, "Expected an identifier");
- static final ParserErrorCode MISSING_NAME_IN_LIBRARY_DIRECTIVE = new ParserErrorCode.con2('MISSING_NAME_IN_LIBRARY_DIRECTIVE', 60, "Library directives must include a library name");
- static final ParserErrorCode MISSING_NAME_IN_PART_OF_DIRECTIVE = new ParserErrorCode.con2('MISSING_NAME_IN_PART_OF_DIRECTIVE', 61, "Library directives must include a library name");
- static final ParserErrorCode MISSING_STATEMENT = new ParserErrorCode.con2('MISSING_STATEMENT', 62, "Expected a statement");
- static final ParserErrorCode MISSING_TERMINATOR_FOR_PARAMETER_GROUP = new ParserErrorCode.con2('MISSING_TERMINATOR_FOR_PARAMETER_GROUP', 63, "There is no '%s' to close the parameter group");
- static final ParserErrorCode MISSING_TYPEDEF_PARAMETERS = new ParserErrorCode.con2('MISSING_TYPEDEF_PARAMETERS', 64, "Type aliases for functions must have an explicit list of parameters");
- static final ParserErrorCode MISSING_VARIABLE_IN_FOR_EACH = new ParserErrorCode.con2('MISSING_VARIABLE_IN_FOR_EACH', 65, "A loop variable must be declared in a for-each loop before the 'in', but none were found");
- static final ParserErrorCode MIXED_PARAMETER_GROUPS = new ParserErrorCode.con2('MIXED_PARAMETER_GROUPS', 66, "Cannot have both positional and named parameters in a single parameter list");
- static final ParserErrorCode MULTIPLE_EXTENDS_CLAUSES = new ParserErrorCode.con2('MULTIPLE_EXTENDS_CLAUSES', 67, "Each class definition can have at most one extends clause");
- static final ParserErrorCode MULTIPLE_IMPLEMENTS_CLAUSES = new ParserErrorCode.con2('MULTIPLE_IMPLEMENTS_CLAUSES', 68, "Each class definition can have at most one implements clause");
- static final ParserErrorCode MULTIPLE_LIBRARY_DIRECTIVES = new ParserErrorCode.con2('MULTIPLE_LIBRARY_DIRECTIVES', 69, "Only one library directive may be declared in a file");
- static final ParserErrorCode MULTIPLE_NAMED_PARAMETER_GROUPS = new ParserErrorCode.con2('MULTIPLE_NAMED_PARAMETER_GROUPS', 70, "Cannot have multiple groups of named parameters in a single parameter list");
- static final ParserErrorCode MULTIPLE_PART_OF_DIRECTIVES = new ParserErrorCode.con2('MULTIPLE_PART_OF_DIRECTIVES', 71, "Only one part-of directive may be declared in a file");
- static final ParserErrorCode MULTIPLE_POSITIONAL_PARAMETER_GROUPS = new ParserErrorCode.con2('MULTIPLE_POSITIONAL_PARAMETER_GROUPS', 72, "Cannot have multiple groups of positional parameters in a single parameter list");
- static final ParserErrorCode MULTIPLE_VARIABLES_IN_FOR_EACH = new ParserErrorCode.con2('MULTIPLE_VARIABLES_IN_FOR_EACH', 73, "A single loop variable must be declared in a for-each loop before the 'in', but %s were found");
- static final ParserErrorCode MULTIPLE_WITH_CLAUSES = new ParserErrorCode.con2('MULTIPLE_WITH_CLAUSES', 74, "Each class definition can have at most one with clause");
- static final ParserErrorCode NAMED_PARAMETER_OUTSIDE_GROUP = new ParserErrorCode.con2('NAMED_PARAMETER_OUTSIDE_GROUP', 75, "Named parameters must be enclosed in curly braces ('{' and '}')");
- static final ParserErrorCode NON_CONSTRUCTOR_FACTORY = new ParserErrorCode.con2('NON_CONSTRUCTOR_FACTORY', 76, "Only constructors can be declared to be a 'factory'");
- static final ParserErrorCode NON_IDENTIFIER_LIBRARY_NAME = new ParserErrorCode.con2('NON_IDENTIFIER_LIBRARY_NAME', 77, "The name of a library must be an identifier");
- static final ParserErrorCode NON_PART_OF_DIRECTIVE_IN_PART = new ParserErrorCode.con2('NON_PART_OF_DIRECTIVE_IN_PART', 78, "The part-of directive must be the only directive in a part");
- static final ParserErrorCode NON_USER_DEFINABLE_OPERATOR = new ParserErrorCode.con2('NON_USER_DEFINABLE_OPERATOR', 79, "The operator '%s' is not user definable");
- static final ParserErrorCode POSITIONAL_AFTER_NAMED_ARGUMENT = new ParserErrorCode.con2('POSITIONAL_AFTER_NAMED_ARGUMENT', 80, "Positional arguments must occur before named arguments");
- static final ParserErrorCode POSITIONAL_PARAMETER_OUTSIDE_GROUP = new ParserErrorCode.con2('POSITIONAL_PARAMETER_OUTSIDE_GROUP', 81, "Positional parameters must be enclosed in square brackets ('[' and ']')");
- static final ParserErrorCode STATIC_AFTER_CONST = new ParserErrorCode.con2('STATIC_AFTER_CONST', 82, "The modifier 'static' should be before the modifier 'const'");
- static final ParserErrorCode STATIC_AFTER_FINAL = new ParserErrorCode.con2('STATIC_AFTER_FINAL', 83, "The modifier 'static' should be before the modifier 'final'");
- static final ParserErrorCode STATIC_AFTER_VAR = new ParserErrorCode.con2('STATIC_AFTER_VAR', 84, "The modifier 'static' should be before the modifier 'var'");
- static final ParserErrorCode STATIC_CONSTRUCTOR = new ParserErrorCode.con2('STATIC_CONSTRUCTOR', 85, "Constructors cannot be static");
- static final ParserErrorCode STATIC_OPERATOR = new ParserErrorCode.con2('STATIC_OPERATOR', 86, "Operators cannot be static");
- static final ParserErrorCode STATIC_TOP_LEVEL_DECLARATION = new ParserErrorCode.con2('STATIC_TOP_LEVEL_DECLARATION', 87, "Top-level declarations cannot be declared to be 'static'");
- static final ParserErrorCode UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP = new ParserErrorCode.con2('UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP', 88, "There is no '%s' to open a parameter group");
- static final ParserErrorCode UNEXPECTED_TOKEN = new ParserErrorCode.con2('UNEXPECTED_TOKEN', 89, "Unexpected token '%s'");
- static final ParserErrorCode USE_OF_UNARY_PLUS_OPERATOR = new ParserErrorCode.con2('USE_OF_UNARY_PLUS_OPERATOR', 90, "There is no unary plus operator in Dart");
- static final ParserErrorCode WITH_BEFORE_EXTENDS = new ParserErrorCode.con2('WITH_BEFORE_EXTENDS', 91, "The extends clause must be before the with clause");
- static final ParserErrorCode WITH_WITHOUT_EXTENDS = new ParserErrorCode.con2('WITH_WITHOUT_EXTENDS', 92, "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', 93, "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', 94, "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', 95, "Expected '%s' to close parameter group");
- static final ParserErrorCode VAR_CLASS = new ParserErrorCode.con2('VAR_CLASS', 96, "Classes cannot be declared to be 'var'");
- static final ParserErrorCode VAR_RETURN_TYPE = new ParserErrorCode.con2('VAR_RETURN_TYPE', 97, "The return type cannot be 'var'");
- static final ParserErrorCode VAR_TYPEDEF = new ParserErrorCode.con2('VAR_TYPEDEF', 98, "Type aliases cannot be declared to be 'var'");
- static final ParserErrorCode VOID_PARAMETER = new ParserErrorCode.con2('VOID_PARAMETER', 99, "Parameters cannot have a type of 'void'");
- static final ParserErrorCode VOID_VARIABLE = new ParserErrorCode.con2('VOID_VARIABLE', 100, "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_METHOD, CONST_TYPEDEF, CONSTRUCTOR_WITH_RETURN_TYPE, CONTINUE_OUTSIDE_OF_LOOP, CONTINUE_WITHOUT_LABEL_IN_CASE, DIRECTIVE_AFTER_DECLARATION, DUPLICATE_LABEL_IN_SWITCH_STATEMENT, DUPLICATED_MODIFIER, EXPECTED_CASE_OR_DEFAULT, EXPECTED_LIST_OR_MAP_LITERAL, EXPECTED_STRING_LITERAL, EXPECTED_TOKEN, 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, FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR, FINAL_AND_VAR, FINAL_CLASS, FINAL_CONSTRUCTOR, FINAL_METHOD, FINAL_TYPEDEF, 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_FOR_SUPER, INVALID_UNICODE_ESCAPE, LIBRARY_DIRECTIVE_NOT_FIRST, MISSING_ASSIGNABLE_SELECTOR, MISSING_CATCH_OR_FINALLY, MISSING_CLASS_BODY, MISSING_CONST_FINAL_VAR_OR_TYPE, MISSING_EXPRESSION_IN_THROW, MISSING_FUNCTION_BODY, MISSING_FUNCTION_PARAMETERS, MISSING_IDENTIFIER, 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_PARAMETER_OUTSIDE_GROUP, NON_CONSTRUCTOR_FACTORY, NON_IDENTIFIER_LIBRARY_NAME, NON_PART_OF_DIRECTIVE_IN_PART, NON_USER_DEFINABLE_OPERATOR, POSITIONAL_AFTER_NAMED_ARGUMENT, POSITIONAL_PARAMETER_OUTSIDE_GROUP, STATIC_AFTER_CONST, STATIC_AFTER_FINAL, STATIC_AFTER_VAR, STATIC_CONSTRUCTOR, STATIC_OPERATOR, STATIC_TOP_LEVEL_DECLARATION, UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP, UNEXPECTED_TOKEN, USE_OF_UNARY_PLUS_OPERATOR, WITH_BEFORE_EXTENDS, WITH_WITHOUT_EXTENDS, WRONG_SEPARATOR_FOR_NAMED_PARAMETER, WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER, WRONG_TERMINATOR_FOR_PARAMETER_GROUP, VAR_CLASS, VAR_RETURN_TYPE, VAR_TYPEDEF, VOID_PARAMETER, VOID_VARIABLE];
+ static final ParserErrorCode EXPECTED_CLASS_MEMBER = new ParserErrorCode.con2('EXPECTED_CLASS_MEMBER', 18, "Expected a class member");
+ static final ParserErrorCode EXPECTED_EXECUTABLE = new ParserErrorCode.con2('EXPECTED_EXECUTABLE', 19, "Expected a method, getter, setter or operator declaration");
+ static final ParserErrorCode EXPECTED_LIST_OR_MAP_LITERAL = new ParserErrorCode.con2('EXPECTED_LIST_OR_MAP_LITERAL', 20, "Expected a list or map literal");
+ static final ParserErrorCode EXPECTED_STRING_LITERAL = new ParserErrorCode.con2('EXPECTED_STRING_LITERAL', 21, "Expected a string literal");
+ static final ParserErrorCode EXPECTED_TOKEN = new ParserErrorCode.con2('EXPECTED_TOKEN', 22, "Expected to find '%s'");
+ static final ParserErrorCode EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE = new ParserErrorCode.con2('EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE', 23, "Export directives must preceed part directives");
+ static final ParserErrorCode EXTERNAL_AFTER_CONST = new ParserErrorCode.con2('EXTERNAL_AFTER_CONST', 24, "The modifier 'external' should be before the modifier 'const'");
+ static final ParserErrorCode EXTERNAL_AFTER_FACTORY = new ParserErrorCode.con2('EXTERNAL_AFTER_FACTORY', 25, "The modifier 'external' should be before the modifier 'factory'");
+ static final ParserErrorCode EXTERNAL_AFTER_STATIC = new ParserErrorCode.con2('EXTERNAL_AFTER_STATIC', 26, "The modifier 'external' should be before the modifier 'static'");
+ static final ParserErrorCode EXTERNAL_CLASS = new ParserErrorCode.con2('EXTERNAL_CLASS', 27, "Classes cannot be declared to be 'external'");
+ static final ParserErrorCode EXTERNAL_CONSTRUCTOR_WITH_BODY = new ParserErrorCode.con2('EXTERNAL_CONSTRUCTOR_WITH_BODY', 28, "External constructors cannot have a body");
+ static final ParserErrorCode EXTERNAL_FIELD = new ParserErrorCode.con2('EXTERNAL_FIELD', 29, "Fields cannot be declared to be 'external'");
+ static final ParserErrorCode EXTERNAL_GETTER_WITH_BODY = new ParserErrorCode.con2('EXTERNAL_GETTER_WITH_BODY', 30, "External getters cannot have a body");
+ static final ParserErrorCode EXTERNAL_METHOD_WITH_BODY = new ParserErrorCode.con2('EXTERNAL_METHOD_WITH_BODY', 31, "External methods cannot have a body");
+ static final ParserErrorCode EXTERNAL_OPERATOR_WITH_BODY = new ParserErrorCode.con2('EXTERNAL_OPERATOR_WITH_BODY', 32, "External operators cannot have a body");
+ static final ParserErrorCode EXTERNAL_SETTER_WITH_BODY = new ParserErrorCode.con2('EXTERNAL_SETTER_WITH_BODY', 33, "External setters cannot have a body");
+ static final ParserErrorCode EXTERNAL_TYPEDEF = new ParserErrorCode.con2('EXTERNAL_TYPEDEF', 34, "Type aliases cannot be declared to be 'external'");
+ static final ParserErrorCode FACTORY_TOP_LEVEL_DECLARATION = new ParserErrorCode.con2('FACTORY_TOP_LEVEL_DECLARATION', 35, "Top-level declarations cannot be declared to be 'factory'");
+ static final ParserErrorCode FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR = new ParserErrorCode.con2('FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR', 36, "Field initializers can only be used in a constructor");
+ static final ParserErrorCode FINAL_AND_VAR = new ParserErrorCode.con2('FINAL_AND_VAR', 37, "Members cannot be declared to be both 'final' and 'var'");
+ static final ParserErrorCode FINAL_CLASS = new ParserErrorCode.con2('FINAL_CLASS', 38, "Classes cannot be declared to be 'final'");
+ static final ParserErrorCode FINAL_CONSTRUCTOR = new ParserErrorCode.con2('FINAL_CONSTRUCTOR', 39, "A constructor cannot be declared to be 'final'");
+ static final ParserErrorCode FINAL_METHOD = new ParserErrorCode.con2('FINAL_METHOD', 40, "Getters, setters and methods cannot be declared to be 'final'");
+ static final ParserErrorCode FINAL_TYPEDEF = new ParserErrorCode.con2('FINAL_TYPEDEF', 41, "Type aliases cannot be declared to be 'final'");
+ static final ParserErrorCode GETTER_WITH_PARAMETERS = new ParserErrorCode.con2('GETTER_WITH_PARAMETERS', 42, "Getter should be declared without a parameter list");
+ static final ParserErrorCode ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE = new ParserErrorCode.con2('ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE', 43, "Illegal assignment to non-assignable expression");
+ static final ParserErrorCode IMPLEMENTS_BEFORE_EXTENDS = new ParserErrorCode.con2('IMPLEMENTS_BEFORE_EXTENDS', 44, "The extends clause must be before the implements clause");
+ static final ParserErrorCode IMPLEMENTS_BEFORE_WITH = new ParserErrorCode.con2('IMPLEMENTS_BEFORE_WITH', 45, "The with clause must be before the implements clause");
+ static final ParserErrorCode IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE = new ParserErrorCode.con2('IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE', 46, "Import directives must preceed part directives");
+ static final ParserErrorCode INITIALIZED_VARIABLE_IN_FOR_EACH = new ParserErrorCode.con2('INITIALIZED_VARIABLE_IN_FOR_EACH', 47, "The loop variable in a for-each loop cannot be initialized");
+ static final ParserErrorCode INVALID_CODE_POINT = new ParserErrorCode.con2('INVALID_CODE_POINT', 48, "The escape sequence '%s' is not a valid code point");
+ static final ParserErrorCode INVALID_COMMENT_REFERENCE = new ParserErrorCode.con2('INVALID_COMMENT_REFERENCE', 49, "Comment references should contain a possibly prefixed identifier and can start with 'new', but should not contain anything else");
+ static final ParserErrorCode INVALID_HEX_ESCAPE = new ParserErrorCode.con2('INVALID_HEX_ESCAPE', 50, "An escape sequence starting with '\\x' must be followed by 2 hexidecimal digits");
+ static final ParserErrorCode INVALID_OPERATOR = new ParserErrorCode.con2('INVALID_OPERATOR', 51, "The string '%s' is not a valid operator");
+ static final ParserErrorCode INVALID_OPERATOR_FOR_SUPER = new ParserErrorCode.con2('INVALID_OPERATOR_FOR_SUPER', 52, "The operator '%s' cannot be used with 'super'");
+ static final ParserErrorCode INVALID_UNICODE_ESCAPE = new ParserErrorCode.con2('INVALID_UNICODE_ESCAPE', 53, "An escape sequence starting with '\\u' must be followed by 4 hexidecimal digits or from 1 to 6 digits between '{' and '}'");
+ static final ParserErrorCode LIBRARY_DIRECTIVE_NOT_FIRST = new ParserErrorCode.con2('LIBRARY_DIRECTIVE_NOT_FIRST', 54, "The library directive must appear before all other directives");
+ static final ParserErrorCode MISSING_ASSIGNABLE_SELECTOR = new ParserErrorCode.con2('MISSING_ASSIGNABLE_SELECTOR', 55, "Missing selector such as \".<identifier>\" or \"[0]\"");
+ static final ParserErrorCode MISSING_CATCH_OR_FINALLY = new ParserErrorCode.con2('MISSING_CATCH_OR_FINALLY', 56, "A try statement must have either a catch or finally clause");
+ static final ParserErrorCode MISSING_CLASS_BODY = new ParserErrorCode.con2('MISSING_CLASS_BODY', 57, "A class definition must have a body, even if it is empty");
+ static final ParserErrorCode MISSING_CLOSING_PARENTHESIS = new ParserErrorCode.con2('MISSING_CLOSING_PARENTHESIS', 58, "The closing parenthesis is missing");
+ static final ParserErrorCode MISSING_CONST_FINAL_VAR_OR_TYPE = new ParserErrorCode.con2('MISSING_CONST_FINAL_VAR_OR_TYPE', 59, "Variables must be declared using the keywords 'const', 'final', 'var' or a type name");
+ static final ParserErrorCode MISSING_EXPRESSION_IN_THROW = new ParserErrorCode.con2('MISSING_EXPRESSION_IN_THROW', 60, "Throw expressions must compute the object to be thrown");
+ static final ParserErrorCode MISSING_FUNCTION_BODY = new ParserErrorCode.con2('MISSING_FUNCTION_BODY', 61, "A function body must be provided");
+ static final ParserErrorCode MISSING_FUNCTION_PARAMETERS = new ParserErrorCode.con2('MISSING_FUNCTION_PARAMETERS', 62, "Functions must have an explicit list of parameters");
+ static final ParserErrorCode MISSING_IDENTIFIER = new ParserErrorCode.con2('MISSING_IDENTIFIER', 63, "Expected an identifier");
+ static final ParserErrorCode MISSING_KEYWORD_OPERATOR = new ParserErrorCode.con2('MISSING_KEYWORD_OPERATOR', 64, "Operator declarations must be preceeded by the keyword 'operator'");
+ static final ParserErrorCode MISSING_NAME_IN_LIBRARY_DIRECTIVE = new ParserErrorCode.con2('MISSING_NAME_IN_LIBRARY_DIRECTIVE', 65, "Library directives must include a library name");
+ static final ParserErrorCode MISSING_NAME_IN_PART_OF_DIRECTIVE = new ParserErrorCode.con2('MISSING_NAME_IN_PART_OF_DIRECTIVE', 66, "Library directives must include a library name");
+ static final ParserErrorCode MISSING_STATEMENT = new ParserErrorCode.con2('MISSING_STATEMENT', 67, "Expected a statement");
+ static final ParserErrorCode MISSING_TERMINATOR_FOR_PARAMETER_GROUP = new ParserErrorCode.con2('MISSING_TERMINATOR_FOR_PARAMETER_GROUP', 68, "There is no '%s' to close the parameter group");
+ static final ParserErrorCode MISSING_TYPEDEF_PARAMETERS = new ParserErrorCode.con2('MISSING_TYPEDEF_PARAMETERS', 69, "Type aliases for functions must have an explicit list of parameters");
+ static final ParserErrorCode MISSING_VARIABLE_IN_FOR_EACH = new ParserErrorCode.con2('MISSING_VARIABLE_IN_FOR_EACH', 70, "A loop variable must be declared in a for-each loop before the 'in', but none were found");
+ static final ParserErrorCode MIXED_PARAMETER_GROUPS = new ParserErrorCode.con2('MIXED_PARAMETER_GROUPS', 71, "Cannot have both positional and named parameters in a single parameter list");
+ static final ParserErrorCode MULTIPLE_EXTENDS_CLAUSES = new ParserErrorCode.con2('MULTIPLE_EXTENDS_CLAUSES', 72, "Each class definition can have at most one extends clause");
+ static final ParserErrorCode MULTIPLE_IMPLEMENTS_CLAUSES = new ParserErrorCode.con2('MULTIPLE_IMPLEMENTS_CLAUSES', 73, "Each class definition can have at most one implements clause");
+ static final ParserErrorCode MULTIPLE_LIBRARY_DIRECTIVES = new ParserErrorCode.con2('MULTIPLE_LIBRARY_DIRECTIVES', 74, "Only one library directive may be declared in a file");
+ static final ParserErrorCode MULTIPLE_NAMED_PARAMETER_GROUPS = new ParserErrorCode.con2('MULTIPLE_NAMED_PARAMETER_GROUPS', 75, "Cannot have multiple groups of named parameters in a single parameter list");
+ static final ParserErrorCode MULTIPLE_PART_OF_DIRECTIVES = new ParserErrorCode.con2('MULTIPLE_PART_OF_DIRECTIVES', 76, "Only one part-of directive may be declared in a file");
+ static final ParserErrorCode MULTIPLE_POSITIONAL_PARAMETER_GROUPS = new ParserErrorCode.con2('MULTIPLE_POSITIONAL_PARAMETER_GROUPS', 77, "Cannot have multiple groups of positional parameters in a single parameter list");
+ static final ParserErrorCode MULTIPLE_VARIABLES_IN_FOR_EACH = new ParserErrorCode.con2('MULTIPLE_VARIABLES_IN_FOR_EACH', 78, "A single loop variable must be declared in a for-each loop before the 'in', but %s were found");
+ static final ParserErrorCode MULTIPLE_WITH_CLAUSES = new ParserErrorCode.con2('MULTIPLE_WITH_CLAUSES', 79, "Each class definition can have at most one with clause");
+ static final ParserErrorCode NAMED_FUNCTION_EXPRESSION = new ParserErrorCode.con2('NAMED_FUNCTION_EXPRESSION', 80, "Function expressions cannot be named");
+ static final ParserErrorCode NAMED_PARAMETER_OUTSIDE_GROUP = new ParserErrorCode.con2('NAMED_PARAMETER_OUTSIDE_GROUP', 81, "Named parameters must be enclosed in curly braces ('{' and '}')");
+ static final ParserErrorCode NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE = new ParserErrorCode.con2('NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE', 82, "Native functions can only be declared in the SDK and code that is loaded through native extensions");
+ static final ParserErrorCode NON_CONSTRUCTOR_FACTORY = new ParserErrorCode.con2('NON_CONSTRUCTOR_FACTORY', 83, "Only constructors can be declared to be a 'factory'");
+ static final ParserErrorCode NON_IDENTIFIER_LIBRARY_NAME = new ParserErrorCode.con2('NON_IDENTIFIER_LIBRARY_NAME', 84, "The name of a library must be an identifier");
+ static final ParserErrorCode NON_PART_OF_DIRECTIVE_IN_PART = new ParserErrorCode.con2('NON_PART_OF_DIRECTIVE_IN_PART', 85, "The part-of directive must be the only directive in a part");
+ static final ParserErrorCode NON_USER_DEFINABLE_OPERATOR = new ParserErrorCode.con2('NON_USER_DEFINABLE_OPERATOR', 86, "The operator '%s' is not user definable");
+ static final ParserErrorCode POSITIONAL_AFTER_NAMED_ARGUMENT = new ParserErrorCode.con2('POSITIONAL_AFTER_NAMED_ARGUMENT', 87, "Positional arguments must occur before named arguments");
+ static final ParserErrorCode POSITIONAL_PARAMETER_OUTSIDE_GROUP = new ParserErrorCode.con2('POSITIONAL_PARAMETER_OUTSIDE_GROUP', 88, "Positional parameters must be enclosed in square brackets ('[' and ']')");
+ static final ParserErrorCode STATIC_AFTER_CONST = new ParserErrorCode.con2('STATIC_AFTER_CONST', 89, "The modifier 'static' should be before the modifier 'const'");
+ static final ParserErrorCode STATIC_AFTER_FINAL = new ParserErrorCode.con2('STATIC_AFTER_FINAL', 90, "The modifier 'static' should be before the modifier 'final'");
+ static final ParserErrorCode STATIC_AFTER_VAR = new ParserErrorCode.con2('STATIC_AFTER_VAR', 91, "The modifier 'static' should be before the modifier 'var'");
+ static final ParserErrorCode STATIC_CONSTRUCTOR = new ParserErrorCode.con2('STATIC_CONSTRUCTOR', 92, "Constructors cannot be static");
+ static final ParserErrorCode STATIC_OPERATOR = new ParserErrorCode.con2('STATIC_OPERATOR', 93, "Operators cannot be static");
+ static final ParserErrorCode STATIC_TOP_LEVEL_DECLARATION = new ParserErrorCode.con2('STATIC_TOP_LEVEL_DECLARATION', 94, "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', 95, "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', 96, "The 'default' case can only be declared once");
+ static final ParserErrorCode TOP_LEVEL_OPERATOR = new ParserErrorCode.con2('TOP_LEVEL_OPERATOR', 97, "Operators must be declared within a class");
+ static final ParserErrorCode UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP = new ParserErrorCode.con2('UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP', 98, "There is no '%s' to open a parameter group");
+ static final ParserErrorCode UNEXPECTED_TOKEN = new ParserErrorCode.con2('UNEXPECTED_TOKEN', 99, "Unexpected token '%s'");
+ static final ParserErrorCode USE_OF_UNARY_PLUS_OPERATOR = new ParserErrorCode.con2('USE_OF_UNARY_PLUS_OPERATOR', 100, "There is no unary plus operator in Dart");
+ static final ParserErrorCode WITH_BEFORE_EXTENDS = new ParserErrorCode.con2('WITH_BEFORE_EXTENDS', 101, "The extends clause must be before the with clause");
+ static final ParserErrorCode WITH_WITHOUT_EXTENDS = new ParserErrorCode.con2('WITH_WITHOUT_EXTENDS', 102, "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', 103, "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', 104, "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', 105, "Expected '%s' to close parameter group");
+ static final ParserErrorCode VAR_CLASS = new ParserErrorCode.con2('VAR_CLASS', 106, "Classes cannot be declared to be 'var'");
+ static final ParserErrorCode VAR_RETURN_TYPE = new ParserErrorCode.con2('VAR_RETURN_TYPE', 107, "The return type cannot be 'var'");
+ static final ParserErrorCode VAR_TYPEDEF = new ParserErrorCode.con2('VAR_TYPEDEF', 108, "Type aliases cannot be declared to be 'var'");
+ static final ParserErrorCode VOID_PARAMETER = new ParserErrorCode.con2('VOID_PARAMETER', 109, "Parameters cannot have a type of 'void'");
+ static final ParserErrorCode VOID_VARIABLE = new ParserErrorCode.con2('VOID_VARIABLE', 110, "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_METHOD, CONST_TYPEDEF, CONSTRUCTOR_WITH_RETURN_TYPE, CONTINUE_OUTSIDE_OF_LOOP, CONTINUE_WITHOUT_LABEL_IN_CASE, DIRECTIVE_AFTER_DECLARATION, DUPLICATE_LABEL_IN_SWITCH_STATEMENT, DUPLICATED_MODIFIER, EXPECTED_CASE_OR_DEFAULT, EXPECTED_CLASS_MEMBER, EXPECTED_EXECUTABLE, EXPECTED_LIST_OR_MAP_LITERAL, EXPECTED_STRING_LITERAL, EXPECTED_TOKEN, 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, FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR, FINAL_AND_VAR, FINAL_CLASS, FINAL_CONSTRUCTOR, FINAL_METHOD, FINAL_TYPEDEF, 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, 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, POSITIONAL_AFTER_NAMED_ARGUMENT, POSITIONAL_PARAMETER_OUTSIDE_GROUP, STATIC_AFTER_CONST, STATIC_AFTER_FINAL, STATIC_AFTER_VAR, STATIC_CONSTRUCTOR, STATIC_OPERATOR, 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, USE_OF_UNARY_PLUS_OPERATOR, WITH_BEFORE_EXTENDS, WITH_WITHOUT_EXTENDS, WRONG_SEPARATOR_FOR_NAMED_PARAMETER, WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER, WRONG_TERMINATOR_FOR_PARAMETER_GROUP, VAR_CLASS, VAR_RETURN_TYPE, VAR_TYPEDEF, VOID_PARAMETER, VOID_VARIABLE];
String __name;
int __ordinal = 0;
int get ordinal => __ordinal;
@@ -4789,9 +4914,9 @@
* @param message the message template used to create the message to be displayed for the error
*/
ParserErrorCode.con1(String ___name, int ___ordinal, ErrorSeverity severity2, String message2) {
- _jtd_constructor_275_impl(___name, ___ordinal, severity2, message2);
+ _jtd_constructor_301_impl(___name, ___ordinal, severity2, message2);
}
- _jtd_constructor_275_impl(String ___name, int ___ordinal, ErrorSeverity severity2, String message2) {
+ _jtd_constructor_301_impl(String ___name, int ___ordinal, ErrorSeverity severity2, String message2) {
__name = ___name;
__ordinal = ___ordinal;
this._severity = severity2;
@@ -4802,15 +4927,16 @@
* @param message the message template used to create the message to be displayed for the error
*/
ParserErrorCode.con2(String ___name, int ___ordinal, String message) {
- _jtd_constructor_276_impl(___name, ___ordinal, message);
+ _jtd_constructor_302_impl(___name, ___ordinal, message);
}
- _jtd_constructor_276_impl(String ___name, int ___ordinal, String message) {
- _jtd_constructor_275_impl(___name, ___ordinal, ErrorSeverity.ERROR, message);
+ _jtd_constructor_302_impl(String ___name, int ___ordinal, String message) {
+ _jtd_constructor_301_impl(___name, ___ordinal, ErrorSeverity.ERROR, message);
}
ErrorSeverity get errorSeverity => _severity;
String get message => _message;
ErrorType get type => ErrorType.SYNTACTIC_ERROR;
bool needsRecompilation() => true;
+ int compareTo(ParserErrorCode other) => __ordinal - other.__ordinal;
String toString() => __name;
}
/**
@@ -4983,12 +5109,12 @@
}
Object visitCommentReference(CommentReference node) => null;
Object visitCompilationUnit(CompilationUnit node) {
- ScriptTag scriptTag7 = node.scriptTag;
- NodeList<Directive> directives4 = node.directives;
- visit(scriptTag7);
- String prefix = scriptTag7 == null ? "" : " ";
- visitList7(prefix, directives4, "\n");
- prefix = scriptTag7 == null && directives4.isEmpty ? "" : "\n\n";
+ ScriptTag scriptTag2 = node.scriptTag;
+ NodeList<Directive> directives2 = node.directives;
+ visit(scriptTag2);
+ String prefix = scriptTag2 == null ? "" : " ";
+ visitList7(prefix, directives2, "\n");
+ prefix = scriptTag2 == null && directives2.isEmpty ? "" : "\n\n";
visitList7(prefix, node.declarations, "\n");
return null;
}
@@ -5120,10 +5246,10 @@
Object visitFormalParameterList(FormalParameterList node) {
String groupEnd = null;
_writer.print('(');
- NodeList<FormalParameter> parameters14 = node.parameters;
- int size7 = parameters14.length;
- for (int i = 0; i < size7; i++) {
- FormalParameter parameter = parameters14[i];
+ NodeList<FormalParameter> parameters2 = node.parameters;
+ int size2 = parameters2.length;
+ for (int i = 0; i < size2; i++) {
+ FormalParameter parameter = parameters2[i];
if (i > 0) {
_writer.print(", ");
}
@@ -5145,10 +5271,10 @@
return null;
}
Object visitForStatement(ForStatement node) {
- Expression initialization4 = node.initialization;
+ Expression initialization2 = node.initialization;
_writer.print("for (");
- if (initialization4 != null) {
- visit(initialization4);
+ if (initialization2 != null) {
+ visit(initialization2);
} else {
visit(node.variables);
}
@@ -5351,6 +5477,12 @@
visit7(" ", node.expression);
return null;
}
+ Object visitNativeFunctionBody(NativeFunctionBody node) {
+ _writer.print("native ");
+ visit(node.stringLiteral);
+ _writer.print(';');
+ return null;
+ }
Object visitNullLiteral(NullLiteral node) {
_writer.print("null");
return null;
@@ -5409,12 +5541,12 @@
return null;
}
Object visitReturnStatement(ReturnStatement node) {
- Expression expression17 = node.expression;
- if (expression17 == null) {
+ Expression expression2 = node.expression;
+ if (expression2 == null) {
_writer.print("return;");
} else {
_writer.print("return ");
- expression17.accept(this);
+ expression2.accept(this);
_writer.print(";");
}
return null;
@@ -5637,8 +5769,8 @@
*/
void visitList5(NodeList<ASTNode> nodes, String separator) {
if (nodes != null) {
- int size8 = nodes.length;
- for (int i = 0; i < size8; i++) {
+ int size2 = nodes.length;
+ for (int i = 0; i < size2; i++) {
if ("\n" == separator) {
_writer.print("\n");
indent();
@@ -5657,9 +5789,9 @@
*/
void visitList6(NodeList<ASTNode> nodes, String separator, String suffix) {
if (nodes != null) {
- int size9 = nodes.length;
- if (size9 > 0) {
- for (int i = 0; i < size9; i++) {
+ int size2 = nodes.length;
+ if (size2 > 0) {
+ for (int i = 0; i < size2; i++) {
if (i > 0) {
_writer.print(separator);
}
@@ -5677,10 +5809,10 @@
*/
void visitList7(String prefix, NodeList<ASTNode> nodes, String separator) {
if (nodes != null) {
- int size10 = nodes.length;
- if (size10 > 0) {
+ int size2 = nodes.length;
+ if (size2 > 0) {
_writer.print(prefix);
- for (int i = 0; i < size10; i++) {
+ for (int i = 0; i < size2; i++) {
if (i > 0) {
_writer.print(separator);
}
diff --git a/pkg/analyzer_experimental/lib/src/generated/resolver.dart b/pkg/analyzer_experimental/lib/src/generated/resolver.dart
index 4305b1a..ddfe703 100644
--- a/pkg/analyzer_experimental/lib/src/generated/resolver.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/resolver.dart
@@ -6,12 +6,14 @@
import 'dart:collection';
import 'java_core.dart';
import 'java_engine.dart';
+import 'instrumentation.dart';
import 'source.dart';
import 'error.dart';
import 'scanner.dart' as sc;
import 'utilities_dart.dart';
import 'ast.dart';
-import 'parser.dart' show Parser;
+import 'parser.dart' show Parser, ParserErrorCode;
+import 'sdk.dart' show DartSdk;
import 'element.dart' hide HideCombinator, ShowCombinator;
import 'html.dart' as ht;
import 'engine.dart';
@@ -25,41 +27,29 @@
*/
class CompilationUnitBuilder {
/**
- * The analysis context in which the element model will be built.
- */
- AnalysisContextImpl _analysisContext;
- /**
* Initialize a newly created compilation unit element builder.
* @param analysisContext the analysis context in which the element model will be built
*/
- CompilationUnitBuilder(AnalysisContextImpl analysisContext) {
- this._analysisContext = analysisContext;
+ CompilationUnitBuilder() : super() {
}
/**
* Build the compilation unit element for the given source.
* @param source the source describing the compilation unit
- * @return the compilation unit element that was built
- * @throws AnalysisException if the analysis could not be performed
- */
- CompilationUnitElementImpl buildCompilationUnit(Source source) => buildCompilationUnit2(source, _analysisContext.parseCompilationUnit(source));
- /**
- * Build the compilation unit element for the given source.
- * @param source the source describing the compilation unit
* @param unit the AST structure representing the compilation unit
* @return the compilation unit element that was built
* @throws AnalysisException if the analysis could not be performed
*/
- CompilationUnitElementImpl buildCompilationUnit2(Source source13, CompilationUnit unit) {
+ CompilationUnitElementImpl buildCompilationUnit(Source source2, CompilationUnit unit) {
if (unit == null) {
return null;
}
ElementHolder holder = new ElementHolder();
ElementBuilder builder = new ElementBuilder(holder);
unit.accept(builder);
- CompilationUnitElementImpl element = new CompilationUnitElementImpl(source13.shortName);
+ CompilationUnitElementImpl element = new CompilationUnitElementImpl(source2.shortName);
element.accessors = holder.accessors;
element.functions = holder.functions;
- element.source = source13;
+ element.source = source2;
element.typeAliases = holder.typeAliases;
element.types = holder.types;
element.topLevelVariables = holder.topLevelVariables;
@@ -96,6 +86,16 @@
ElementBuilder(ElementHolder initialHolder) {
_currentHolder = initialHolder;
}
+ Object visitBlock(Block node) {
+ bool wasInField = _inFieldContext;
+ _inFieldContext = false;
+ try {
+ node.visitChildren(this);
+ } finally {
+ _inFieldContext = wasInField;
+ }
+ return null;
+ }
Object visitCatchClause(CatchClause node) {
SimpleIdentifier exceptionParameter2 = node.exceptionParameter;
if (exceptionParameter2 != null) {
@@ -117,25 +117,25 @@
visitChildren(holder, node);
SimpleIdentifier className = node.name;
ClassElementImpl element = new ClassElementImpl(className);
- List<TypeVariableElement> typeVariables4 = holder.typeVariables;
+ List<TypeVariableElement> typeVariables2 = holder.typeVariables;
InterfaceTypeImpl interfaceType = new InterfaceTypeImpl.con1(element);
- interfaceType.typeArguments = createTypeVariableTypes(typeVariables4);
+ interfaceType.typeArguments = createTypeVariableTypes(typeVariables2);
element.type = interfaceType;
- List<ConstructorElement> constructors3 = holder.constructors;
- if (constructors3.length == 0) {
+ List<ConstructorElement> constructors2 = holder.constructors;
+ if (constructors2.length == 0) {
ConstructorElementImpl constructor = new ConstructorElementImpl(null);
constructor.synthetic = true;
FunctionTypeImpl type = new FunctionTypeImpl.con1(constructor);
type.returnType = interfaceType;
constructor.type = type;
- constructors3 = <ConstructorElement> [constructor];
+ constructors2 = <ConstructorElement> [constructor];
}
element.abstract = node.abstractKeyword != null;
element.accessors = holder.accessors;
- element.constructors = constructors3;
+ element.constructors = constructors2;
element.fields = holder.fields;
element.methods = holder.methods;
- element.typeVariables = typeVariables4;
+ element.typeVariables = typeVariables2;
element.validMixin = _isValidMixin;
_currentHolder.addType(element);
className.element = element;
@@ -148,10 +148,10 @@
ClassElementImpl element = new ClassElementImpl(className);
element.abstract = node.abstractKeyword != null;
element.typedef = true;
- List<TypeVariableElement> typeVariables5 = holder.typeVariables;
- element.typeVariables = typeVariables5;
+ List<TypeVariableElement> typeVariables2 = holder.typeVariables;
+ element.typeVariables = typeVariables2;
InterfaceTypeImpl interfaceType = new InterfaceTypeImpl.con1(element);
- interfaceType.typeArguments = createTypeVariableTypes(typeVariables5);
+ interfaceType.typeArguments = createTypeVariableTypes(typeVariables2);
element.type = interfaceType;
_currentHolder.addType(element);
className.element = element;
@@ -160,7 +160,13 @@
Object visitConstructorDeclaration(ConstructorDeclaration node) {
_isValidMixin = false;
ElementHolder holder = new ElementHolder();
- visitChildren(holder, node);
+ bool wasInFunction = _inFunction;
+ _inFunction = true;
+ try {
+ visitChildren(holder, node);
+ } finally {
+ _inFunction = wasInFunction;
+ }
SimpleIdentifier constructorName = node.name;
ConstructorElementImpl element = new ConstructorElementImpl(constructorName);
if (node.factoryKeyword != null) {
@@ -174,9 +180,9 @@
_currentHolder.addConstructor(element);
node.element = element;
if (constructorName == null) {
- Identifier returnType4 = node.returnType;
- if (returnType4 != null) {
- element.nameOffset = returnType4.offset;
+ Identifier returnType2 = node.returnType;
+ if (returnType2 != null) {
+ element.nameOffset = returnType2.offset;
}
} else {
constructorName.element = element;
@@ -185,14 +191,14 @@
}
Object visitDeclaredIdentifier(DeclaredIdentifier node) {
SimpleIdentifier variableName = node.identifier;
- sc.Token keyword28 = node.keyword;
+ sc.Token keyword2 = node.keyword;
LocalVariableElementImpl element = new LocalVariableElementImpl(variableName);
ForEachStatement statement = node.parent as ForEachStatement;
int declarationEnd = node.offset + node.length;
int statementEnd = statement.offset + statement.length;
element.setVisibleRange(declarationEnd, statementEnd - declarationEnd - 1);
- element.const3 = matches(keyword28, sc.Keyword.CONST);
- element.final2 = matches(keyword28, sc.Keyword.FINAL);
+ element.const3 = matches(keyword2, sc.Keyword.CONST);
+ element.final2 = matches(keyword2, sc.Keyword.FINAL);
_currentHolder.addLocalVariable(element);
variableName.element = element;
return super.visitDeclaredIdentifier(node);
@@ -210,6 +216,8 @@
if (node.isConst()) {
parameter = new ConstParameterElementImpl(parameterName);
parameter.const3 = true;
+ } else if (node.parameter is FieldFormalParameter) {
+ parameter = new FieldFormalParameterElementImpl(parameterName);
} else {
parameter = new ParameterElementImpl(parameterName);
}
@@ -238,7 +246,7 @@
Object visitFieldFormalParameter(FieldFormalParameter node) {
if (node.parent is! DefaultFormalParameter) {
SimpleIdentifier parameterName = node.identifier;
- ParameterElementImpl parameter = new ParameterElementImpl(parameterName);
+ FieldFormalParameterElementImpl parameter = new FieldFormalParameterElementImpl(parameterName);
parameter.const3 = node.isConst();
parameter.initializingFormal = true;
parameter.final2 = node.isFinal();
@@ -320,8 +328,7 @@
} finally {
_inFunction = wasInFunction;
}
- SimpleIdentifier functionName = null;
- FunctionElementImpl element = new FunctionElementImpl.con1(functionName);
+ FunctionElementImpl element = new FunctionElementImpl.con2(node.beginToken.offset);
element.functions = holder.functions;
element.labels = holder.labels;
element.localVariables = holder.localVariables;
@@ -344,13 +351,13 @@
ElementHolder holder = new ElementHolder();
visitChildren(holder, node);
SimpleIdentifier aliasName = node.name;
- List<ParameterElement> parameters10 = holder.parameters;
- List<TypeVariableElement> typeVariables6 = holder.typeVariables;
+ List<ParameterElement> parameters2 = holder.parameters;
+ List<TypeVariableElement> typeVariables2 = holder.typeVariables;
FunctionTypeAliasElementImpl element = new FunctionTypeAliasElementImpl(aliasName);
- element.parameters = parameters10;
- element.typeVariables = typeVariables6;
+ element.parameters = parameters2;
+ element.typeVariables = typeVariables2;
FunctionTypeImpl type = new FunctionTypeImpl.con2(element);
- type.typeArguments = createTypeVariableTypes(typeVariables6);
+ type.typeArguments = createTypeVariableTypes(typeVariables2);
element.type = type;
_currentHolder.addTypeAlias(element);
aliasName.element = element;
@@ -364,7 +371,9 @@
_currentHolder.addParameter(parameter);
parameterName.element = parameter;
}
- visitChildren(new ElementHolder(), node);
+ ElementHolder holder = new ElementHolder();
+ visitChildren(holder, node);
+ ((node.element as ParameterElementImpl)).parameters = holder.parameters;
return null;
}
Object visitLabeledStatement(LabeledStatement node) {
@@ -482,9 +491,9 @@
return super.visitTypeParameter(node);
}
Object visitVariableDeclaration(VariableDeclaration node) {
- sc.Token keyword29 = ((node.parent as VariableDeclarationList)).keyword;
- bool isConst = matches(keyword29, sc.Keyword.CONST);
- bool isFinal = matches(keyword29, sc.Keyword.FINAL);
+ sc.Token keyword2 = ((node.parent as VariableDeclarationList)).keyword;
+ bool isConst = matches(keyword2, sc.Keyword.CONST);
+ bool isFinal = matches(keyword2, sc.Keyword.FINAL);
bool hasInitializer = node.initializer != null;
VariableElementImpl element;
if (_inFieldContext) {
@@ -579,14 +588,14 @@
* @return the body of the function that contains the given parameter
*/
FunctionBody getFunctionBody(FormalParameter node) {
- ASTNode parent13 = node.parent;
- while (parent13 != null) {
- if (parent13 is FunctionExpression) {
- return ((parent13 as FunctionExpression)).body;
- } else if (parent13 is MethodDeclaration) {
- return ((parent13 as MethodDeclaration)).body;
+ ASTNode parent2 = node.parent;
+ while (parent2 != null) {
+ if (parent2 is FunctionExpression) {
+ return ((parent2 as FunctionExpression)).body;
+ } else if (parent2 is MethodDeclaration) {
+ return ((parent2 as MethodDeclaration)).body;
}
- parent13 = parent13.parent;
+ parent2 = parent2.parent;
}
return null;
}
@@ -596,7 +605,7 @@
* @param keyword the keyword being tested for
* @return {@code true} if the given token is a token for the given keyword
*/
- bool matches(sc.Token token, sc.Keyword keyword37) => token != null && identical(token.type, sc.TokenType.KEYWORD) && identical(((token as sc.KeywordToken)).keyword, keyword37);
+ bool matches(sc.Token token, sc.Keyword keyword2) => token != null && identical(token.type, sc.TokenType.KEYWORD) && identical(((token as sc.KeywordToken)).keyword, keyword2);
/**
* Make the given holder be the current holder while visiting the given node.
* @param holder the holder that will gather elements that are built while visiting the children
@@ -689,8 +698,18 @@
void addTypeVariable(TypeVariableElement element) {
_typeVariables.add(element);
}
- List<PropertyAccessorElement> get accessors => new List.from(_accessors);
- List<ConstructorElement> get constructors => new List.from(_constructors);
+ List<PropertyAccessorElement> get accessors {
+ if (_accessors.isEmpty) {
+ return PropertyAccessorElementImpl.EMPTY_ARRAY;
+ }
+ return new List.from(_accessors);
+ }
+ List<ConstructorElement> get constructors {
+ if (_constructors.isEmpty) {
+ return ConstructorElementImpl.EMPTY_ARRAY;
+ }
+ return new List.from(_constructors);
+ }
FieldElement getField(String fieldName) {
for (FieldElement field in _fields) {
if (field.name == fieldName) {
@@ -699,16 +718,66 @@
}
return null;
}
- List<FieldElement> get fields => new List.from(_fields);
- List<FunctionElement> get functions => new List.from(_functions);
- List<LabelElement> get labels => new List.from(_labels);
- List<LocalVariableElement> get localVariables => new List.from(_localVariables);
- List<MethodElement> get methods => new List.from(_methods);
- List<ParameterElement> get parameters => new List.from(_parameters);
- List<TopLevelVariableElement> get topLevelVariables => new List.from(_topLevelVariables);
- List<FunctionTypeAliasElement> get typeAliases => new List.from(_typeAliases);
- List<ClassElement> get types => new List.from(_types);
- List<TypeVariableElement> get typeVariables => new List.from(_typeVariables);
+ List<FieldElement> get fields {
+ if (_fields.isEmpty) {
+ return FieldElementImpl.EMPTY_ARRAY;
+ }
+ return new List.from(_fields);
+ }
+ List<FunctionElement> get functions {
+ if (_functions.isEmpty) {
+ return FunctionElementImpl.EMPTY_ARRAY;
+ }
+ return new List.from(_functions);
+ }
+ List<LabelElement> get labels {
+ if (_labels.isEmpty) {
+ return LabelElementImpl.EMPTY_ARRAY;
+ }
+ return new List.from(_labels);
+ }
+ List<LocalVariableElement> get localVariables {
+ if (_localVariables.isEmpty) {
+ return LocalVariableElementImpl.EMPTY_ARRAY;
+ }
+ return new List.from(_localVariables);
+ }
+ List<MethodElement> get methods {
+ if (_methods.isEmpty) {
+ return MethodElementImpl.EMPTY_ARRAY;
+ }
+ return new List.from(_methods);
+ }
+ List<ParameterElement> get parameters {
+ if (_parameters.isEmpty) {
+ return ParameterElementImpl.EMPTY_ARRAY;
+ }
+ return new List.from(_parameters);
+ }
+ List<TopLevelVariableElement> get topLevelVariables {
+ if (_topLevelVariables.isEmpty) {
+ return TopLevelVariableElementImpl.EMPTY_ARRAY;
+ }
+ return new List.from(_topLevelVariables);
+ }
+ List<FunctionTypeAliasElement> get typeAliases {
+ if (_typeAliases.isEmpty) {
+ return FunctionTypeAliasElementImpl.EMPTY_ARRAY;
+ }
+ return new List.from(_typeAliases);
+ }
+ List<ClassElement> get types {
+ if (_types.isEmpty) {
+ return ClassElementImpl.EMPTY_ARRAY;
+ }
+ return new List.from(_types);
+ }
+ List<TypeVariableElement> get typeVariables {
+ if (_typeVariables.isEmpty) {
+ return TypeVariableElementImpl.EMPTY_ARRAY;
+ }
+ return new List.from(_typeVariables);
+ }
}
/**
* Instances of the class {@code HtmlUnitBuilder} build an element model for a single HTML unit.
@@ -722,7 +791,7 @@
/**
* The analysis context in which the element model will be built.
*/
- AnalysisContextImpl _context;
+ InternalAnalysisContext _context;
/**
* The HTML element being built.
*/
@@ -735,7 +804,7 @@
* Initialize a newly created HTML unit builder.
* @param context the analysis context in which the element model will be built
*/
- HtmlUnitBuilder(AnalysisContextImpl context) {
+ HtmlUnitBuilder(InternalAnalysisContext context) {
this._context = context;
}
/**
@@ -751,9 +820,9 @@
* @param unit the AST structure representing the HTML
* @throws AnalysisException if the analysis could not be performed
*/
- HtmlElementImpl buildHtmlElement2(Source source14, ht.HtmlUnit unit) {
- HtmlElementImpl result = new HtmlElementImpl(_context, source14.shortName);
- result.source = source14;
+ HtmlElementImpl buildHtmlElement2(Source source2, ht.HtmlUnit unit) {
+ HtmlElementImpl result = new HtmlElementImpl(_context, source2.shortName);
+ result.source = source2;
_htmlElement = result;
unit.accept(this);
_htmlElement = null;
@@ -775,15 +844,15 @@
if (identical(node.attributeEnd.type, ht.TokenType.GT) && scriptSourcePath == null) {
EmbeddedHtmlScriptElementImpl script = new EmbeddedHtmlScriptElementImpl(node);
String contents = node.content;
- AnalysisErrorListener errorListener = new AnalysisErrorListener_2();
+ AnalysisErrorListener errorListener = new AnalysisErrorListener_5();
sc.StringScanner scanner = new sc.StringScanner(null, contents, errorListener);
sc.Token firstToken = scanner.tokenize();
List<int> lineStarts2 = scanner.lineStarts;
Parser parser = new Parser(null, errorListener);
CompilationUnit unit = parser.parseCompilationUnit(firstToken);
try {
- CompilationUnitBuilder builder = new CompilationUnitBuilder(_context);
- CompilationUnitElementImpl elem = builder.buildCompilationUnit2(htmlSource, unit);
+ CompilationUnitBuilder builder = new CompilationUnitBuilder();
+ CompilationUnitElementImpl elem = builder.buildCompilationUnit(htmlSource, unit);
LibraryElementImpl library = new LibraryElementImpl(_context, null);
library.definingCompilationUnit = elem;
script.scriptLibrary = library;
@@ -794,7 +863,7 @@
} else {
ExternalHtmlScriptElementImpl script = new ExternalHtmlScriptElementImpl(node);
if (scriptSourcePath != null) {
- script.scriptSource = htmlSource.resolve(scriptSourcePath);
+ script.scriptSource = _context.sourceFactory.resolveUri(htmlSource, scriptSourcePath);
}
_scripts.add(script);
}
@@ -840,11 +909,494 @@
return false;
}
}
-class AnalysisErrorListener_2 implements AnalysisErrorListener {
+class AnalysisErrorListener_5 implements AnalysisErrorListener {
void onError(AnalysisError error) {
}
}
/**
+ * Instances of the class {@code DeclarationResolver} are used to resolve declarations in an AST
+ * structure to already built elements.
+ */
+class DeclarationResolver extends RecursiveASTVisitor<Object> {
+ /**
+ * The compilation unit containing the AST nodes being visited.
+ */
+ CompilationUnitElement _enclosingUnit;
+ /**
+ * The function type alias containing the AST nodes being visited, or {@code null} if we are not
+ * in the scope of a function type alias.
+ */
+ FunctionTypeAliasElement _enclosingAlias;
+ /**
+ * The class containing the AST nodes being visited, or {@code null} if we are not in the scope of
+ * a class.
+ */
+ ClassElement _enclosingClass;
+ /**
+ * The method or function containing the AST nodes being visited, or {@code null} if we are not in
+ * the scope of a method or function.
+ */
+ ExecutableElement _enclosingExecutable;
+ /**
+ * The parameter containing the AST nodes being visited, or {@code null} if we are not in the
+ * scope of a parameter.
+ */
+ ParameterElement _enclosingParameter;
+ /**
+ * Initialize a newly created resolver.
+ */
+ DeclarationResolver() : super() {
+ }
+ /**
+ * Resolve the declarations within the given compilation unit to the elements rooted at the given
+ * element.
+ * @param unit the compilation unit to be resolved
+ * @param element the root of the element model used to resolve the AST nodes
+ */
+ void resolve(CompilationUnit unit, CompilationUnitElement element2) {
+ _enclosingUnit = element2;
+ unit.element = element2;
+ unit.accept(this);
+ }
+ Object visitCatchClause(CatchClause node) {
+ SimpleIdentifier exceptionParameter2 = node.exceptionParameter;
+ if (exceptionParameter2 != null) {
+ List<LocalVariableElement> localVariables2 = _enclosingExecutable.localVariables;
+ find3(localVariables2, exceptionParameter2);
+ SimpleIdentifier stackTraceParameter2 = node.stackTraceParameter;
+ if (stackTraceParameter2 != null) {
+ find3(localVariables2, stackTraceParameter2);
+ }
+ }
+ return super.visitCatchClause(node);
+ }
+ Object visitClassDeclaration(ClassDeclaration node) {
+ ClassElement outerClass = _enclosingClass;
+ try {
+ SimpleIdentifier className = node.name;
+ _enclosingClass = find3(_enclosingUnit.types, className);
+ return super.visitClassDeclaration(node);
+ } finally {
+ _enclosingClass = outerClass;
+ }
+ }
+ Object visitClassTypeAlias(ClassTypeAlias node) {
+ ClassElement outerClass = _enclosingClass;
+ try {
+ SimpleIdentifier className = node.name;
+ _enclosingClass = find3(_enclosingUnit.types, className);
+ return super.visitClassTypeAlias(node);
+ } finally {
+ _enclosingClass = outerClass;
+ }
+ }
+ Object visitConstructorDeclaration(ConstructorDeclaration node) {
+ ExecutableElement outerExecutable = _enclosingExecutable;
+ try {
+ SimpleIdentifier constructorName = node.name;
+ if (constructorName == null) {
+ _enclosingExecutable = _enclosingClass.unnamedConstructor;
+ } else {
+ _enclosingExecutable = _enclosingClass.getNamedConstructor(constructorName.name);
+ constructorName.element = _enclosingExecutable;
+ }
+ node.element = _enclosingExecutable as ConstructorElement;
+ return super.visitConstructorDeclaration(node);
+ } finally {
+ _enclosingExecutable = outerExecutable;
+ }
+ }
+ Object visitDeclaredIdentifier(DeclaredIdentifier node) {
+ SimpleIdentifier variableName = node.identifier;
+ find3(_enclosingExecutable.localVariables, variableName);
+ return super.visitDeclaredIdentifier(node);
+ }
+ Object visitDefaultFormalParameter(DefaultFormalParameter node) {
+ SimpleIdentifier parameterName = node.parameter.identifier;
+ ParameterElement element = null;
+ if (_enclosingExecutable != null) {
+ element = find3(_enclosingExecutable.parameters, parameterName);
+ } else {
+ PrintStringWriter writer = new PrintStringWriter();
+ writer.println("Invalid state found in the Analysis Engine:");
+ writer.println("DeclarationResolver.visitDefaultFormalParameter() is visiting a parameter that does not appear to be in a method or function.");
+ writer.println("Ancestors:");
+ ASTNode parent2 = node.parent;
+ while (parent2 != null) {
+ writer.println(parent2.runtimeType.toString());
+ writer.println("---------");
+ parent2 = parent2.parent;
+ }
+ AnalysisEngine.instance.logger.logError2(writer.toString(), new AnalysisException());
+ }
+ Expression defaultValue2 = node.defaultValue;
+ if (defaultValue2 != null) {
+ ExecutableElement outerExecutable = _enclosingExecutable;
+ try {
+ if (element == null) {
+ } else {
+ _enclosingExecutable = element.initializer;
+ }
+ defaultValue2.accept(this);
+ } finally {
+ _enclosingExecutable = outerExecutable;
+ }
+ }
+ ParameterElement outerParameter = _enclosingParameter;
+ try {
+ _enclosingParameter = element;
+ return super.visitDefaultFormalParameter(node);
+ } finally {
+ _enclosingParameter = outerParameter;
+ }
+ }
+ Object visitExportDirective(ExportDirective node) {
+ String uri2 = getStringValue(node.uri);
+ if (uri2 != null) {
+ LibraryElement library2 = _enclosingUnit.library;
+ ExportElement exportElement = find5(library2.exports, _enclosingUnit.context.sourceFactory.resolveUri(_enclosingUnit.source, uri2));
+ node.element = exportElement;
+ }
+ return super.visitExportDirective(node);
+ }
+ Object visitFieldFormalParameter(FieldFormalParameter node) {
+ if (node.parent is! DefaultFormalParameter) {
+ SimpleIdentifier parameterName = node.identifier;
+ ParameterElement element = find3(_enclosingExecutable.parameters, parameterName);
+ ParameterElement outerParameter = _enclosingParameter;
+ try {
+ _enclosingParameter = element;
+ return super.visitFieldFormalParameter(node);
+ } finally {
+ _enclosingParameter = outerParameter;
+ }
+ } else {
+ return super.visitFieldFormalParameter(node);
+ }
+ }
+ Object visitFunctionDeclaration(FunctionDeclaration node) {
+ ExecutableElement outerExecutable = _enclosingExecutable;
+ try {
+ SimpleIdentifier functionName = node.name;
+ sc.Token property = node.propertyKeyword;
+ if (property == null) {
+ if (_enclosingExecutable != null) {
+ _enclosingExecutable = find3(_enclosingExecutable.functions, functionName);
+ } else {
+ _enclosingExecutable = find3(_enclosingUnit.functions, functionName);
+ }
+ } else {
+ PropertyAccessorElement accessor = find3(_enclosingUnit.accessors, functionName);
+ if (identical(((property as sc.KeywordToken)).keyword, sc.Keyword.SET)) {
+ accessor = accessor.variable.setter;
+ functionName.element = accessor;
+ }
+ _enclosingExecutable = accessor;
+ }
+ node.functionExpression.element = _enclosingExecutable;
+ return super.visitFunctionDeclaration(node);
+ } finally {
+ _enclosingExecutable = outerExecutable;
+ }
+ }
+ Object visitFunctionExpression(FunctionExpression node) {
+ if (node.parent is! FunctionDeclaration) {
+ FunctionElement element = find2(_enclosingExecutable.functions, node.beginToken.offset);
+ node.element = element;
+ }
+ ExecutableElement outerExecutable = _enclosingExecutable;
+ try {
+ _enclosingExecutable = node.element;
+ return super.visitFunctionExpression(node);
+ } finally {
+ _enclosingExecutable = outerExecutable;
+ }
+ }
+ Object visitFunctionTypeAlias(FunctionTypeAlias node) {
+ FunctionTypeAliasElement outerAlias = _enclosingAlias;
+ try {
+ SimpleIdentifier aliasName = node.name;
+ _enclosingAlias = find3(_enclosingUnit.functionTypeAliases, aliasName);
+ return super.visitFunctionTypeAlias(node);
+ } finally {
+ _enclosingAlias = outerAlias;
+ }
+ }
+ Object visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) {
+ if (node.parent is! DefaultFormalParameter) {
+ SimpleIdentifier parameterName = node.identifier;
+ ParameterElement element = find3(_enclosingExecutable.parameters, parameterName);
+ ParameterElement outerParameter = _enclosingParameter;
+ try {
+ _enclosingParameter = element;
+ return super.visitFunctionTypedFormalParameter(node);
+ } finally {
+ _enclosingParameter = outerParameter;
+ }
+ } else {
+ return super.visitFunctionTypedFormalParameter(node);
+ }
+ }
+ Object visitImportDirective(ImportDirective node) {
+ String uri2 = getStringValue(node.uri);
+ if (uri2 != null) {
+ LibraryElement library2 = _enclosingUnit.library;
+ ImportElement importElement = find6(library2.imports, _enclosingUnit.context.sourceFactory.resolveUri(_enclosingUnit.source, uri2), node.prefix);
+ node.element = importElement;
+ }
+ return super.visitImportDirective(node);
+ }
+ Object visitLabeledStatement(LabeledStatement node) {
+ for (Label label in node.labels) {
+ SimpleIdentifier labelName = label.label;
+ find3(_enclosingExecutable.labels, labelName);
+ }
+ return super.visitLabeledStatement(node);
+ }
+ Object visitLibraryDirective(LibraryDirective node) {
+ node.element = _enclosingUnit.library;
+ return super.visitLibraryDirective(node);
+ }
+ Object visitMethodDeclaration(MethodDeclaration node) {
+ ExecutableElement outerExecutable = _enclosingExecutable;
+ try {
+ sc.Token property = node.propertyKeyword;
+ SimpleIdentifier methodName = node.name;
+ String nameOfMethod = methodName.name;
+ if (nameOfMethod == sc.TokenType.MINUS.lexeme && node.parameters.parameters.length == 0) {
+ nameOfMethod = "unary-";
+ }
+ if (property == null) {
+ _enclosingExecutable = find4(_enclosingClass.methods, nameOfMethod, methodName.offset);
+ methodName.element = _enclosingExecutable;
+ } else {
+ PropertyAccessorElement accessor = find3(_enclosingClass.accessors, methodName);
+ if (identical(((property as sc.KeywordToken)).keyword, sc.Keyword.SET)) {
+ accessor = accessor.variable.setter;
+ methodName.element = accessor;
+ }
+ _enclosingExecutable = accessor;
+ }
+ return super.visitMethodDeclaration(node);
+ } finally {
+ _enclosingExecutable = outerExecutable;
+ }
+ }
+ Object visitPartDirective(PartDirective node) {
+ String uri2 = getStringValue(node.uri);
+ if (uri2 != null) {
+ Source partSource = _enclosingUnit.context.sourceFactory.resolveUri(_enclosingUnit.source, uri2);
+ node.element = find(_enclosingUnit.library.parts, partSource);
+ }
+ return super.visitPartDirective(node);
+ }
+ Object visitPartOfDirective(PartOfDirective node) {
+ node.element = _enclosingUnit.library;
+ return super.visitPartOfDirective(node);
+ }
+ Object visitSimpleFormalParameter(SimpleFormalParameter node) {
+ if (node.parent is! DefaultFormalParameter) {
+ SimpleIdentifier parameterName = node.identifier;
+ ParameterElement element = null;
+ if (_enclosingParameter != null) {
+ element = find3(_enclosingParameter.parameters, parameterName);
+ } else if (_enclosingExecutable != null) {
+ element = find3(_enclosingExecutable.parameters, parameterName);
+ } else if (_enclosingAlias != null) {
+ element = find3(_enclosingAlias.parameters, parameterName);
+ } else {
+ }
+ ParameterElement outerParameter = _enclosingParameter;
+ try {
+ _enclosingParameter = element;
+ return super.visitSimpleFormalParameter(node);
+ } finally {
+ _enclosingParameter = outerParameter;
+ }
+ } else {
+ }
+ return super.visitSimpleFormalParameter(node);
+ }
+ Object visitSwitchCase(SwitchCase node) {
+ for (Label label in node.labels) {
+ SimpleIdentifier labelName = label.label;
+ find3(_enclosingExecutable.labels, labelName);
+ }
+ return super.visitSwitchCase(node);
+ }
+ Object visitSwitchDefault(SwitchDefault node) {
+ for (Label label in node.labels) {
+ SimpleIdentifier labelName = label.label;
+ find3(_enclosingExecutable.labels, labelName);
+ }
+ return super.visitSwitchDefault(node);
+ }
+ Object visitTypeParameter(TypeParameter node) {
+ SimpleIdentifier parameterName = node.name;
+ if (_enclosingClass != null) {
+ find3(_enclosingClass.typeVariables, parameterName);
+ } else if (_enclosingAlias != null) {
+ find3(_enclosingAlias.typeVariables, parameterName);
+ }
+ return super.visitTypeParameter(node);
+ }
+ Object visitVariableDeclaration(VariableDeclaration node) {
+ VariableElement element = null;
+ SimpleIdentifier variableName = node.name;
+ if (_enclosingExecutable != null) {
+ element = find3(_enclosingExecutable.localVariables, variableName);
+ }
+ if (element == null && _enclosingClass != null) {
+ element = find3(_enclosingClass.fields, variableName);
+ }
+ if (element == null && _enclosingUnit != null) {
+ element = find3(_enclosingUnit.topLevelVariables, variableName);
+ }
+ Expression initializer2 = node.initializer;
+ if (initializer2 != null) {
+ ExecutableElement outerExecutable = _enclosingExecutable;
+ try {
+ if (element == null) {
+ } else {
+ _enclosingExecutable = element.initializer;
+ }
+ return super.visitVariableDeclaration(node);
+ } finally {
+ _enclosingExecutable = outerExecutable;
+ }
+ }
+ return super.visitVariableDeclaration(node);
+ }
+ /**
+ * Append the value of the given string literal to the given string builder.
+ * @param builder the builder to which the string's value is to be appended
+ * @param literal the string literal whose value is to be appended to the builder
+ * @throws IllegalArgumentException if the string is not a constant string without any string
+ * interpolation
+ */
+ void appendStringValue(JavaStringBuilder builder, StringLiteral literal) {
+ if (literal is SimpleStringLiteral) {
+ builder.append(((literal as SimpleStringLiteral)).value);
+ } else if (literal is AdjacentStrings) {
+ for (StringLiteral stringLiteral in ((literal as AdjacentStrings)).strings) {
+ appendStringValue(builder, stringLiteral);
+ }
+ } else {
+ throw new IllegalArgumentException();
+ }
+ }
+ /**
+ * Return the element for the part with the given source, or {@code null} if there is no element
+ * for the given source.
+ * @param parts the elements for the parts
+ * @param partSource the source for the part whose element is to be returned
+ * @return the element for the part with the given source
+ */
+ CompilationUnitElement find(List<CompilationUnitElement> parts, Source partSource) {
+ for (CompilationUnitElement part in parts) {
+ if (part.source == partSource) {
+ return part;
+ }
+ }
+ return null;
+ }
+ /**
+ * Return the element in the given array of elements that was created for the declaration at the
+ * given offset. This method should only be used when there is no name
+ * @param elements the elements of the appropriate kind that exist in the current context
+ * @param offset the offset of the name of the element to be returned
+ * @return the element at the given offset
+ */
+ Element find2(List<Element> elements, int offset) => find4(elements, "", offset);
+ /**
+ * Return the element in the given array of elements that was created for the declaration with the
+ * given name.
+ * @param elements the elements of the appropriate kind that exist in the current context
+ * @param identifier the name node in the declaration of the element to be returned
+ * @return the element created for the declaration with the given name
+ */
+ Element find3(List<Element> elements, SimpleIdentifier identifier) {
+ Element element = find4(elements, identifier.name, identifier.offset);
+ identifier.element = element;
+ return element;
+ }
+ /**
+ * Return the element in the given array of elements that was created for the declaration with the
+ * given name at the given offset.
+ * @param elements the elements of the appropriate kind that exist in the current context
+ * @param name the name of the element to be returned
+ * @param offset the offset of the name of the element to be returned
+ * @return the element with the given name and offset
+ */
+ Element find4(List<Element> elements, String name2, int offset) {
+ for (Element element in elements) {
+ if (element.name == name2 && element.nameOffset == offset) {
+ return element;
+ }
+ }
+ return null;
+ }
+ /**
+ * Return the export element from the given array whose library has the given source, or{@code null} if there is no such export.
+ * @param exports the export elements being searched
+ * @param source the source of the library associated with the export element to being searched
+ * for
+ * @return the export element whose library has the given source
+ */
+ ExportElement find5(List<ExportElement> exports, Source source2) {
+ for (ExportElement export in exports) {
+ if (export.exportedLibrary.source == source2) {
+ return export;
+ }
+ }
+ return null;
+ }
+ /**
+ * Return the import element from the given array whose library has the given source and that has
+ * the given prefix, or {@code null} if there is no such import.
+ * @param imports the import elements being searched
+ * @param source the source of the library associated with the import element to being searched
+ * for
+ * @param prefix the prefix with which the library was imported
+ * @return the import element whose library has the given source and prefix
+ */
+ ImportElement find6(List<ImportElement> imports, Source source2, SimpleIdentifier prefix2) {
+ for (ImportElement element in imports) {
+ if (element.importedLibrary.source == source2) {
+ PrefixElement prefixElement = element.prefix;
+ if (prefix2 == null) {
+ if (prefixElement == null) {
+ return element;
+ }
+ } else {
+ if (prefixElement != null && prefix2.name == prefixElement.name) {
+ return element;
+ }
+ }
+ }
+ }
+ return null;
+ }
+ /**
+ * Return the value of the given string literal, or {@code null} if the string is not a constant
+ * string without any string interpolation.
+ * @param literal the string literal whose value is to be returned
+ * @return the value of the given string literal
+ */
+ String getStringValue(StringLiteral literal) {
+ if (literal is StringInterpolation) {
+ return null;
+ }
+ JavaStringBuilder builder = new JavaStringBuilder();
+ try {
+ appendStringValue(builder, literal);
+ } on IllegalArgumentException catch (exception) {
+ return null;
+ }
+ return builder.toString().trim();
+ }
+}
+/**
* Instances of the class {@code ElementResolver} are used by instances of {@link ResolverVisitor}to resolve references within the AST structure to the elements being referenced. The requirements
* for the element resolver are:
* <ol>
@@ -904,20 +1456,17 @@
this._resolver = resolver;
}
Object visitAssignmentExpression(AssignmentExpression node) {
- sc.TokenType operator7 = node.operator.type;
- if (operator7 != sc.TokenType.EQ) {
- operator7 = operatorFromCompoundAssignment(operator7);
+ sc.TokenType operator2 = node.operator.type;
+ if (operator2 != sc.TokenType.EQ) {
+ operator2 = operatorFromCompoundAssignment(operator2);
Expression leftNode = node.leftHandSide;
if (leftNode != null) {
Type2 leftType = getType(leftNode);
if (leftType != null) {
- Element leftElement = leftType.element;
- if (leftElement != null) {
- MethodElement method = lookUpMethod(leftElement, operator7.lexeme);
- if (method != null) {
- node.element = method;
- } else {
- }
+ MethodElement method = lookUpMethod(leftType, operator2.lexeme);
+ if (method != null) {
+ node.element = method;
+ } else {
}
}
}
@@ -925,21 +1474,18 @@
return null;
}
Object visitBinaryExpression(BinaryExpression node) {
- sc.Token operator8 = node.operator;
- if (operator8.isUserDefinableOperator()) {
+ sc.Token operator2 = node.operator;
+ if (operator2.isUserDefinableOperator()) {
Type2 leftType = getType(node.leftOperand);
- Element leftTypeElement;
if (leftType == null || leftType.isDynamic()) {
return null;
} else if (leftType is FunctionType) {
- leftTypeElement = _resolver.typeProvider.functionType.element;
- } else {
- leftTypeElement = leftType.element;
+ leftType = _resolver.typeProvider.functionType;
}
- String methodName = operator8.lexeme;
- MethodElement member = lookUpMethod(leftTypeElement, methodName);
+ String methodName = operator2.lexeme;
+ MethodElement member = lookUpMethod(leftType, methodName);
if (member == null) {
- _resolver.reportError3(ResolverErrorCode.CANNOT_BE_RESOLVED, operator8, [methodName]);
+ _resolver.reportError3(StaticWarningCode.UNDEFINED_OPERATOR, operator2, [methodName, leftType.name]);
} else {
node.element = member;
}
@@ -954,28 +1500,43 @@
}
return null;
}
+ Object visitConstructorFieldInitializer(ConstructorFieldInitializer node) {
+ FieldElement fieldElement = null;
+ SimpleIdentifier fieldName2 = node.fieldName;
+ ClassElement enclosingClass2 = _resolver.enclosingClass;
+ fieldElement = ((enclosingClass2 as ClassElementImpl)).getField(fieldName2.name);
+ if (fieldElement == null) {
+ _resolver.reportError(CompileTimeErrorCode.INITIALIZER_FOR_NON_EXISTANT_FIELD, node, [fieldName2]);
+ } else if (!fieldElement.isSynthetic()) {
+ recordResolution(fieldName2, fieldElement);
+ if (fieldElement.isStatic()) {
+ _resolver.reportError(CompileTimeErrorCode.INITIALIZER_FOR_STATIC_FIELD, node, [fieldName2]);
+ }
+ }
+ return null;
+ }
Object visitConstructorName(ConstructorName node) {
- Type2 type13 = node.type.type;
- if (type13 is DynamicTypeImpl) {
+ Type2 type2 = node.type.type;
+ if (type2 is DynamicTypeImpl) {
return null;
- } else if (type13 is! InterfaceType) {
- ASTNode parent14 = node.parent;
- if (parent14 is InstanceCreationExpression) {
- if (((parent14 as InstanceCreationExpression)).isConst()) {
+ } else if (type2 is! InterfaceType) {
+ ASTNode parent2 = node.parent;
+ if (parent2 is InstanceCreationExpression) {
+ if (((parent2 as InstanceCreationExpression)).isConst()) {
} else {
}
} else {
}
return null;
}
- ClassElement classElement = ((type13 as InterfaceType)).element;
+ ClassElement classElement = ((type2 as InterfaceType)).element;
ConstructorElement constructor;
- SimpleIdentifier name15 = node.name;
- if (name15 == null) {
+ SimpleIdentifier name2 = node.name;
+ if (name2 == null) {
constructor = classElement.unnamedConstructor;
} else {
- constructor = classElement.getNamedConstructor(name15.name);
- name15.element = constructor;
+ constructor = classElement.getNamedConstructor(name2.name);
+ name2.element = constructor;
}
node.element = constructor;
return null;
@@ -989,12 +1550,33 @@
return null;
}
Object visitExportDirective(ExportDirective node) {
- Element element26 = node.element;
- if (element26 is ExportElement) {
- resolveCombinators(((element26 as ExportElement)).exportedLibrary, node.combinators);
+ Element element2 = node.element;
+ if (element2 is ExportElement) {
+ resolveCombinators(((element2 as ExportElement)).exportedLibrary, node.combinators);
}
return null;
}
+ Object visitFieldFormalParameter(FieldFormalParameter node) {
+ String fieldName = node.identifier.name;
+ ClassElement classElement = _resolver.enclosingClass;
+ if (classElement != null) {
+ FieldElement fieldElement = ((classElement as ClassElementImpl)).getField(fieldName);
+ if (fieldElement != null) {
+ if (!fieldElement.isSynthetic()) {
+ ParameterElement parameterElement = node.element;
+ if (parameterElement is FieldFormalParameterElementImpl) {
+ ((parameterElement as FieldFormalParameterElementImpl)).field = fieldElement;
+ if (fieldElement.isStatic()) {
+ _resolver.reportError(CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_STATIC_FIELD, node, [fieldName]);
+ }
+ }
+ }
+ } else {
+ _resolver.reportError(CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTANT_FIELD, node, [fieldName]);
+ }
+ }
+ return super.visitFieldFormalParameter(node);
+ }
Object visitFunctionExpressionInvocation(FunctionExpressionInvocation node) => null;
Object visitImportDirective(ImportDirective node) {
SimpleIdentifier prefixNode = node.prefix;
@@ -1007,9 +1589,9 @@
}
}
}
- Element element27 = node.element;
- if (element27 is ImportElement) {
- resolveCombinators(((element27 as ImportElement)).importedLibrary, node.combinators);
+ Element element2 = node.element;
+ if (element2 is ImportElement) {
+ resolveCombinators(((element2 as ImportElement)).importedLibrary, node.combinators);
}
return null;
}
@@ -1018,16 +1600,15 @@
if (arrayType == null || arrayType.isDynamic()) {
return null;
}
- Element arrayTypeElement = arrayType.element;
String operator;
if (node.inSetterContext()) {
operator = sc.TokenType.INDEX_EQ.lexeme;
} else {
operator = sc.TokenType.INDEX.lexeme;
}
- MethodElement member = lookUpMethod(arrayTypeElement, operator);
+ MethodElement member = lookUpMethod(arrayType, operator);
if (member == null) {
- _resolver.reportError(ResolverErrorCode.CANNOT_BE_RESOLVED, node, [operator]);
+ _resolver.reportError(StaticWarningCode.UNDEFINED_OPERATOR, node, [operator, arrayType.name]);
} else {
node.element = member;
}
@@ -1046,32 +1627,36 @@
if (target == null) {
element = _resolver.nameScope.lookup(methodName2, _resolver.definingLibrary);
if (element == null) {
- element = lookUpMethod(_resolver.enclosingClass, methodName2.name);
- if (element == null) {
- PropertyAccessorElement getter = lookUpGetter(_resolver.enclosingClass, methodName2.name);
- if (getter != null) {
- FunctionType getterType = getter.type;
- if (getterType != null) {
- Type2 returnType5 = getterType.returnType;
- if (!isExecutableType(returnType5)) {
- _resolver.reportError(StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION, methodName2, [methodName2.name]);
+ ClassElement enclosingClass2 = _resolver.enclosingClass;
+ if (enclosingClass2 != null) {
+ InterfaceType enclosingType = enclosingClass2.type;
+ element = lookUpMethod(enclosingType, methodName2.name);
+ if (element == null) {
+ PropertyAccessorElement getter = lookUpGetter(enclosingType, methodName2.name);
+ if (getter != null) {
+ FunctionType getterType = getter.type;
+ if (getterType != null) {
+ Type2 returnType2 = getterType.returnType;
+ if (!isExecutableType(returnType2)) {
+ _resolver.reportError(StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION, methodName2, [methodName2.name]);
+ }
}
+ recordResolution(methodName2, getter);
+ return null;
}
- recordResolution(methodName2, getter);
- return null;
}
}
}
} else {
Type2 targetType = getType(target);
if (targetType is InterfaceType) {
- element = lookUpMethod(targetType.element, methodName2.name);
+ InterfaceType classType = targetType as InterfaceType;
+ element = lookUpMethod(classType, methodName2.name);
if (element == null) {
- ClassElement targetClass = targetType.element as ClassElement;
- PropertyAccessorElement accessor = lookUpGetterInType(targetClass, methodName2.name);
+ PropertyAccessorElement accessor = classType.getGetter(methodName2.name);
if (accessor != null) {
- Type2 returnType6 = accessor.type.returnType.substitute2(((targetType as InterfaceType)).typeArguments, TypeVariableTypeImpl.getTypes(targetClass.typeVariables));
- if (!isExecutableType(returnType6)) {
+ Type2 returnType3 = accessor.type.returnType;
+ if (!isExecutableType(returnType3)) {
_resolver.reportError(StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION, methodName2, [methodName2.name]);
return null;
}
@@ -1085,8 +1670,8 @@
} else if (target is SimpleIdentifier) {
Element targetElement = ((target as SimpleIdentifier)).element;
if (targetElement is PrefixElement) {
- String name9 = "${((target as SimpleIdentifier)).name}.${methodName2}";
- Identifier functionName = new Identifier_5(name9);
+ String name3 = "${((target as SimpleIdentifier)).name}.${methodName2}";
+ Identifier functionName = new Identifier_8(name3);
element = _resolver.nameScope.lookup(functionName, _resolver.definingLibrary);
} else {
return null;
@@ -1096,29 +1681,60 @@
}
}
ExecutableElement invokedMethod = null;
- if (element is ExecutableElement) {
+ if (element is PropertyAccessorElement) {
+ PropertyAccessorElement getter = element as PropertyAccessorElement;
+ FunctionType getterType = getter.type;
+ if (getterType != null) {
+ Type2 returnType4 = getterType.returnType;
+ if (!isExecutableType(returnType4)) {
+ _resolver.reportError(StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION, methodName2, [methodName2.name]);
+ }
+ }
+ recordResolution(methodName2, element);
+ return null;
+ } else if (element is ExecutableElement) {
invokedMethod = element as ExecutableElement;
} else {
if (element is PropertyInducingElement) {
- PropertyAccessorElement getter3 = ((element as PropertyInducingElement)).getter;
- FunctionType getterType = getter3.type;
+ PropertyAccessorElement getter2 = ((element as PropertyInducingElement)).getter;
+ FunctionType getterType = getter2.type;
if (getterType != null) {
- Type2 returnType7 = getterType.returnType;
- if (!isExecutableType(returnType7)) {
+ Type2 returnType5 = getterType.returnType;
+ if (!isExecutableType(returnType5)) {
_resolver.reportError(StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION, methodName2, [methodName2.name]);
}
}
recordResolution(methodName2, element);
return null;
} else if (element is VariableElement) {
- Type2 variableType = ((element as VariableElement)).type;
+ Type2 variableType = _resolver.overrideManager.getType(element);
+ if (variableType == null) {
+ variableType = ((element as VariableElement)).type;
+ }
if (!isExecutableType(variableType)) {
_resolver.reportError(StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION, methodName2, [methodName2.name]);
}
recordResolution(methodName2, element);
return null;
} else {
- _resolver.reportError(StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION, methodName2, [methodName2.name]);
+ if (target == null) {
+ ClassElement enclosingClass3 = _resolver.enclosingClass;
+ if (enclosingClass3 == null) {
+ _resolver.reportError(StaticTypeWarningCode.UNDEFINED_FUNCTION, methodName2, [methodName2.name]);
+ } else if (element == null) {
+ _resolver.reportError(StaticTypeWarningCode.UNDEFINED_METHOD, methodName2, [methodName2.name, enclosingClass3.name]);
+ } else {
+ _resolver.reportError(StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION, methodName2, [methodName2.name]);
+ }
+ } else {
+ Type2 targetType = getType(target);
+ String targetTypeName = targetType == null ? null : targetType.name;
+ if (targetTypeName == null) {
+ _resolver.reportError(StaticTypeWarningCode.UNDEFINED_FUNCTION, methodName2, [methodName2.name]);
+ } else {
+ _resolver.reportError(StaticTypeWarningCode.UNDEFINED_METHOD, methodName2, [methodName2.name, targetTypeName]);
+ }
+ }
return null;
}
}
@@ -1127,115 +1743,113 @@
return null;
}
Object visitPostfixExpression(PostfixExpression node) {
- sc.Token operator9 = node.operator;
+ sc.Token operator2 = node.operator;
Type2 operandType = getType(node.operand);
if (operandType == null || operandType.isDynamic()) {
return null;
}
- Element operandTypeElement = operandType.element;
String methodName;
- if (identical(operator9.type, sc.TokenType.PLUS_PLUS)) {
+ if (identical(operator2.type, sc.TokenType.PLUS_PLUS)) {
methodName = sc.TokenType.PLUS.lexeme;
} else {
methodName = sc.TokenType.MINUS.lexeme;
}
- MethodElement member = lookUpMethod(operandTypeElement, methodName);
+ MethodElement member = lookUpMethod(operandType, methodName);
if (member == null) {
- _resolver.reportError3(ResolverErrorCode.CANNOT_BE_RESOLVED, operator9, [methodName]);
+ _resolver.reportError3(StaticWarningCode.UNDEFINED_OPERATOR, operator2, [methodName, operandType.name]);
} else {
node.element = member;
}
return null;
}
Object visitPrefixedIdentifier(PrefixedIdentifier node) {
- SimpleIdentifier prefix6 = node.prefix;
- SimpleIdentifier identifier13 = node.identifier;
- Element prefixElement = prefix6.element;
+ SimpleIdentifier prefix2 = node.prefix;
+ SimpleIdentifier identifier2 = node.identifier;
+ Element prefixElement = prefix2.element;
if (prefixElement is PrefixElement) {
Element element = _resolver.nameScope.lookup(node, _resolver.definingLibrary);
if (element == null) {
return null;
}
- recordResolution(identifier13, element);
+ recordResolution(identifier2, element);
return null;
}
if (prefixElement is ClassElement) {
Element memberElement;
if (node.identifier.inSetterContext()) {
- memberElement = lookUpSetterInType((prefixElement as ClassElement), identifier13.name);
+ memberElement = ((prefixElement as ClassElementImpl)).getSetter(identifier2.name);
} else {
- memberElement = lookUpGetterInType((prefixElement as ClassElement), identifier13.name);
+ memberElement = ((prefixElement as ClassElementImpl)).getGetter(identifier2.name);
}
if (memberElement == null) {
- MethodElement methodElement = lookUpMethod(prefixElement, identifier13.name);
+ MethodElement methodElement = lookUpMethod(((prefixElement as ClassElement)).type, identifier2.name);
if (methodElement != null) {
- recordResolution(identifier13, methodElement);
+ recordResolution(identifier2, methodElement);
return null;
}
}
if (memberElement == null) {
- reportGetterOrSetterNotFound(node, identifier13, prefixElement.name);
+ reportGetterOrSetterNotFound(node, identifier2, prefixElement.name);
} else {
- recordResolution(identifier13, memberElement);
+ recordResolution(identifier2, memberElement);
}
return null;
}
- Element variableTypeElement;
+ Type2 variableType;
if (prefixElement is PropertyAccessorElement) {
PropertyAccessorElement accessor = prefixElement as PropertyAccessorElement;
- FunctionType type14 = accessor.type;
- if (type14 == null) {
+ FunctionType type2 = accessor.type;
+ if (type2 == null) {
return null;
}
- Type2 variableType;
if (accessor.isGetter()) {
- variableType = type14.returnType;
+ variableType = type2.returnType;
} else {
- variableType = type14.normalParameterTypes[0];
+ variableType = type2.normalParameterTypes[0];
}
if (variableType == null || variableType.isDynamic()) {
return null;
}
- variableTypeElement = variableType.element;
} else if (prefixElement is VariableElement) {
- Type2 prefixType = ((prefixElement as VariableElement)).type;
- if (prefixType == null || prefixType.isDynamic()) {
+ variableType = _resolver.overrideManager.getType(prefixElement);
+ if (variableType == null) {
+ variableType = ((prefixElement as VariableElement)).type;
+ }
+ if (variableType == null || variableType.isDynamic()) {
return null;
}
- variableTypeElement = prefixType.element;
} else {
return null;
}
PropertyAccessorElement memberElement = null;
if (node.identifier.inSetterContext()) {
- memberElement = lookUpSetter(variableTypeElement, identifier13.name);
+ memberElement = lookUpSetter(variableType, identifier2.name);
}
if (memberElement == null && node.identifier.inGetterContext()) {
- memberElement = lookUpGetter(variableTypeElement, identifier13.name);
+ memberElement = lookUpGetter(variableType, identifier2.name);
}
if (memberElement == null) {
- MethodElement methodElement = lookUpMethod(variableTypeElement, identifier13.name);
+ MethodElement methodElement = lookUpMethod(variableType, identifier2.name);
if (methodElement != null) {
- recordResolution(identifier13, methodElement);
+ recordResolution(identifier2, methodElement);
return null;
}
}
if (memberElement == null) {
- reportGetterOrSetterNotFound(node, identifier13, variableTypeElement.name);
+ reportGetterOrSetterNotFound(node, identifier2, variableType.element.name);
} else {
- recordResolution(identifier13, memberElement);
+ recordResolution(identifier2, memberElement);
}
return null;
}
Object visitPrefixExpression(PrefixExpression node) {
- sc.Token operator10 = node.operator;
- sc.TokenType operatorType = operator10.type;
+ sc.Token operator2 = node.operator;
+ sc.TokenType operatorType = operator2.type;
if (operatorType.isUserDefinableOperator() || identical(operatorType, sc.TokenType.PLUS_PLUS) || identical(operatorType, sc.TokenType.MINUS_MINUS)) {
Type2 operandType = getType(node.operand);
if (operandType == null || operandType.isDynamic()) {
return null;
}
- Element operandTypeElement = operandType.element;
String methodName;
if (identical(operatorType, sc.TokenType.PLUS_PLUS)) {
methodName = sc.TokenType.PLUS.lexeme;
@@ -1244,11 +1858,11 @@
} else if (identical(operatorType, sc.TokenType.MINUS)) {
methodName = "unary-";
} else {
- methodName = operator10.lexeme;
+ methodName = operator2.lexeme;
}
- MethodElement member = lookUpMethod(operandTypeElement, methodName);
+ MethodElement member = lookUpMethod(operandType, methodName);
if (member == null) {
- _resolver.reportError3(ResolverErrorCode.CANNOT_BE_RESOLVED, operator10, [methodName]);
+ _resolver.reportError3(StaticWarningCode.UNDEFINED_OPERATOR, operator2, [methodName, operandType.name]);
} else {
node.element = member;
}
@@ -1260,24 +1874,29 @@
if (targetType is! InterfaceType) {
return null;
}
- ClassElement targetElement = ((targetType as InterfaceType)).element;
SimpleIdentifier identifier = node.propertyName;
PropertyAccessorElement memberElement = null;
if (identifier.inSetterContext()) {
- memberElement = lookUpSetter(targetElement, identifier.name);
+ memberElement = lookUpSetter(targetType, identifier.name);
}
if (memberElement == null && identifier.inGetterContext()) {
- memberElement = lookUpGetter(targetElement, identifier.name);
+ memberElement = lookUpGetter(targetType, identifier.name);
}
if (memberElement == null) {
- MethodElement methodElement = lookUpMethod(targetElement, identifier.name);
+ MethodElement methodElement = lookUpMethod(targetType, identifier.name);
if (methodElement != null) {
recordResolution(identifier, methodElement);
return null;
}
}
if (memberElement == null) {
- _resolver.reportError(ResolverErrorCode.CANNOT_BE_RESOLVED, identifier, [identifier.name]);
+ if (identifier.inSetterContext()) {
+ _resolver.reportError(StaticWarningCode.UNDEFINED_SETTER, identifier, [identifier.name, targetType.name]);
+ } else if (identifier.inGetterContext()) {
+ _resolver.reportError(StaticWarningCode.UNDEFINED_GETTER, identifier, [identifier.name, targetType.name]);
+ } else {
+ _resolver.reportError(StaticWarningCode.UNDEFINED_IDENTIFIER, identifier, [identifier.name]);
+ }
} else {
recordResolution(identifier, memberElement);
}
@@ -1311,34 +1930,39 @@
}
Element element = _resolver.nameScope.lookup(node, _resolver.definingLibrary);
if (element is PropertyAccessorElement && node.inSetterContext()) {
- PropertyInducingElement variable4 = ((element as PropertyAccessorElement)).variable;
- if (variable4 != null) {
- PropertyAccessorElement setter3 = variable4.setter;
- if (setter3 != null) {
- element = setter3;
+ PropertyInducingElement variable2 = ((element as PropertyAccessorElement)).variable;
+ if (variable2 != null) {
+ PropertyAccessorElement setter2 = variable2.setter;
+ if (setter2 != null) {
+ element = setter2;
}
}
}
- if (element == null && node.inSetterContext()) {
- element = lookUpSetter(_resolver.enclosingClass, node.name);
- }
- if (element == null && node.inGetterContext()) {
- element = lookUpGetter(_resolver.enclosingClass, node.name);
+ ClassElement enclosingClass2 = _resolver.enclosingClass;
+ if (element == null && enclosingClass2 != null) {
+ InterfaceType enclosingType = enclosingClass2.type;
+ if (element == null && node.inSetterContext()) {
+ element = lookUpSetter(enclosingType, node.name);
+ }
+ if (element == null && node.inGetterContext()) {
+ element = lookUpGetter(enclosingType, node.name);
+ }
+ if (element == null) {
+ element = lookUpMethod(enclosingType, node.name);
+ }
}
if (element == null) {
- element = lookUpMethod(_resolver.enclosingClass, node.name);
- }
- if (element == null) {
+ _resolver.reportError(StaticWarningCode.UNDEFINED_IDENTIFIER, node, [node.name]);
}
recordResolution(node, element);
return null;
}
Object visitSuperConstructorInvocation(SuperConstructorInvocation node) {
- ClassElement enclosingClass3 = _resolver.enclosingClass;
- if (enclosingClass3 == null) {
+ ClassElement enclosingClass2 = _resolver.enclosingClass;
+ if (enclosingClass2 == null) {
return null;
}
- ClassElement superclass = getSuperclass(enclosingClass3);
+ ClassElement superclass = getSuperclass(enclosingClass2);
if (superclass == null) {
return null;
}
@@ -1360,11 +1984,11 @@
return null;
}
Object visitTypeParameter(TypeParameter node) {
- TypeName bound3 = node.bound;
- if (bound3 != null) {
+ TypeName bound2 = node.bound;
+ if (bound2 != null) {
TypeVariableElementImpl variable = node.name.element as TypeVariableElementImpl;
if (variable != null) {
- variable.bound = bound3.type;
+ variable.bound = bound2.type;
}
}
return null;
@@ -1376,11 +2000,11 @@
* @param name the name being searched for
* @return the parameter with the given name
*/
- ParameterElement findNamedParameter(List<ParameterElement> parameters, String name26) {
+ ParameterElement findNamedParameter(List<ParameterElement> parameters, String name2) {
for (ParameterElement parameter in parameters) {
if (identical(parameter.parameterKind, ParameterKind.NAMED)) {
String parameteName = parameter.name;
- if (parameteName != null && parameteName == name26) {
+ if (parameteName != null && parameteName == name2) {
return parameter;
}
}
@@ -1416,74 +2040,65 @@
* @param type the type being tested
* @return {@code true} if the given type represents an object that could be invoked
*/
- bool isExecutableType(Type2 type) => type.isDynamic() || (type is FunctionType) || type.isDartCoreFunction();
+ bool isExecutableType(Type2 type) {
+ if (type.isDynamic() || (type is FunctionType) || type.isDartCoreFunction()) {
+ return true;
+ } else if (type is InterfaceType) {
+ ClassElement classElement = ((type as InterfaceType)).element;
+ MethodElement methodElement = classElement.lookUpMethod("call", _resolver.definingLibrary);
+ return methodElement != null;
+ }
+ return false;
+ }
/**
* Look up the getter with the given name in the given type. Return the element representing the
* getter that was found, or {@code null} if there is no getter with the given name.
- * @param element the element representing the type in which the getter is defined
+ * @param type the type in which the getter is defined
* @param getterName the name of the getter being looked up
* @return the element representing the getter that was found
*/
- PropertyAccessorElement lookUpGetter(Element element, String getterName) {
- if (identical(element, DynamicTypeImpl.instance)) {
- return null;
- }
- element = resolveTypeVariable(element);
- if (element is ClassElement) {
- ClassElement classElement = element as ClassElement;
- PropertyAccessorElement member = classElement.lookUpGetter(getterName, _resolver.definingLibrary);
- if (member != null) {
- return member;
+ PropertyAccessorElement lookUpGetter(Type2 type, String getterName) {
+ type = resolveTypeVariable(type);
+ if (type is InterfaceType) {
+ InterfaceType interfaceType = type as InterfaceType;
+ PropertyAccessorElement accessor = interfaceType.lookUpGetter(getterName, _resolver.definingLibrary);
+ if (accessor != null) {
+ return accessor;
}
- return lookUpGetterInInterfaces((element as ClassElement), getterName, new Set<ClassElement>());
+ return lookUpGetterInInterfaces(interfaceType, getterName, new Set<ClassElement>());
}
return null;
}
/**
- * Look up the name of a getter in the interfaces implemented by the given type, either directly
- * or indirectly. Return the element representing the getter that was found, or {@code null} if
- * there is no getter with the given name.
- * @param element the element representing the type in which the getter is defined
- * @param memberName the name of the getter being looked up
+ * Look up the getter with the given name in the interfaces implemented by the given type, either
+ * directly or indirectly. Return the element representing the getter that was found, or{@code null} if there is no getter with the given name.
+ * @param targetType the type in which the getter might be defined
+ * @param getterName the name of the getter being looked up
* @param visitedInterfaces a set containing all of the interfaces that have been examined, used
* to prevent infinite recursion and to optimize the search
* @return the element representing the getter that was found
*/
- PropertyAccessorElement lookUpGetterInInterfaces(ClassElement targetClass, String memberName, Set<ClassElement> visitedInterfaces) {
+ PropertyAccessorElement lookUpGetterInInterfaces(InterfaceType targetType, String getterName, Set<ClassElement> visitedInterfaces) {
+ ClassElement targetClass = targetType.element;
if (visitedInterfaces.contains(targetClass)) {
return null;
}
javaSetAdd(visitedInterfaces, targetClass);
- PropertyAccessorElement member = lookUpGetterInType(targetClass, memberName);
- if (member != null) {
- return member;
+ PropertyAccessorElement getter = targetType.getGetter(getterName);
+ if (getter != null) {
+ return getter;
}
- for (InterfaceType interfaceType in targetClass.interfaces) {
- member = lookUpGetterInInterfaces(interfaceType.element, memberName, visitedInterfaces);
- if (member != null) {
- return member;
+ for (InterfaceType interfaceType in targetType.interfaces) {
+ getter = lookUpGetterInInterfaces(interfaceType, getterName, visitedInterfaces);
+ if (getter != null) {
+ return getter;
}
}
- ClassElement superclass = getSuperclass(targetClass);
- if (superclass == null) {
+ InterfaceType superclass2 = targetType.superclass;
+ if (superclass2 == null) {
return null;
}
- return lookUpGetterInInterfaces(superclass, memberName, visitedInterfaces);
- }
- /**
- * Look up the name of a getter in the given type. Return the element representing the getter that
- * was found, or {@code null} if there is no getter with the given name.
- * @param element the element representing the type in which the getter is defined
- * @param memberName the name of the getter being looked up
- * @return the element representing the getter that was found
- */
- PropertyAccessorElement lookUpGetterInType(ClassElement element, String memberName) {
- for (PropertyAccessorElement accessor in element.accessors) {
- if (accessor.isGetter() && accessor.name == memberName) {
- return accessor;
- }
- }
- return null;
+ return lookUpGetterInInterfaces(superclass2, getterName, visitedInterfaces);
}
/**
* Find the element corresponding to the given label node in the current label scope.
@@ -1526,138 +2141,102 @@
/**
* Look up the method with the given name in the given type. Return the element representing the
* method that was found, or {@code null} if there is no method with the given name.
- * @param element the element representing the type in which the method is defined
+ * @param type the type in which the method is defined
* @param methodName the name of the method being looked up
* @return the element representing the method that was found
*/
- MethodElement lookUpMethod(Element element, String methodName) {
- if (identical(element, DynamicTypeImpl.instance)) {
- return null;
- }
- element = resolveTypeVariable(element);
- if (element is ClassElement) {
- ClassElement classElement = element as ClassElement;
- MethodElement member = classElement.lookUpMethod(methodName, _resolver.definingLibrary);
- if (member != null) {
- return member;
+ MethodElement lookUpMethod(Type2 type, String methodName) {
+ type = resolveTypeVariable(type);
+ if (type is InterfaceType) {
+ InterfaceType interfaceType = type as InterfaceType;
+ MethodElement method = interfaceType.lookUpMethod(methodName, _resolver.definingLibrary);
+ if (method != null) {
+ return method;
}
- return lookUpMethodInInterfaces((element as ClassElement), methodName, new Set<ClassElement>());
+ return lookUpMethodInInterfaces(interfaceType, methodName, new Set<ClassElement>());
}
return null;
}
/**
- * Look up the name of a member in the interfaces implemented by the given type, either directly
- * or indirectly. Return the element representing the member that was found, or {@code null} if
- * there is no member with the given name.
- * @param element the element representing the type in which the member is defined
- * @param memberName the name of the member being looked up
+ * Look up the method with the given name in the interfaces implemented by the given type, either
+ * directly or indirectly. Return the element representing the meth