Index: pkg/analyzer/lib/src/generated/ast.dart |
diff --git a/pkg/analyzer/lib/src/generated/ast.dart b/pkg/analyzer/lib/src/generated/ast.dart |
index 1f02a022ec439ad6f2ae0f1dacb2e298b5ab7192..9d938ccf98f21827f9946557eca8167a65a26607 100644 |
--- a/pkg/analyzer/lib/src/generated/ast.dart |
+++ b/pkg/analyzer/lib/src/generated/ast.dart |
@@ -64,7 +64,7 @@ abstract class ASTNode { |
while (node != null && !isInstanceOf(node, enclosingClass)) { |
node = node.parent; |
} |
- return node as ASTNode; |
+ return node; |
} |
/** |
@@ -2203,6 +2203,28 @@ class ClassDeclaration extends CompilationUnitMember { |
accept(ASTVisitor visitor) => visitor.visitClassDeclaration(this); |
+ /** |
+ * Return the constructor declared in the class with the given name. |
+ * |
+ * @param name the name of the constructor to find, `null` for default |
+ * @return the found constructor or `null` if not found |
+ */ |
+ ConstructorDeclaration getConstructor(String name) { |
+ for (ClassMember classMember in _members) { |
+ if (classMember is ConstructorDeclaration) { |
+ ConstructorDeclaration constructor = classMember; |
+ SimpleIdentifier constructorName = constructor.name; |
+ if (name == null && constructorName == null) { |
+ return constructor; |
+ } |
+ if (constructorName != null && constructorName.name == name) { |
+ return constructor; |
+ } |
+ } |
+ } |
+ return null; |
+ } |
+ |
ClassElement get element => _name != null ? (_name.staticElement as ClassElement) : null; |
Token get endToken => rightBracket; |
@@ -2224,7 +2246,7 @@ class ClassDeclaration extends CompilationUnitMember { |
VariableDeclaration getField(String name) { |
for (ClassMember classMember in _members) { |
if (classMember is FieldDeclaration) { |
- FieldDeclaration fieldDeclaration = classMember as FieldDeclaration; |
+ FieldDeclaration fieldDeclaration = classMember; |
NodeList<VariableDeclaration> fields = fieldDeclaration.fields.variables; |
for (VariableDeclaration field in fields) { |
SimpleIdentifier fieldName = field.name; |
@@ -2253,6 +2275,25 @@ class ClassDeclaration extends CompilationUnitMember { |
NodeList<ClassMember> get members => _members; |
/** |
+ * Return the method declared in the class with the given name. |
+ * |
+ * @param name the name of the method to find |
+ * @return the found method or `null` if not found |
+ */ |
+ MethodDeclaration getMethod(String name) { |
+ for (ClassMember classMember in _members) { |
+ if (classMember is MethodDeclaration) { |
+ MethodDeclaration method = classMember; |
+ SimpleIdentifier methodName = method.name; |
+ if (methodName != null && name == methodName.name) { |
+ return method; |
+ } |
+ } |
+ } |
+ return null; |
+ } |
+ |
+ /** |
* Return the name of the class being declared. |
* |
* @return the name of the class being declared |
@@ -4204,7 +4245,7 @@ class ExportDirective extends NamespaceDirective { |
LibraryElement get uriElement { |
Element element = this.element; |
if (element is ExportElement) { |
- return (element as ExportElement).exportedLibrary; |
+ return element.exportedLibrary; |
} |
return null; |
} |
@@ -4299,26 +4340,26 @@ abstract class Expression extends ASTNode { |
ParameterElement get propagatedParameterElement { |
ASTNode parent = this.parent; |
if (parent is ArgumentList) { |
- return (parent as ArgumentList).getPropagatedParameterElementFor(this); |
+ return parent.getPropagatedParameterElementFor(this); |
} else if (parent is IndexExpression) { |
- IndexExpression indexExpression = parent as IndexExpression; |
+ IndexExpression indexExpression = parent; |
if (identical(indexExpression.index, this)) { |
return indexExpression.propagatedParameterElementForIndex; |
} |
} else if (parent is BinaryExpression) { |
- BinaryExpression binaryExpression = parent as BinaryExpression; |
+ BinaryExpression binaryExpression = parent; |
if (identical(binaryExpression.rightOperand, this)) { |
return binaryExpression.propagatedParameterElementForRightOperand; |
} |
} else if (parent is AssignmentExpression) { |
- AssignmentExpression assignmentExpression = parent as AssignmentExpression; |
+ AssignmentExpression assignmentExpression = parent; |
if (identical(assignmentExpression.rightHandSide, this)) { |
return assignmentExpression.propagatedParameterElementForRightHandSide; |
} |
} else if (parent is PrefixExpression) { |
- return (parent as PrefixExpression).propagatedParameterElementForOperand; |
+ return parent.propagatedParameterElementForOperand; |
} else if (parent is PostfixExpression) { |
- return (parent as PostfixExpression).propagatedParameterElementForOperand; |
+ return parent.propagatedParameterElementForOperand; |
} |
return null; |
} |
@@ -4336,26 +4377,26 @@ abstract class Expression extends ASTNode { |
ParameterElement get staticParameterElement { |
ASTNode parent = this.parent; |
if (parent is ArgumentList) { |
- return (parent as ArgumentList).getStaticParameterElementFor(this); |
+ return parent.getStaticParameterElementFor(this); |
} else if (parent is IndexExpression) { |
- IndexExpression indexExpression = parent as IndexExpression; |
+ IndexExpression indexExpression = parent; |
if (identical(indexExpression.index, this)) { |
return indexExpression.staticParameterElementForIndex; |
} |
} else if (parent is BinaryExpression) { |
- BinaryExpression binaryExpression = parent as BinaryExpression; |
+ BinaryExpression binaryExpression = parent; |
if (identical(binaryExpression.rightOperand, this)) { |
return binaryExpression.staticParameterElementForRightOperand; |
} |
} else if (parent is AssignmentExpression) { |
- AssignmentExpression assignmentExpression = parent as AssignmentExpression; |
+ AssignmentExpression assignmentExpression = parent; |
if (identical(assignmentExpression.rightHandSide, this)) { |
return assignmentExpression.staticParameterElementForRightHandSide; |
} |
} else if (parent is PrefixExpression) { |
- return (parent as PrefixExpression).staticParameterElementForOperand; |
+ return parent.staticParameterElementForOperand; |
} else if (parent is PostfixExpression) { |
- return (parent as PostfixExpression).staticParameterElementForOperand; |
+ return parent.staticParameterElementForOperand; |
} |
return null; |
} |
@@ -6358,7 +6399,7 @@ class ImportDirective extends NamespaceDirective { |
List<String> allShows1 = new List<String>(); |
for (Combinator combinator in combinators1) { |
if (combinator is HideCombinator) { |
- NodeList<SimpleIdentifier> hides = (combinator as HideCombinator).hiddenNames; |
+ NodeList<SimpleIdentifier> hides = combinator.hiddenNames; |
for (SimpleIdentifier simpleIdentifier in hides) { |
allHides1.add(simpleIdentifier.name); |
} |
@@ -6374,7 +6415,7 @@ class ImportDirective extends NamespaceDirective { |
List<String> allShows2 = new List<String>(); |
for (Combinator combinator in combinators2) { |
if (combinator is HideCombinator) { |
- NodeList<SimpleIdentifier> hides = (combinator as HideCombinator).hiddenNames; |
+ NodeList<SimpleIdentifier> hides = combinator.hiddenNames; |
for (SimpleIdentifier simpleIdentifier in hides) { |
allHides2.add(simpleIdentifier.name); |
} |
@@ -6665,7 +6706,7 @@ class IndexExpression extends Expression { |
bool inGetterContext() { |
ASTNode parent = this.parent; |
if (parent is AssignmentExpression) { |
- AssignmentExpression assignment = parent as AssignmentExpression; |
+ AssignmentExpression assignment = parent; |
if (identical(assignment.leftHandSide, this) && identical(assignment.operator.type, TokenType.EQ)) { |
return false; |
} |
@@ -6686,11 +6727,11 @@ class IndexExpression extends Expression { |
bool inSetterContext() { |
ASTNode parent = this.parent; |
if (parent is PrefixExpression) { |
- return (parent as PrefixExpression).operator.type.isIncrementOperator; |
+ return parent.operator.type.isIncrementOperator; |
} else if (parent is PostfixExpression) { |
return true; |
} else if (parent is AssignmentExpression) { |
- return identical((parent as AssignmentExpression).leftHandSide, this); |
+ return identical(parent.leftHandSide, this); |
} |
return false; |
} |
@@ -8197,7 +8238,7 @@ class NamedExpression extends Expression { |
ParameterElement get element { |
Element element = _name.label.staticElement; |
if (element is ParameterElement) { |
- return element as ParameterElement; |
+ return element; |
} |
return null; |
} |
@@ -8456,7 +8497,7 @@ abstract class NormalFormalParameter extends FormalParameter { |
ParameterKind get kind { |
ASTNode parent = this.parent; |
if (parent is DefaultFormalParameter) { |
- return (parent as DefaultFormalParameter).kind; |
+ return parent.kind; |
} |
return ParameterKind.REQUIRED; |
} |
@@ -9795,30 +9836,30 @@ class SimpleIdentifier extends Identifier { |
bool inDeclarationContext() { |
ASTNode parent = this.parent; |
if (parent is CatchClause) { |
- CatchClause clause = parent as CatchClause; |
+ CatchClause clause = parent; |
return identical(this, clause.exceptionParameter) || identical(this, clause.stackTraceParameter); |
} else if (parent is ClassDeclaration) { |
- return identical(this, (parent as ClassDeclaration).name); |
+ return identical(this, parent.name); |
} else if (parent is ClassTypeAlias) { |
- return identical(this, (parent as ClassTypeAlias).name); |
+ return identical(this, parent.name); |
} else if (parent is ConstructorDeclaration) { |
- return identical(this, (parent as ConstructorDeclaration).name); |
+ return identical(this, parent.name); |
} else if (parent is DeclaredIdentifier) { |
- return identical(this, (parent as DeclaredIdentifier).identifier); |
+ return identical(this, parent.identifier); |
} else if (parent is FunctionDeclaration) { |
- return identical(this, (parent as FunctionDeclaration).name); |
+ return identical(this, parent.name); |
} else if (parent is FunctionTypeAlias) { |
- return identical(this, (parent as FunctionTypeAlias).name); |
+ return identical(this, parent.name); |
} else if (parent is Label) { |
- return identical(this, (parent as Label).label) && (parent.parent is LabeledStatement); |
+ return identical(this, parent.label) && (parent.parent is LabeledStatement); |
} else if (parent is MethodDeclaration) { |
- return identical(this, (parent as MethodDeclaration).name); |
+ return identical(this, parent.name); |
} else if (parent is FunctionTypedFormalParameter || parent is SimpleFormalParameter) { |
return identical(this, (parent as NormalFormalParameter).identifier); |
} else if (parent is TypeParameter) { |
- return identical(this, (parent as TypeParameter).name); |
+ return identical(this, parent.name); |
} else if (parent is VariableDeclaration) { |
- return identical(this, (parent as VariableDeclaration).name); |
+ return identical(this, parent.name); |
} |
return false; |
} |
@@ -9951,23 +9992,23 @@ class SimpleIdentifier extends Identifier { |
return null; |
} |
ASTNode parent = this.parent; |
- if (parent is ClassDeclaration && identical((parent as ClassDeclaration).name, this)) { |
+ if (parent is ClassDeclaration && identical(parent.name, this)) { |
return validateElement(parent, ClassElement, element); |
- } else if (parent is ClassTypeAlias && identical((parent as ClassTypeAlias).name, this)) { |
+ } else if (parent is ClassTypeAlias && identical(parent.name, this)) { |
return validateElement(parent, ClassElement, element); |
- } else if (parent is DeclaredIdentifier && identical((parent as DeclaredIdentifier).identifier, this)) { |
+ } else if (parent is DeclaredIdentifier && identical(parent.identifier, this)) { |
return validateElement(parent, LocalVariableElement, element); |
- } else if (parent is FormalParameter && identical((parent as FormalParameter).identifier, this)) { |
+ } else if (parent is FormalParameter && identical(parent.identifier, this)) { |
return validateElement(parent, ParameterElement, element); |
- } else if (parent is FunctionDeclaration && identical((parent as FunctionDeclaration).name, this)) { |
+ } else if (parent is FunctionDeclaration && identical(parent.name, this)) { |
return validateElement(parent, ExecutableElement, element); |
- } else if (parent is FunctionTypeAlias && identical((parent as FunctionTypeAlias).name, this)) { |
+ } else if (parent is FunctionTypeAlias && identical(parent.name, this)) { |
return validateElement(parent, FunctionTypeAliasElement, element); |
- } else if (parent is MethodDeclaration && identical((parent as MethodDeclaration).name, this)) { |
+ } else if (parent is MethodDeclaration && identical(parent.name, this)) { |
return validateElement(parent, ExecutableElement, element); |
- } else if (parent is TypeParameter && identical((parent as TypeParameter).name, this)) { |
+ } else if (parent is TypeParameter && identical(parent.name, this)) { |
return validateElement(parent, TypeParameterElement, element); |
- } else if (parent is VariableDeclaration && identical((parent as VariableDeclaration).name, this)) { |
+ } else if (parent is VariableDeclaration && identical(parent.name, this)) { |
return validateElement(parent, VariableElement, element); |
} |
return element; |
@@ -11418,7 +11459,7 @@ class VariableDeclaration extends Declaration { |
if (parent != null && parent.parent != null) { |
ASTNode node = parent.parent; |
if (node is AnnotatedNode) { |
- return (node as AnnotatedNode).documentationComment; |
+ return node.documentationComment; |
} |
} |
} |
@@ -11456,7 +11497,7 @@ class VariableDeclaration extends Declaration { |
*/ |
bool get isConst { |
ASTNode parent = this.parent; |
- return parent is VariableDeclarationList && (parent as VariableDeclarationList).isConst; |
+ return parent is VariableDeclarationList && parent.isConst; |
} |
/** |
@@ -11468,7 +11509,7 @@ class VariableDeclaration extends Declaration { |
*/ |
bool get isFinal { |
ASTNode parent = this.parent; |
- return parent is VariableDeclarationList && (parent as VariableDeclarationList).isFinal; |
+ return parent is VariableDeclarationList && parent.isFinal; |
} |
/** |
@@ -11962,119 +12003,119 @@ class ConstantEvaluator extends GeneralizingASTVisitor<Object> { |
while (true) { |
if (node.operator.type == TokenType.AMPERSAND) { |
if (leftOperand is int && rightOperand is int) { |
- return (leftOperand as int) & (rightOperand as int); |
+ return leftOperand & rightOperand; |
} |
} else if (node.operator.type == TokenType.AMPERSAND_AMPERSAND) { |
if (leftOperand is bool && rightOperand is bool) { |
- return (leftOperand as bool) && (rightOperand as bool); |
+ return leftOperand && rightOperand; |
} |
} else if (node.operator.type == TokenType.BANG_EQ) { |
if (leftOperand is bool && rightOperand is bool) { |
- return (leftOperand as bool) != (rightOperand as bool); |
+ return leftOperand != rightOperand; |
} else if (leftOperand is int && rightOperand is int) { |
- return (leftOperand as int) != rightOperand; |
+ return leftOperand != rightOperand; |
} else if (leftOperand is double && rightOperand is double) { |
- return (leftOperand as double) != rightOperand; |
+ return leftOperand != rightOperand; |
} else if (leftOperand is String && rightOperand is String) { |
- return (leftOperand as String) != rightOperand; |
+ return leftOperand != rightOperand; |
} |
} else if (node.operator.type == TokenType.BAR) { |
if (leftOperand is int && rightOperand is int) { |
- return (leftOperand as int) | (rightOperand as int); |
+ return leftOperand | rightOperand; |
} |
} else if (node.operator.type == TokenType.BAR_BAR) { |
if (leftOperand is bool && rightOperand is bool) { |
- return (leftOperand as bool) || (rightOperand as bool); |
+ return leftOperand || rightOperand; |
} |
} else if (node.operator.type == TokenType.CARET) { |
if (leftOperand is int && rightOperand is int) { |
- return (leftOperand as int) ^ (rightOperand as int); |
+ return leftOperand ^ rightOperand; |
} |
} else if (node.operator.type == TokenType.EQ_EQ) { |
if (leftOperand is bool && rightOperand is bool) { |
- return identical(leftOperand as bool, rightOperand as bool); |
+ return identical(leftOperand, rightOperand); |
} else if (leftOperand is int && rightOperand is int) { |
- return (leftOperand as int) == rightOperand; |
+ return leftOperand == rightOperand; |
} else if (leftOperand is double && rightOperand is double) { |
- return (leftOperand as double) == rightOperand; |
+ return leftOperand == rightOperand; |
} else if (leftOperand is String && rightOperand is String) { |
- return (leftOperand as String) == rightOperand; |
+ return leftOperand == rightOperand; |
} |
} else if (node.operator.type == TokenType.GT) { |
if (leftOperand is int && rightOperand is int) { |
- return (leftOperand as int).compareTo(rightOperand as int) > 0; |
+ return leftOperand.compareTo(rightOperand) > 0; |
} else if (leftOperand is double && rightOperand is double) { |
- return (leftOperand as double).compareTo(rightOperand as double) > 0; |
+ return leftOperand.compareTo(rightOperand) > 0; |
} |
} else if (node.operator.type == TokenType.GT_EQ) { |
if (leftOperand is int && rightOperand is int) { |
- return (leftOperand as int).compareTo(rightOperand as int) >= 0; |
+ return leftOperand.compareTo(rightOperand) >= 0; |
} else if (leftOperand is double && rightOperand is double) { |
- return (leftOperand as double).compareTo(rightOperand as double) >= 0; |
+ return leftOperand.compareTo(rightOperand) >= 0; |
} |
} else if (node.operator.type == TokenType.GT_GT) { |
if (leftOperand is int && rightOperand is int) { |
- return (leftOperand as int) >> (rightOperand as int); |
+ return leftOperand >> rightOperand; |
} |
} else if (node.operator.type == TokenType.LT) { |
if (leftOperand is int && rightOperand is int) { |
- return (leftOperand as int).compareTo(rightOperand as int) < 0; |
+ return leftOperand.compareTo(rightOperand) < 0; |
} else if (leftOperand is double && rightOperand is double) { |
- return (leftOperand as double).compareTo(rightOperand as double) < 0; |
+ return leftOperand.compareTo(rightOperand) < 0; |
} |
} else if (node.operator.type == TokenType.LT_EQ) { |
if (leftOperand is int && rightOperand is int) { |
- return (leftOperand as int).compareTo(rightOperand as int) <= 0; |
+ return leftOperand.compareTo(rightOperand) <= 0; |
} else if (leftOperand is double && rightOperand is double) { |
- return (leftOperand as double).compareTo(rightOperand as double) <= 0; |
+ return leftOperand.compareTo(rightOperand) <= 0; |
} |
} else if (node.operator.type == TokenType.LT_LT) { |
if (leftOperand is int && rightOperand is int) { |
- return (leftOperand as int) << (rightOperand as int); |
+ return leftOperand << rightOperand; |
} |
} else if (node.operator.type == TokenType.MINUS) { |
if (leftOperand is int && rightOperand is int) { |
- return (leftOperand as int) - (rightOperand as int); |
+ return leftOperand - rightOperand; |
} else if (leftOperand is double && rightOperand is double) { |
- return (leftOperand as double) - (rightOperand as double); |
+ return leftOperand - rightOperand; |
} |
} else if (node.operator.type == TokenType.PERCENT) { |
if (leftOperand is int && rightOperand is int) { |
- return (leftOperand as int).remainder(rightOperand as int); |
+ return leftOperand.remainder(rightOperand); |
} else if (leftOperand is double && rightOperand is double) { |
- return (leftOperand as double) % (rightOperand as double); |
+ return leftOperand % rightOperand; |
} |
} else if (node.operator.type == TokenType.PLUS) { |
if (leftOperand is int && rightOperand is int) { |
- return (leftOperand as int) + (rightOperand as int); |
+ return leftOperand + rightOperand; |
} else if (leftOperand is double && rightOperand is double) { |
- return (leftOperand as double) + (rightOperand as double); |
+ return leftOperand + rightOperand; |
} |
} else if (node.operator.type == TokenType.STAR) { |
if (leftOperand is int && rightOperand is int) { |
- return (leftOperand as int) * (rightOperand as int); |
+ return leftOperand * rightOperand; |
} else if (leftOperand is double && rightOperand is double) { |
- return (leftOperand as double) * (rightOperand as double); |
+ return leftOperand * rightOperand; |
} |
} else if (node.operator.type == TokenType.SLASH) { |
if (leftOperand is int && rightOperand is int) { |
if (rightOperand != 0) { |
- return (leftOperand as int) ~/ (rightOperand as int); |
+ return leftOperand ~/ rightOperand; |
} else { |
- return (leftOperand as int).toDouble() / (rightOperand as int).toDouble(); |
+ return leftOperand.toDouble() / rightOperand.toDouble(); |
} |
} else if (leftOperand is double && rightOperand is double) { |
- return (leftOperand as double) / (rightOperand as double); |
+ return leftOperand / rightOperand; |
} |
} else if (node.operator.type == TokenType.TILDE_SLASH) { |
if (leftOperand is int && rightOperand is int) { |
if (rightOperand != 0) { |
- return (leftOperand as int) ~/ (rightOperand as int); |
+ return leftOperand ~/ rightOperand; |
} else { |
return 0; |
} |
} else if (leftOperand is double && rightOperand is double) { |
- return (leftOperand as double) ~/ (rightOperand as double); |
+ return leftOperand ~/ rightOperand; |
} |
} |
break; |
@@ -12147,15 +12188,15 @@ class ConstantEvaluator extends GeneralizingASTVisitor<Object> { |
} |
} else if (node.operator.type == TokenType.TILDE) { |
if (operand is int) { |
- return ~(operand as int); |
+ return ~operand; |
} |
} else if (node.operator.type == TokenType.MINUS) { |
if (operand == null) { |
return null; |
} else if (operand is int) { |
- return -(operand as int); |
+ return -operand; |
} else if (operand is double) { |
- return -(operand as double); |
+ return -operand; |
} |
} |
break; |
@@ -12200,7 +12241,7 @@ class ConstantEvaluator extends GeneralizingASTVisitor<Object> { |
*/ |
Object getConstantValue(Element element) { |
if (element is FieldElement) { |
- FieldElement field = element as FieldElement; |
+ FieldElement field = element; |
if (field.isStatic && field.isConst) { |
} |
} |
@@ -12225,6 +12266,29 @@ class ElementLocator { |
ElementLocator_ElementMapper mapper = new ElementLocator_ElementMapper(); |
return node.accept(mapper); |
} |
+ |
+ /** |
+ * Locate the [Element] associated with the given [ASTNode] and offset. |
+ * |
+ * @param node the node (not `null`) |
+ * @param offset the offset relative to source |
+ * @return the associated element, or `null` if none is found |
+ */ |
+ static Element locate2(ASTNode node, int offset) { |
+ { |
+ Element nodeElement = locate(node); |
+ if (nodeElement != null) { |
+ return nodeElement; |
+ } |
+ } |
+ { |
+ Element element = null; |
+ if (element != null) { |
+ return element; |
+ } |
+ } |
+ return null; |
+ } |
} |
/** |
@@ -12246,7 +12310,7 @@ class ElementLocator_ElementMapper extends GeneralizingASTVisitor<Element> { |
Element visitIdentifier(Identifier node) { |
ASTNode parent = node.parent; |
if (parent is ConstructorDeclaration) { |
- ConstructorDeclaration decl = parent as ConstructorDeclaration; |
+ ConstructorDeclaration decl = parent; |
Identifier returnType = decl.returnType; |
if (identical(returnType, node)) { |
SimpleIdentifier name = decl.name; |
@@ -12255,16 +12319,16 @@ class ElementLocator_ElementMapper extends GeneralizingASTVisitor<Element> { |
} |
Element element = node.bestElement; |
if (element is ClassElement) { |
- return (element as ClassElement).unnamedConstructor; |
+ return element.unnamedConstructor; |
} |
} |
} |
if (parent is LibraryIdentifier) { |
- ASTNode grandParent = (parent as LibraryIdentifier).parent; |
+ ASTNode grandParent = parent.parent; |
if (grandParent is PartOfDirective) { |
- Element element = (grandParent as PartOfDirective).element; |
+ Element element = grandParent.element; |
if (element is LibraryElement) { |
- return (element as LibraryElement).definingCompilationUnit; |
+ return element.definingCompilationUnit; |
} |
} |
} |
@@ -12296,7 +12360,7 @@ class ElementLocator_ElementMapper extends GeneralizingASTVisitor<Element> { |
Element visitStringLiteral(StringLiteral node) { |
ASTNode parent = node.parent; |
if (parent is UriBasedDirective) { |
- return (parent as UriBasedDirective).uriElement; |
+ return parent.uriElement; |
} |
return null; |
} |
@@ -15997,7 +16061,7 @@ class IncrementalASTCloner implements ASTVisitor<ASTNode> { |
return null; |
} |
if (identical(node, _oldNode)) { |
- return _newNode as ASTNode; |
+ return _newNode; |
} |
return node.accept(this) as ASTNode; |
} |
@@ -16181,9 +16245,9 @@ class ScopedNameFinder extends GeneralizingASTVisitor<Object> { |
return; |
} |
if (stmt is VariableDeclarationStatement) { |
- addVariables((stmt as VariableDeclarationStatement).variables.variables); |
+ addVariables(stmt.variables.variables); |
} else if (stmt is FunctionDeclarationStatement && !_referenceIsWithinLocalFunction) { |
- addToScope((stmt as FunctionDeclarationStatement).functionDeclaration.name); |
+ addToScope(stmt.functionDeclaration.name); |
} |
} |
} |