mirror of
https://github.com/dart-lang/sdk
synced 2024-09-19 15:31:32 +00:00
Deprecate more AST API and replace uses of it
Change-Id: I6ecf17853915e4b61ee39f25d99451b78d2ba4ac Reviewed-on: https://dart-review.googlesource.com/66401 Reviewed-by: Devon Carew <devoncarew@google.com> Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
parent
6b744ec7ed
commit
54e241d71f
|
@ -156,7 +156,7 @@ class DartUnitHighlightsComputer {
|
|||
}
|
||||
|
||||
bool _addIdentifierRegion_field(SimpleIdentifier node) {
|
||||
Element element = node.bestElement;
|
||||
Element element = node.staticElement;
|
||||
if (element is FieldFormalParameterElement) {
|
||||
element = (element as FieldFormalParameterElement).field;
|
||||
}
|
||||
|
@ -267,7 +267,7 @@ class DartUnitHighlightsComputer {
|
|||
}
|
||||
|
||||
bool _addIdentifierRegion_method(SimpleIdentifier node) {
|
||||
Element element = node.bestElement;
|
||||
Element element = node.staticElement;
|
||||
if (element is! MethodElement) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -168,7 +168,7 @@ class DartUnitHighlightsComputer2 {
|
|||
}
|
||||
|
||||
bool _addIdentifierRegion_field(SimpleIdentifier node) {
|
||||
Element element = node.bestElement;
|
||||
Element element = node.staticElement;
|
||||
if (element is FieldFormalParameterElement) {
|
||||
if (node.parent is FieldFormalParameter) {
|
||||
element = (element as FieldFormalParameterElement).field;
|
||||
|
@ -316,7 +316,7 @@ class DartUnitHighlightsComputer2 {
|
|||
}
|
||||
|
||||
bool _addIdentifierRegion_method(SimpleIdentifier node) {
|
||||
Element element = node.bestElement;
|
||||
Element element = node.staticElement;
|
||||
if (element is! MethodElement) {
|
||||
return false;
|
||||
}
|
||||
|
@ -362,7 +362,7 @@ class DartUnitHighlightsComputer2 {
|
|||
bool _addIdentifierRegion_unresolvedInstanceMemberReference(
|
||||
SimpleIdentifier node) {
|
||||
// unresolved
|
||||
Element element = node.bestElement;
|
||||
Element element = node.staticElement;
|
||||
if (element != null) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ class DartUnitHoverComputer {
|
|||
hover.dartdoc = _computeDocumentation(element);
|
||||
}
|
||||
// parameter
|
||||
hover.parameter = _safeToString(expression.bestParameterElement);
|
||||
hover.parameter = _safeToString(expression.staticParameterElement);
|
||||
// types
|
||||
{
|
||||
AstNode parent = expression.parent;
|
||||
|
|
|
@ -414,7 +414,7 @@ class _FunctionBodyOutlinesVisitor extends RecursiveAstVisitor {
|
|||
visitMethodInvocation(MethodInvocation node) {
|
||||
SimpleIdentifier nameNode = node.methodName;
|
||||
|
||||
engine.Element nameElement = nameNode.bestElement;
|
||||
engine.Element nameElement = nameNode.staticElement;
|
||||
if (nameElement is! engine.ExecutableElement) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -118,14 +118,14 @@ class _DartNavigationComputerVisitor extends RecursiveAstVisitor {
|
|||
@override
|
||||
visitAssignmentExpression(AssignmentExpression node) {
|
||||
node.leftHandSide?.accept(this);
|
||||
computer._addRegionForToken(node.operator, node.bestElement);
|
||||
computer._addRegionForToken(node.operator, node.staticElement);
|
||||
node.rightHandSide?.accept(this);
|
||||
}
|
||||
|
||||
@override
|
||||
visitBinaryExpression(BinaryExpression node) {
|
||||
node.leftOperand?.accept(this);
|
||||
computer._addRegionForToken(node.operator, node.bestElement);
|
||||
computer._addRegionForToken(node.operator, node.staticElement);
|
||||
node.rightOperand?.accept(this);
|
||||
}
|
||||
|
||||
|
@ -178,7 +178,7 @@ class _DartNavigationComputerVisitor extends RecursiveAstVisitor {
|
|||
if (node.type == null) {
|
||||
Token token = node.keyword;
|
||||
if (token?.keyword == Keyword.VAR) {
|
||||
DartType inferredType = node.identifier?.bestType;
|
||||
DartType inferredType = node.identifier?.staticType;
|
||||
Element element = inferredType?.element;
|
||||
if (element != null) {
|
||||
computer._addRegionForToken(token, element);
|
||||
|
@ -211,7 +211,7 @@ class _DartNavigationComputerVisitor extends RecursiveAstVisitor {
|
|||
@override
|
||||
visitIndexExpression(IndexExpression node) {
|
||||
super.visitIndexExpression(node);
|
||||
MethodElement element = node.bestElement;
|
||||
MethodElement element = node.staticElement;
|
||||
computer._addRegionForToken(node.leftBracket, element);
|
||||
computer._addRegionForToken(node.rightBracket, element);
|
||||
}
|
||||
|
@ -236,12 +236,12 @@ class _DartNavigationComputerVisitor extends RecursiveAstVisitor {
|
|||
@override
|
||||
visitPostfixExpression(PostfixExpression node) {
|
||||
super.visitPostfixExpression(node);
|
||||
computer._addRegionForToken(node.operator, node.bestElement);
|
||||
computer._addRegionForToken(node.operator, node.staticElement);
|
||||
}
|
||||
|
||||
@override
|
||||
visitPrefixExpression(PrefixExpression node) {
|
||||
computer._addRegionForToken(node.operator, node.bestElement);
|
||||
computer._addRegionForToken(node.operator, node.staticElement);
|
||||
super.visitPrefixExpression(node);
|
||||
}
|
||||
|
||||
|
@ -263,7 +263,7 @@ class _DartNavigationComputerVisitor extends RecursiveAstVisitor {
|
|||
if (node.parent is ConstructorDeclaration) {
|
||||
return;
|
||||
}
|
||||
Element element = node.bestElement;
|
||||
Element element = node.staticElement;
|
||||
computer._addRegionForNode(node, element);
|
||||
}
|
||||
|
||||
|
@ -288,12 +288,12 @@ class _DartNavigationComputerVisitor extends RecursiveAstVisitor {
|
|||
* inferred type.
|
||||
*/
|
||||
Element getCommonElement(List<VariableDeclaration> variables) {
|
||||
Element firstElement = variables[0].name?.bestType?.element;
|
||||
Element firstElement = variables[0].name?.staticType?.element;
|
||||
if (firstElement == null) {
|
||||
return null;
|
||||
}
|
||||
for (int i = 1; i < variables.length; i++) {
|
||||
Element element = variables[1].name?.bestType?.element;
|
||||
Element element = variables[1].name?.staticType?.element;
|
||||
if (element != firstElement) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ class _DartUnitOccurrencesComputerVisitor extends RecursiveAstVisitor {
|
|||
|
||||
@override
|
||||
visitSimpleIdentifier(SimpleIdentifier node) {
|
||||
Element element = node.bestElement;
|
||||
Element element = node.staticElement;
|
||||
if (element != null) {
|
||||
_addOccurrence(element, node.offset);
|
||||
}
|
||||
|
|
|
@ -190,7 +190,7 @@ class ArgListContributor extends DartCompletionContributor {
|
|||
if (targetId == null) {
|
||||
return EMPTY_LIST;
|
||||
}
|
||||
Element elem = targetId.bestElement;
|
||||
Element elem = targetId.staticElement;
|
||||
if (elem == null) {
|
||||
return EMPTY_LIST;
|
||||
}
|
||||
|
|
|
@ -137,9 +137,9 @@ class _BestTypeVisitor extends UnifyingAstVisitor<DartType> {
|
|||
|
||||
@override
|
||||
DartType visitPrefixedIdentifier(PrefixedIdentifier node) =>
|
||||
node.identifier == entity ? node.prefix?.bestType : null;
|
||||
node.identifier == entity ? node.prefix?.staticType : null;
|
||||
|
||||
@override
|
||||
DartType visitPropertyAccess(PropertyAccess node) =>
|
||||
node.propertyName == entity ? node.realTarget?.bestType : null;
|
||||
node.propertyName == entity ? node.realTarget?.staticType : null;
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ class FieldFormalContributor extends DartCompletionContributor {
|
|||
if (fieldName != null && fieldName.length > 0) {
|
||||
if (!referencedFields.contains(fieldName)) {
|
||||
CompletionSuggestion suggestion = createSuggestion(
|
||||
fieldId.bestElement,
|
||||
fieldId.staticElement,
|
||||
relevance: DART_RELEVANCE_LOCAL_FIELD);
|
||||
if (suggestion != null) {
|
||||
suggestions.add(suggestion);
|
||||
|
|
|
@ -25,7 +25,7 @@ class LibraryMemberContributor extends DartCompletionContributor {
|
|||
// Determine if the target looks like a library prefix
|
||||
Expression targetId = request.dotTarget;
|
||||
if (targetId is SimpleIdentifier && !request.target.isCascade) {
|
||||
Element elem = targetId.bestElement;
|
||||
Element elem = targetId.staticElement;
|
||||
if (elem is PrefixElement && !elem.isSynthetic) {
|
||||
LibraryElement containingLibrary = request.libraryElement;
|
||||
// Gracefully degrade if the library or directives
|
||||
|
|
|
@ -24,7 +24,7 @@ class StaticMemberContributor extends DartCompletionContributor {
|
|||
await null;
|
||||
Expression targetId = request.dotTarget;
|
||||
if (targetId is Identifier && !request.target.isCascade) {
|
||||
Element elem = targetId.bestElement;
|
||||
Element elem = targetId.staticElement;
|
||||
if (elem is ClassElement) {
|
||||
LibraryElement containingLibrary = request.libraryElement;
|
||||
// Gracefully degrade if the library could not be determined
|
||||
|
|
|
@ -37,7 +37,7 @@ class TypeMemberContributor extends DartCompletionContributor {
|
|||
return EMPTY_LIST;
|
||||
}
|
||||
if (expression is Identifier) {
|
||||
Element elem = expression.bestElement;
|
||||
Element elem = expression.staticElement;
|
||||
if (elem is ClassElement) {
|
||||
// Suggestions provided by StaticMemberContributor
|
||||
return EMPTY_LIST;
|
||||
|
@ -49,12 +49,12 @@ class TypeMemberContributor extends DartCompletionContributor {
|
|||
}
|
||||
|
||||
// Determine the target expression's type
|
||||
DartType type = expression.bestType;
|
||||
if (type.isDynamic) {
|
||||
DartType type = expression.staticType;
|
||||
if (type == null || type.isDynamic) {
|
||||
// If the expression does not provide a good type
|
||||
// then attempt to get a better type from the element
|
||||
if (expression is Identifier) {
|
||||
Element elem = expression.bestElement;
|
||||
Element elem = expression.staticElement;
|
||||
if (elem is FunctionTypedElement) {
|
||||
type = elem.returnType;
|
||||
} else if (elem is ParameterElement) {
|
||||
|
@ -89,7 +89,7 @@ class TypeMemberContributor extends DartCompletionContributor {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (type.isDynamic) {
|
||||
if (type == null || type.isDynamic) {
|
||||
// Suggest members from object if target is "dynamic"
|
||||
type = request.objectType;
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ class _LocalBestTypeVisitor extends LocalDeclarationVisitor {
|
|||
@override
|
||||
void declaredLocalVar(SimpleIdentifier name, TypeAnnotation type) {
|
||||
if (name.name == targetName) {
|
||||
typeFound = name.bestType;
|
||||
typeFound = name.staticType;
|
||||
finished();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -223,7 +223,7 @@ String nameForType(SimpleIdentifier identifier, TypeAnnotation declaredType) {
|
|||
}
|
||||
type = element.returnType;
|
||||
} else if (element is VariableElement) {
|
||||
type = identifier.bestType;
|
||||
type = identifier.staticType;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -107,8 +107,7 @@ class DartPostfixCompletion {
|
|||
await null;
|
||||
return processor.expand(kind, processor.findIntExpression, (expr) {
|
||||
String index = processor.newVariable("i");
|
||||
return "for (int $index = 0; $index < ${processor.utils.getNodeText(
|
||||
expr)}; $index++)";
|
||||
return "for (int $index = 0; $index < ${processor.utils.getNodeText(expr)}; $index++)";
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -454,7 +453,7 @@ class PostfixCompletionProcessor {
|
|||
if (boolExpr.parent is ExpressionFunctionBody &&
|
||||
boolExpr.parent.parent is FunctionExpression) {
|
||||
FunctionExpression fnExpr = boolExpr.parent.parent;
|
||||
var type = fnExpr.bestType;
|
||||
var type = fnExpr.staticType;
|
||||
if (type is! FunctionType) {
|
||||
return boolExpr;
|
||||
}
|
||||
|
@ -463,7 +462,7 @@ class PostfixCompletionProcessor {
|
|||
return fnExpr;
|
||||
}
|
||||
}
|
||||
if (boolExpr.bestType == typeProvider.boolType) {
|
||||
if (boolExpr.staticType == typeProvider.boolType) {
|
||||
return boolExpr;
|
||||
}
|
||||
}
|
||||
|
@ -530,7 +529,7 @@ class PostfixCompletionProcessor {
|
|||
}
|
||||
if (astNode is ThrowExpression) {
|
||||
ThrowExpression expr = astNode;
|
||||
var type = expr.expression.bestType;
|
||||
var type = expr.expression.staticType;
|
||||
return type.displayName;
|
||||
}
|
||||
return 'Exception';
|
||||
|
@ -563,7 +562,7 @@ class PostfixCompletionProcessor {
|
|||
parent = parent.parent;
|
||||
}
|
||||
Expression expr = list.firstWhere((expr) {
|
||||
DartType type = expr.bestType;
|
||||
DartType type = expr.staticType;
|
||||
if (type.isSubtypeOf(builtInType)) return true;
|
||||
Element element = type.element;
|
||||
if (element is TypeDefiningElement) {
|
||||
|
|
|
@ -243,7 +243,7 @@ class AssistProcessor {
|
|||
_coverageMarker();
|
||||
return;
|
||||
}
|
||||
DartType type = declaredIdentifier.identifier.bestType;
|
||||
DartType type = declaredIdentifier.identifier.staticType;
|
||||
if (type is! InterfaceType && type is! FunctionType) {
|
||||
_coverageMarker();
|
||||
return;
|
||||
|
@ -347,7 +347,7 @@ class AssistProcessor {
|
|||
_coverageMarker();
|
||||
return;
|
||||
}
|
||||
DartType type = initializer.bestType;
|
||||
DartType type = initializer.staticType;
|
||||
// prepare type source
|
||||
if ((type is! InterfaceType || type.isDartCoreNull) &&
|
||||
type is! FunctionType) {
|
||||
|
@ -402,7 +402,7 @@ class AssistProcessor {
|
|||
Expression expression = expressionStatement.expression;
|
||||
int offset = expression.offset;
|
||||
// prepare expression type
|
||||
DartType type = expression.bestType;
|
||||
DartType type = expression.staticType;
|
||||
if (type.isVoid) {
|
||||
_coverageMarker();
|
||||
return;
|
||||
|
@ -931,7 +931,7 @@ class AssistProcessor {
|
|||
}
|
||||
// iterable should be List
|
||||
{
|
||||
DartType iterableType = iterable.bestType;
|
||||
DartType iterableType = iterable.staticType;
|
||||
InterfaceType listType = typeProvider.listType;
|
||||
if (iterableType is! InterfaceType ||
|
||||
iterableType.element != listType.element) {
|
||||
|
@ -1132,7 +1132,7 @@ class AssistProcessor {
|
|||
return;
|
||||
}
|
||||
// should be "isEmpty"
|
||||
Element propertyElement = isEmptyIdentifier.bestElement;
|
||||
Element propertyElement = isEmptyIdentifier.staticElement;
|
||||
if (propertyElement == null || 'isEmpty' != propertyElement.name) {
|
||||
_coverageMarker();
|
||||
return;
|
||||
|
|
|
@ -850,7 +850,7 @@ class FixProcessor {
|
|||
if (node is SimpleIdentifier) {
|
||||
AstNode invocation = node.parent;
|
||||
if (invocation is MethodInvocation) {
|
||||
targetElement = invocation.methodName.bestElement;
|
||||
targetElement = invocation.methodName.staticElement;
|
||||
argumentList = invocation.argumentList;
|
||||
} else {
|
||||
creation =
|
||||
|
@ -1004,7 +1004,7 @@ class FixProcessor {
|
|||
TypeAnnotation typeNode = variableList.type;
|
||||
if (typeNode != null) {
|
||||
Expression initializer = coveredNode;
|
||||
DartType newType = initializer.bestType;
|
||||
DartType newType = initializer.staticType;
|
||||
if (newType is InterfaceType || newType is FunctionType) {
|
||||
DartChangeBuilder changeBuilder = new DartChangeBuilder(session);
|
||||
await changeBuilder.addFileEdit(file,
|
||||
|
@ -1598,7 +1598,7 @@ class FixProcessor {
|
|||
ClassElement targetClassElement;
|
||||
if (target != null) {
|
||||
// prepare target interface type
|
||||
DartType targetType = target.bestType;
|
||||
DartType targetType = target.staticType;
|
||||
if (targetType is! InterfaceType) {
|
||||
return;
|
||||
}
|
||||
|
@ -1606,7 +1606,7 @@ class FixProcessor {
|
|||
// maybe static
|
||||
if (target is Identifier) {
|
||||
Identifier targetIdentifier = target;
|
||||
Element targetElement = targetIdentifier.bestElement;
|
||||
Element targetElement = targetIdentifier.staticElement;
|
||||
if (targetElement == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -1699,7 +1699,7 @@ class FixProcessor {
|
|||
{
|
||||
Expression target = getQualifiedPropertyTarget(node);
|
||||
if (target != null) {
|
||||
DartType targetType = target.bestType;
|
||||
DartType targetType = target.staticType;
|
||||
if (targetType != null && targetType.element is ClassElement) {
|
||||
targetElement = targetType.element as ClassElement;
|
||||
argument = target.parent as Expression;
|
||||
|
@ -1715,7 +1715,7 @@ class FixProcessor {
|
|||
}
|
||||
argument = stepUpNamedExpression(argument);
|
||||
// should be argument of some invocation
|
||||
ParameterElement parameterElement = argument.bestParameterElement;
|
||||
ParameterElement parameterElement = argument.staticParameterElement;
|
||||
if (parameterElement == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -1764,7 +1764,7 @@ class FixProcessor {
|
|||
ClassElement targetClassElement;
|
||||
if (target != null) {
|
||||
// prepare target interface type
|
||||
DartType targetType = target.bestType;
|
||||
DartType targetType = target.staticType;
|
||||
if (targetType is! InterfaceType) {
|
||||
return;
|
||||
}
|
||||
|
@ -1772,7 +1772,7 @@ class FixProcessor {
|
|||
// maybe static
|
||||
if (target is Identifier) {
|
||||
Identifier targetIdentifier = target;
|
||||
Element targetElement = targetIdentifier.bestElement;
|
||||
Element targetElement = targetIdentifier.staticElement;
|
||||
staticModifier = targetElement.kind == ElementKind.CLASS;
|
||||
}
|
||||
} else {
|
||||
|
@ -2364,8 +2364,8 @@ class FixProcessor {
|
|||
await null;
|
||||
AstNode node = this.node;
|
||||
if (node is SimpleIdentifier &&
|
||||
node.bestElement is PropertyAccessorElement) {
|
||||
PropertyAccessorElement getter = node.bestElement;
|
||||
node.staticElement is PropertyAccessorElement) {
|
||||
PropertyAccessorElement getter = node.staticElement;
|
||||
if (getter.isGetter &&
|
||||
getter.isSynthetic &&
|
||||
!getter.variable.isSynthetic &&
|
||||
|
@ -3041,7 +3041,7 @@ class FixProcessor {
|
|||
_updateFinderWithClassMembers(finder, classElement);
|
||||
}
|
||||
} else {
|
||||
DartType type = target.bestType;
|
||||
DartType type = target.staticType;
|
||||
if (type is InterfaceType) {
|
||||
ClassElement classElement = type.element;
|
||||
_updateFinderWithClassMembers(finder, classElement);
|
||||
|
@ -3178,7 +3178,7 @@ class FixProcessor {
|
|||
staticModifier = _inStaticContext();
|
||||
} else {
|
||||
// prepare target interface type
|
||||
DartType targetType = target.bestType;
|
||||
DartType targetType = target.staticType;
|
||||
if (targetType is! InterfaceType) {
|
||||
return;
|
||||
}
|
||||
|
@ -3389,7 +3389,7 @@ class FixProcessor {
|
|||
MethodInvocation invocation = node.parent as MethodInvocation;
|
||||
if (invocation.methodName == node) {
|
||||
Expression target = invocation.target;
|
||||
Element invokedElement = invocation.methodName.bestElement;
|
||||
Element invokedElement = invocation.methodName.staticElement;
|
||||
await _addFix_useStaticAccess(target, invokedElement);
|
||||
}
|
||||
}
|
||||
|
@ -3402,7 +3402,7 @@ class FixProcessor {
|
|||
PrefixedIdentifier prefixed = node.parent as PrefixedIdentifier;
|
||||
if (prefixed.identifier == node) {
|
||||
Expression target = prefixed.prefix;
|
||||
Element invokedElement = prefixed.identifier.bestElement;
|
||||
Element invokedElement = prefixed.identifier.staticElement;
|
||||
await _addFix_useStaticAccess(target, invokedElement);
|
||||
}
|
||||
}
|
||||
|
@ -3687,7 +3687,7 @@ class FixProcessor {
|
|||
if (assignment.leftHandSide == expression) {
|
||||
Expression rhs = assignment.rightHandSide;
|
||||
if (rhs != null) {
|
||||
return rhs.bestType;
|
||||
return rhs.staticType;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3699,11 +3699,11 @@ class FixProcessor {
|
|||
// v = myFunction();
|
||||
Expression lhs = assignment.leftHandSide;
|
||||
if (lhs != null) {
|
||||
return lhs.bestType;
|
||||
return lhs.staticType;
|
||||
}
|
||||
} else {
|
||||
// v += myFunction();
|
||||
MethodElement method = assignment.bestElement;
|
||||
MethodElement method = assignment.staticElement;
|
||||
if (method != null) {
|
||||
List<ParameterElement> parameters = method.parameters;
|
||||
if (parameters.length == 1) {
|
||||
|
@ -3716,7 +3716,7 @@ class FixProcessor {
|
|||
// v + myFunction();
|
||||
if (parent is BinaryExpression) {
|
||||
BinaryExpression binary = parent;
|
||||
MethodElement method = binary.bestElement;
|
||||
MethodElement method = binary.staticElement;
|
||||
if (method != null) {
|
||||
if (binary.rightOperand == expression) {
|
||||
List<ParameterElement> parameters = method.parameters;
|
||||
|
@ -3726,7 +3726,7 @@ class FixProcessor {
|
|||
}
|
||||
// foo( myFunction() );
|
||||
if (parent is ArgumentList) {
|
||||
ParameterElement parameter = expression.bestParameterElement;
|
||||
ParameterElement parameter = expression.staticParameterElement;
|
||||
return parameter?.type;
|
||||
}
|
||||
// bool
|
||||
|
|
|
@ -1339,7 +1339,7 @@ class CorrectionUtils {
|
|||
} else if (expression is ParenthesizedExpression) {
|
||||
return _invertCondition0(expression.unParenthesized);
|
||||
}
|
||||
DartType type = expression.bestType;
|
||||
DartType type = expression.staticType;
|
||||
if (type.displayName == "bool") {
|
||||
return _InvertedCondition._simple("!${getNodeText(expression)}");
|
||||
}
|
||||
|
|
|
@ -165,7 +165,7 @@ class KytheDartVisitor extends GeneralizingAstVisitor with OutputUtils {
|
|||
// we are looking for an operator such as +=, -=, *=, /=
|
||||
//
|
||||
Token operator = node.operator;
|
||||
MethodElement element = node.bestElement;
|
||||
MethodElement element = node.staticElement;
|
||||
if (operator.type != TokenType.EQ && element != null) {
|
||||
// method
|
||||
_vNameFromElement(element, schema.FUNCTION_KIND);
|
||||
|
@ -186,7 +186,7 @@ class KytheDartVisitor extends GeneralizingAstVisitor with OutputUtils {
|
|||
//
|
||||
// operators such as +, -, *, /
|
||||
//
|
||||
MethodElement element = node.bestElement;
|
||||
MethodElement element = node.staticElement;
|
||||
if (element != null) {
|
||||
// method
|
||||
_vNameFromElement(element, schema.FUNCTION_KIND);
|
||||
|
@ -296,7 +296,7 @@ class KytheDartVisitor extends GeneralizingAstVisitor with OutputUtils {
|
|||
// ClassDeclarations) and super.visitClassTypeAlias is not sufficient.
|
||||
//
|
||||
_handleRefEdge(
|
||||
node.superclass.name.bestElement,
|
||||
node.superclass.name.staticElement,
|
||||
const <String>[schema.REF_EDGE],
|
||||
syntacticEntity: node.superclass,
|
||||
);
|
||||
|
@ -304,7 +304,7 @@ class KytheDartVisitor extends GeneralizingAstVisitor with OutputUtils {
|
|||
// by visitClassDeclaration()
|
||||
// extends
|
||||
var recordSupertypeVName = _vNameFromElement(
|
||||
node.superclass.name.bestElement, schema.RECORD_KIND);
|
||||
node.superclass.name.staticElement, schema.RECORD_KIND);
|
||||
addEdge(_enclosingClassVName, schema.EXTENDS_EDGE, recordSupertypeVName);
|
||||
|
||||
// implements
|
||||
|
@ -562,7 +562,7 @@ class KytheDartVisitor extends GeneralizingAstVisitor with OutputUtils {
|
|||
var returnType = node.returnType;
|
||||
if (returnType is TypeName) {
|
||||
_handleRefEdge(
|
||||
returnType.name?.bestElement,
|
||||
returnType.name?.staticElement,
|
||||
const <String>[schema.REF_EDGE],
|
||||
syntacticEntity: returnType.name,
|
||||
);
|
||||
|
@ -619,7 +619,7 @@ class KytheDartVisitor extends GeneralizingAstVisitor with OutputUtils {
|
|||
//
|
||||
// index method ref/call
|
||||
//
|
||||
var element = node.bestElement;
|
||||
var element = node.staticElement;
|
||||
var start = node.leftBracket.offset;
|
||||
var end = node.rightBracket.end;
|
||||
|
||||
|
@ -722,7 +722,7 @@ class KytheDartVisitor extends GeneralizingAstVisitor with OutputUtils {
|
|||
|
||||
@override
|
||||
visitMethodInvocation(MethodInvocation node) {
|
||||
var element = node.methodName?.bestElement;
|
||||
var element = node.methodName?.staticElement;
|
||||
|
||||
// anchor- ref/call
|
||||
_handleRefCallEdge(element, syntacticEntity: node.methodName);
|
||||
|
@ -806,7 +806,7 @@ class KytheDartVisitor extends GeneralizingAstVisitor with OutputUtils {
|
|||
if (node.getAncestor((node) => node is CommentReference) != null) {
|
||||
// The identifier is in a comment, add just the "ref" edge.
|
||||
_handleRefEdge(
|
||||
node.bestElement,
|
||||
node.staticElement,
|
||||
const <String>[schema.REF_EDGE],
|
||||
syntacticEntity: node,
|
||||
);
|
||||
|
@ -814,12 +814,12 @@ class KytheDartVisitor extends GeneralizingAstVisitor with OutputUtils {
|
|||
// The node is in a declaration context, and should have
|
||||
// "ref/defines/binding" edge as well as the default "ref" edge.
|
||||
_handleRefEdge(
|
||||
node.bestElement,
|
||||
node.staticElement,
|
||||
const <String>[schema.DEFINES_BINDING_EDGE, schema.REF_EDGE],
|
||||
syntacticEntity: node,
|
||||
);
|
||||
} else {
|
||||
_handleRefCallEdge(node.bestElement, syntacticEntity: node);
|
||||
_handleRefCallEdge(node.staticElement, syntacticEntity: node);
|
||||
}
|
||||
|
||||
// no children to visit
|
||||
|
@ -1243,7 +1243,7 @@ abstract class OutputUtils {
|
|||
returnTypeVName = voidBuiltin;
|
||||
} else {
|
||||
returnTypeVName =
|
||||
_vNameFromElement(returnNode.name.bestElement, schema.TAPP_KIND);
|
||||
_vNameFromElement(returnNode.name.staticElement, schema.TAPP_KIND);
|
||||
}
|
||||
} else if (returnNode is Identifier) {
|
||||
// ConstructorDeclaration returns an Identifier from returnType
|
||||
|
@ -1251,7 +1251,7 @@ abstract class OutputUtils {
|
|||
returnTypeVName = voidBuiltin;
|
||||
} else {
|
||||
returnTypeVName =
|
||||
_vNameFromElement(returnNode.bestElement, schema.TAPP_KIND);
|
||||
_vNameFromElement(returnNode.staticElement, schema.TAPP_KIND);
|
||||
}
|
||||
}
|
||||
// else: return type is null, void, unresolved.
|
||||
|
|
|
@ -269,7 +269,7 @@ class ExtractLocalRefactoringImpl extends RefactoringImpl
|
|||
// stop at void method invocations
|
||||
if (node is MethodInvocation) {
|
||||
MethodInvocation invocation = node;
|
||||
Element element = invocation.methodName.bestElement;
|
||||
Element element = invocation.methodName.staticElement;
|
||||
if (element is ExecutableElement &&
|
||||
element.returnType != null &&
|
||||
element.returnType.isVoid) {
|
||||
|
@ -289,7 +289,7 @@ class ExtractLocalRefactoringImpl extends RefactoringImpl
|
|||
'Cannot extract the name part of a declaration.',
|
||||
newLocation_fromNode(node));
|
||||
}
|
||||
Element element = node.bestElement;
|
||||
Element element = node.staticElement;
|
||||
if (element is FunctionElement || element is MethodElement) {
|
||||
continue;
|
||||
}
|
||||
|
@ -557,7 +557,7 @@ class _ExtractExpressionAnalyzer extends SelectionAnalyzer {
|
|||
invalidSelection('Cannot extract the name part of a declaration.');
|
||||
}
|
||||
// method name
|
||||
Element element = node.bestElement;
|
||||
Element element = node.staticElement;
|
||||
if (element is FunctionElement || element is MethodElement) {
|
||||
invalidSelection('Cannot extract a single method name.');
|
||||
}
|
||||
|
|
|
@ -622,7 +622,7 @@ class ExtractMethodRefactoringImpl extends RefactoringImpl
|
|||
if (argument.parent is NamedExpression) {
|
||||
argument = argument.parent as NamedExpression;
|
||||
}
|
||||
ParameterElement parameter = argument.bestParameterElement;
|
||||
ParameterElement parameter = argument.staticParameterElement;
|
||||
if (parameter != null) {
|
||||
DartType parameterType = parameter.type;
|
||||
if (parameterType is FunctionType) {
|
||||
|
@ -733,7 +733,7 @@ class ExtractMethodRefactoringImpl extends RefactoringImpl
|
|||
unit.accept(new _InitializeParametersVisitor(this, assignedUsedVariables));
|
||||
// single expression
|
||||
if (_selectionExpression != null) {
|
||||
_returnType = _selectionExpression.bestType;
|
||||
_returnType = _selectionExpression.staticType;
|
||||
}
|
||||
// verify that none or all execution flows end with a "return"
|
||||
if (_selectionStatements != null) {
|
||||
|
@ -999,7 +999,7 @@ class _ExtractMethodAnalyzer extends StatementAnalyzer {
|
|||
invalidSelection('Cannot extract the name part of a declaration.');
|
||||
}
|
||||
// method name
|
||||
Element element = node.bestElement;
|
||||
Element element = node.staticElement;
|
||||
if (element is FunctionElement || element is MethodElement) {
|
||||
invalidSelection('Cannot extract a single method name.');
|
||||
}
|
||||
|
@ -1251,7 +1251,7 @@ class _InitializeParametersVisitor extends GeneralizingAstVisitor {
|
|||
// add parameter
|
||||
RefactoringMethodParameter parameter = ref._parametersMap[name];
|
||||
if (parameter == null) {
|
||||
DartType parameterType = node.bestType;
|
||||
DartType parameterType = node.staticType;
|
||||
StringBuffer parametersBuffer = new StringBuffer();
|
||||
String parameterTypeCode = ref.utils.getTypeSource(
|
||||
parameterType, ref.librariesToImport,
|
||||
|
@ -1340,7 +1340,7 @@ class _ReturnTypeComputer extends RecursiveAstVisitor {
|
|||
return;
|
||||
}
|
||||
// prepare type
|
||||
DartType type = expression.bestType;
|
||||
DartType type = expression.staticType;
|
||||
if (type.isBottom) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ String _getMethodSourceForInvocation(
|
|||
// prepare argument
|
||||
Expression argument = null;
|
||||
for (Expression arg in arguments) {
|
||||
if (arg.bestParameterElement == parameter) {
|
||||
if (arg.staticParameterElement == parameter) {
|
||||
argument = arg;
|
||||
break;
|
||||
}
|
||||
|
@ -361,7 +361,7 @@ class InlineMethodRefactoringImpl extends RefactoringImpl
|
|||
}
|
||||
SimpleIdentifier identifier = node as SimpleIdentifier;
|
||||
// prepare selected ExecutableElement
|
||||
Element element = identifier.bestElement;
|
||||
Element element = identifier.staticElement;
|
||||
if (element is! ExecutableElement) {
|
||||
return fatalStatus;
|
||||
}
|
||||
|
|
|
@ -116,7 +116,7 @@ class _ConflictValidatorVisitor extends RecursiveAstVisitor {
|
|||
|
||||
@override
|
||||
visitSimpleIdentifier(SimpleIdentifier node) {
|
||||
Element nodeElement = node.bestElement;
|
||||
Element nodeElement = node.staticElement;
|
||||
if (nodeElement != null && nodeElement.name == newName) {
|
||||
// Duplicate declaration.
|
||||
if (node.inDeclarationContext() && _isVisibleWithTarget(nodeElement)) {
|
||||
|
|
|
@ -43,7 +43,7 @@ class RenameRefactoringTest extends RefactoringTest {
|
|||
*/
|
||||
void createRenameRefactoringAtString(String search) {
|
||||
SimpleIdentifier identifier = findIdentifier(search);
|
||||
Element element = identifier.bestElement;
|
||||
Element element = identifier.staticElement;
|
||||
if (element is PrefixElement) {
|
||||
element = getImportElement(identifier);
|
||||
}
|
||||
|
|
|
@ -2569,7 +2569,11 @@ abstract class Expression extends AstNode {
|
|||
* expression. If type propagation was able to find a better parameter element
|
||||
* than static analysis, that type will be returned. Otherwise, the result of
|
||||
* static analysis will be returned.
|
||||
*
|
||||
* Deprecated: The analyzer no longer computes propagated type information.
|
||||
* Use [staticParameterElement] instead.
|
||||
*/
|
||||
@deprecated
|
||||
ParameterElement get bestParameterElement;
|
||||
|
||||
/**
|
||||
|
@ -2578,7 +2582,12 @@ abstract class Expression extends AstNode {
|
|||
* will be returned. Otherwise, the result of static analysis will be
|
||||
* returned. If no type analysis has been performed, then the type 'dynamic'
|
||||
* will be returned.
|
||||
*
|
||||
* Deprecated: The analyzer no longer computes propagated type information.
|
||||
* Use [staticType] instead, but be aware that [staticType] will return `null`
|
||||
* under some circumstances, while [bestType] did not.
|
||||
*/
|
||||
@deprecated
|
||||
DartType get bestType;
|
||||
|
||||
/**
|
||||
|
@ -3531,7 +3540,11 @@ abstract class FunctionExpressionInvocation extends InvocationExpression {
|
|||
* that element will be returned. Otherwise, the element found using the
|
||||
* result of static analysis will be returned. If resolution has not been
|
||||
* performed, then `null` will be returned.
|
||||
*
|
||||
* Deprecated: The analyzer no longer computes propagated type information.
|
||||
* Use [staticElement] instead.
|
||||
*/
|
||||
@deprecated
|
||||
ExecutableElement get bestElement;
|
||||
|
||||
/**
|
||||
|
@ -3845,7 +3858,11 @@ abstract class Identifier extends Expression {
|
|||
* returned. Otherwise, the element found using the result of static analysis
|
||||
* will be returned. If resolution has not been performed, then `null` will be
|
||||
* returned.
|
||||
*
|
||||
* Deprecated: The analyzer no longer computes propagated type information.
|
||||
* Use [staticElement] instead.
|
||||
*/
|
||||
@deprecated
|
||||
Element get bestElement;
|
||||
|
||||
/**
|
||||
|
@ -5053,7 +5070,11 @@ abstract class MethodReferenceExpression {
|
|||
* be returned. Otherwise, the element found using the result of static
|
||||
* analysis will be returned. If resolution has not been performed, then
|
||||
* `null` will be returned.
|
||||
*
|
||||
* Deprecated: The analyzer no longer computes propagated type information.
|
||||
* Use [staticElement] instead.
|
||||
*/
|
||||
@deprecated
|
||||
MethodElement get bestElement;
|
||||
|
||||
/**
|
||||
|
|
|
@ -498,13 +498,13 @@ class _IndexContributor extends GeneralizingAstVisitor {
|
|||
|
||||
@override
|
||||
visitAssignmentExpression(AssignmentExpression node) {
|
||||
recordOperatorReference(node.operator, node.bestElement);
|
||||
recordOperatorReference(node.operator, node.staticElement);
|
||||
super.visitAssignmentExpression(node);
|
||||
}
|
||||
|
||||
@override
|
||||
visitBinaryExpression(BinaryExpression node) {
|
||||
recordOperatorReference(node.operator, node.bestElement);
|
||||
recordOperatorReference(node.operator, node.staticElement);
|
||||
super.visitBinaryExpression(node);
|
||||
}
|
||||
|
||||
|
@ -558,6 +558,13 @@ class _IndexContributor extends GeneralizingAstVisitor {
|
|||
node.type.accept(this);
|
||||
}
|
||||
|
||||
@override
|
||||
visitExportDirective(ExportDirective node) {
|
||||
ExportElement element = node.element;
|
||||
recordUriReference(element?.exportedLibrary, node);
|
||||
super.visitExportDirective(node);
|
||||
}
|
||||
|
||||
@override
|
||||
visitExpression(Expression node) {
|
||||
ParameterElement parameterElement = node.staticParameterElement;
|
||||
|
@ -568,13 +575,6 @@ class _IndexContributor extends GeneralizingAstVisitor {
|
|||
super.visitExpression(node);
|
||||
}
|
||||
|
||||
@override
|
||||
visitExportDirective(ExportDirective node) {
|
||||
ExportElement element = node.element;
|
||||
recordUriReference(element?.exportedLibrary, node);
|
||||
super.visitExportDirective(node);
|
||||
}
|
||||
|
||||
@override
|
||||
visitExtendsClause(ExtendsClause node) {
|
||||
recordSuperType(node.superclass, IndexRelationKind.IS_EXTENDED_BY);
|
||||
|
@ -596,7 +596,7 @@ class _IndexContributor extends GeneralizingAstVisitor {
|
|||
|
||||
@override
|
||||
visitIndexExpression(IndexExpression node) {
|
||||
MethodElement element = node.bestElement;
|
||||
MethodElement element = node.staticElement;
|
||||
if (element is MethodElement) {
|
||||
Token operator = node.leftBracket;
|
||||
recordRelationToken(element, IndexRelationKind.IS_INVOKED_BY, operator);
|
||||
|
@ -610,7 +610,7 @@ class _IndexContributor extends GeneralizingAstVisitor {
|
|||
@override
|
||||
visitMethodInvocation(MethodInvocation node) {
|
||||
SimpleIdentifier name = node.methodName;
|
||||
Element element = name.bestElement;
|
||||
Element element = name.staticElement;
|
||||
// unresolved name invocation
|
||||
bool isQualified = node.realTarget != null;
|
||||
if (element == null) {
|
||||
|
@ -637,13 +637,13 @@ class _IndexContributor extends GeneralizingAstVisitor {
|
|||
|
||||
@override
|
||||
visitPostfixExpression(PostfixExpression node) {
|
||||
recordOperatorReference(node.operator, node.bestElement);
|
||||
recordOperatorReference(node.operator, node.staticElement);
|
||||
super.visitPostfixExpression(node);
|
||||
}
|
||||
|
||||
@override
|
||||
visitPrefixExpression(PrefixExpression node) {
|
||||
recordOperatorReference(node.operator, node.bestElement);
|
||||
recordOperatorReference(node.operator, node.staticElement);
|
||||
super.visitPrefixExpression(node);
|
||||
}
|
||||
|
||||
|
@ -669,7 +669,7 @@ class _IndexContributor extends GeneralizingAstVisitor {
|
|||
if (node.inDeclarationContext()) {
|
||||
return;
|
||||
}
|
||||
Element element = node.bestElement;
|
||||
Element element = node.staticElement;
|
||||
// record unresolved name reference
|
||||
bool isQualified = _isQualified(node);
|
||||
if (element == null) {
|
||||
|
|
|
@ -756,6 +756,7 @@ class AssignmentExpressionImpl extends ExpressionImpl
|
|||
Token get beginToken => _leftHandSide.beginToken;
|
||||
|
||||
@override
|
||||
@deprecated
|
||||
MethodElement get bestElement => staticElement;
|
||||
|
||||
@override
|
||||
|
@ -1056,6 +1057,7 @@ class BinaryExpressionImpl extends ExpressionImpl implements BinaryExpression {
|
|||
Token get beginToken => _leftOperand.beginToken;
|
||||
|
||||
@override
|
||||
@deprecated
|
||||
MethodElement get bestElement => staticElement;
|
||||
|
||||
@override
|
||||
|
@ -4031,9 +4033,12 @@ abstract class ExpressionImpl extends AstNodeImpl implements Expression {
|
|||
* than static analysis, that type will be returned. Otherwise, the result of
|
||||
* static analysis will be returned.
|
||||
*/
|
||||
@override
|
||||
@deprecated
|
||||
ParameterElement get bestParameterElement => staticParameterElement;
|
||||
|
||||
@override
|
||||
@deprecated
|
||||
DartType get bestType => staticType ?? DynamicTypeImpl.instance;
|
||||
|
||||
/**
|
||||
|
@ -5345,6 +5350,7 @@ class FunctionExpressionInvocationImpl extends InvocationExpressionImpl
|
|||
Token get beginToken => _function.beginToken;
|
||||
|
||||
@override
|
||||
@deprecated
|
||||
ExecutableElement get bestElement => staticElement;
|
||||
|
||||
@override
|
||||
|
@ -5855,6 +5861,8 @@ abstract class IdentifierImpl extends ExpressionImpl implements Identifier {
|
|||
* will be returned. If resolution has not been performed, then `null` will be
|
||||
* returned.
|
||||
*/
|
||||
@override
|
||||
@deprecated
|
||||
Element get bestElement;
|
||||
|
||||
@override
|
||||
|
@ -6201,6 +6209,7 @@ class IndexExpressionImpl extends ExpressionImpl implements IndexExpression {
|
|||
}
|
||||
|
||||
@override
|
||||
@deprecated
|
||||
MethodElement get bestElement => staticElement;
|
||||
|
||||
@override
|
||||
|
@ -6462,7 +6471,7 @@ class InstanceCreationExpressionImpl extends ExpressionImpl
|
|||
}
|
||||
}
|
||||
} else if (argument is Identifier) {
|
||||
Element element = argument.bestElement;
|
||||
Element element = argument.staticElement;
|
||||
if (element is PropertyAccessorElement && !element.variable.isConst) {
|
||||
return false;
|
||||
} else if (element is VariableElement && !element.isConst) {
|
||||
|
@ -7045,6 +7054,7 @@ class LibraryIdentifierImpl extends IdentifierImpl
|
|||
Token get beginToken => _components.beginToken;
|
||||
|
||||
@override
|
||||
@deprecated
|
||||
Element get bestElement => staticElement;
|
||||
|
||||
@override
|
||||
|
@ -8555,6 +8565,7 @@ class PostfixExpressionImpl extends ExpressionImpl
|
|||
Token get beginToken => _operand.beginToken;
|
||||
|
||||
@override
|
||||
@deprecated
|
||||
MethodElement get bestElement => staticElement;
|
||||
|
||||
@override
|
||||
|
@ -8653,11 +8664,12 @@ class PrefixedIdentifierImpl extends IdentifierImpl
|
|||
Token get beginToken => _prefix.beginToken;
|
||||
|
||||
@override
|
||||
@deprecated
|
||||
Element get bestElement {
|
||||
if (_identifier == null) {
|
||||
return null;
|
||||
}
|
||||
return _identifier.bestElement;
|
||||
return _identifier.staticElement;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -8760,6 +8772,7 @@ class PrefixExpressionImpl extends ExpressionImpl implements PrefixExpression {
|
|||
Token get beginToken => operator;
|
||||
|
||||
@override
|
||||
@deprecated
|
||||
MethodElement get bestElement => staticElement;
|
||||
|
||||
@override
|
||||
|
@ -9307,6 +9320,7 @@ class SimpleIdentifierImpl extends IdentifierImpl implements SimpleIdentifier {
|
|||
Token get beginToken => token;
|
||||
|
||||
@override
|
||||
@deprecated
|
||||
Element get bestElement => _staticElement;
|
||||
|
||||
@override
|
||||
|
|
|
@ -15,21 +15,21 @@ class ResolutionMapImpl implements ResolutionMap {
|
|||
@override
|
||||
ExecutableElement bestElementForFunctionExpressionInvocation(
|
||||
FunctionExpressionInvocation node) =>
|
||||
node.bestElement;
|
||||
node.staticElement;
|
||||
|
||||
@override
|
||||
Element bestElementForIdentifier(Identifier node) => node.bestElement;
|
||||
Element bestElementForIdentifier(Identifier node) => node.staticElement;
|
||||
|
||||
@override
|
||||
MethodElement bestElementForMethodReference(MethodReferenceExpression node) =>
|
||||
node.bestElement;
|
||||
node.staticElement;
|
||||
|
||||
@override
|
||||
ParameterElement bestParameterElementForExpression(Expression node) =>
|
||||
node.bestParameterElement;
|
||||
node.staticParameterElement;
|
||||
|
||||
@override
|
||||
DartType bestTypeForExpression(Expression node) => node.bestType;
|
||||
DartType bestTypeForExpression(Expression node) => node.staticType;
|
||||
|
||||
@override
|
||||
ElementAnnotation elementAnnotationForAnnotation(Annotation node) =>
|
||||
|
|
|
@ -2621,10 +2621,10 @@ class ElementLocator_ElementMapper extends GeneralizingAstVisitor<Element> {
|
|||
|
||||
@override
|
||||
Element visitAssignmentExpression(AssignmentExpression node) =>
|
||||
node.bestElement;
|
||||
node.staticElement;
|
||||
|
||||
@override
|
||||
Element visitBinaryExpression(BinaryExpression node) => node.bestElement;
|
||||
Element visitBinaryExpression(BinaryExpression node) => node.staticElement;
|
||||
|
||||
@override
|
||||
Element visitClassDeclaration(ClassDeclaration node) => node.element;
|
||||
|
@ -2657,9 +2657,9 @@ class ElementLocator_ElementMapper extends GeneralizingAstVisitor<Element> {
|
|||
if (identical(returnType, node)) {
|
||||
SimpleIdentifier name = parent.name;
|
||||
if (name != null) {
|
||||
return name.bestElement;
|
||||
return name.staticElement;
|
||||
}
|
||||
Element element = node.bestElement;
|
||||
Element element = node.staticElement;
|
||||
if (element is ClassElement) {
|
||||
return element.unnamedConstructor;
|
||||
}
|
||||
|
@ -2675,14 +2675,14 @@ class ElementLocator_ElementMapper extends GeneralizingAstVisitor<Element> {
|
|||
return grandParent.element;
|
||||
}
|
||||
}
|
||||
return node.bestElement;
|
||||
return node.staticElement;
|
||||
}
|
||||
|
||||
@override
|
||||
Element visitImportDirective(ImportDirective node) => node.element;
|
||||
|
||||
@override
|
||||
Element visitIndexExpression(IndexExpression node) => node.bestElement;
|
||||
Element visitIndexExpression(IndexExpression node) => node.staticElement;
|
||||
|
||||
@override
|
||||
Element visitInstanceCreationExpression(InstanceCreationExpression node) =>
|
||||
|
@ -2696,19 +2696,20 @@ class ElementLocator_ElementMapper extends GeneralizingAstVisitor<Element> {
|
|||
|
||||
@override
|
||||
Element visitMethodInvocation(MethodInvocation node) =>
|
||||
node.methodName.bestElement;
|
||||
node.methodName.staticElement;
|
||||
|
||||
@override
|
||||
Element visitPartOfDirective(PartOfDirective node) => node.element;
|
||||
|
||||
@override
|
||||
Element visitPostfixExpression(PostfixExpression node) => node.bestElement;
|
||||
Element visitPostfixExpression(PostfixExpression node) => node.staticElement;
|
||||
|
||||
@override
|
||||
Element visitPrefixedIdentifier(PrefixedIdentifier node) => node.bestElement;
|
||||
Element visitPrefixedIdentifier(PrefixedIdentifier node) =>
|
||||
node.staticElement;
|
||||
|
||||
@override
|
||||
Element visitPrefixExpression(PrefixExpression node) => node.bestElement;
|
||||
Element visitPrefixExpression(PrefixExpression node) => node.staticElement;
|
||||
|
||||
@override
|
||||
Element visitStringLiteral(StringLiteral node) {
|
||||
|
|
|
@ -1295,7 +1295,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
|
|||
* type analysis.
|
||||
*/
|
||||
DartType _getBestType(Expression expression) {
|
||||
DartType bestType = _resolveTypeParameter(expression.bestType);
|
||||
DartType bestType = _resolveTypeParameter(expression.staticType);
|
||||
if (bestType is FunctionType) {
|
||||
//
|
||||
// All function types are subtypes of 'Function', which is itself a
|
||||
|
|
|
@ -319,7 +319,7 @@ class BestPracticesVerifier extends RecursiveAstVisitor<Object> {
|
|||
@override
|
||||
Object visitArgumentList(ArgumentList node) {
|
||||
for (Expression argument in node.arguments) {
|
||||
ParameterElement parameter = argument.bestParameterElement;
|
||||
ParameterElement parameter = argument.staticParameterElement;
|
||||
if (parameter?.isOptionalPositional == true) {
|
||||
_checkForDeprecatedMemberUse(parameter, argument);
|
||||
}
|
||||
|
@ -339,7 +339,7 @@ class BestPracticesVerifier extends RecursiveAstVisitor<Object> {
|
|||
if (operatorType == TokenType.EQ) {
|
||||
_checkForInvalidAssignment(node.leftHandSide, node.rightHandSide);
|
||||
} else {
|
||||
_checkForDeprecatedMemberUse(node.bestElement, node);
|
||||
_checkForDeprecatedMemberUse(node.staticElement, node);
|
||||
}
|
||||
return super.visitAssignmentExpression(node);
|
||||
}
|
||||
|
@ -347,7 +347,7 @@ class BestPracticesVerifier extends RecursiveAstVisitor<Object> {
|
|||
@override
|
||||
Object visitBinaryExpression(BinaryExpression node) {
|
||||
_checkForDivisionOptimizationHint(node);
|
||||
_checkForDeprecatedMemberUse(node.bestElement, node);
|
||||
_checkForDeprecatedMemberUse(node.staticElement, node);
|
||||
return super.visitBinaryExpression(node);
|
||||
}
|
||||
|
||||
|
@ -425,7 +425,7 @@ class BestPracticesVerifier extends RecursiveAstVisitor<Object> {
|
|||
|
||||
@override
|
||||
Object visitIndexExpression(IndexExpression node) {
|
||||
_checkForDeprecatedMemberUse(node.bestElement, node);
|
||||
_checkForDeprecatedMemberUse(node.staticElement, node);
|
||||
return super.visitIndexExpression(node);
|
||||
}
|
||||
|
||||
|
@ -475,13 +475,13 @@ class BestPracticesVerifier extends RecursiveAstVisitor<Object> {
|
|||
|
||||
@override
|
||||
Object visitPostfixExpression(PostfixExpression node) {
|
||||
_checkForDeprecatedMemberUse(node.bestElement, node);
|
||||
_checkForDeprecatedMemberUse(node.staticElement, node);
|
||||
return super.visitPostfixExpression(node);
|
||||
}
|
||||
|
||||
@override
|
||||
Object visitPrefixExpression(PrefixExpression node) {
|
||||
_checkForDeprecatedMemberUse(node.bestElement, node);
|
||||
_checkForDeprecatedMemberUse(node.staticElement, node);
|
||||
return super.visitPrefixExpression(node);
|
||||
}
|
||||
|
||||
|
@ -705,7 +705,7 @@ class BestPracticesVerifier extends RecursiveAstVisitor<Object> {
|
|||
parent is HideCombinator) {
|
||||
return;
|
||||
}
|
||||
_checkForDeprecatedMemberUse(identifier.bestElement, identifier);
|
||||
_checkForDeprecatedMemberUse(identifier.staticElement, identifier);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -722,7 +722,7 @@ class BestPracticesVerifier extends RecursiveAstVisitor<Object> {
|
|||
}
|
||||
// Return if the '/' operator is not defined in core, or if we don't know
|
||||
// its static type
|
||||
MethodElement methodElement = node.bestElement;
|
||||
MethodElement methodElement = node.staticElement;
|
||||
if (methodElement == null) {
|
||||
return false;
|
||||
}
|
||||
|
@ -892,7 +892,7 @@ class BestPracticesVerifier extends RecursiveAstVisitor<Object> {
|
|||
library.definingCompilationUnit.source.fullName.contains(_testDir) ||
|
||||
library.definingCompilationUnit.source.fullName.contains(_testingDir);
|
||||
|
||||
Element element = identifier.bestElement;
|
||||
Element element = identifier.staticElement;
|
||||
if (!isProtected(element) && !isVisibleForTesting(element)) {
|
||||
return;
|
||||
}
|
||||
|
@ -963,7 +963,7 @@ class BestPracticesVerifier extends RecursiveAstVisitor<Object> {
|
|||
return false;
|
||||
}
|
||||
// Test for, and then generate the hint
|
||||
DartType bestRightType = rhs.bestType;
|
||||
DartType bestRightType = rhs.staticType;
|
||||
if (leftType != null && bestRightType != null) {
|
||||
if (!_typeSystem.isAssignableTo(bestRightType, leftType,
|
||||
isDeclarationCast: true)) {
|
||||
|
@ -6474,7 +6474,7 @@ class ResolverVisitor extends ScopedVisitor {
|
|||
* that will return the Iterable being iterated over.
|
||||
*/
|
||||
DartType _getIteratorElementType(Expression iteratorExpression) {
|
||||
DartType expressionType = iteratorExpression.bestType;
|
||||
DartType expressionType = iteratorExpression.staticType;
|
||||
if (expressionType is InterfaceType) {
|
||||
PropertyAccessorElement iteratorFunction =
|
||||
expressionType.lookUpInheritedGetter("iterator");
|
||||
|
@ -6504,7 +6504,7 @@ class ResolverVisitor extends ScopedVisitor {
|
|||
* is the expression that will return the stream being iterated over.
|
||||
*/
|
||||
DartType _getStreamElementType(Expression streamExpression) {
|
||||
DartType streamType = streamExpression.bestType;
|
||||
DartType streamType = streamExpression.staticType;
|
||||
if (streamType is InterfaceType) {
|
||||
MethodElement listenFunction = streamType.lookUpInheritedMethod("listen");
|
||||
if (listenFunction == null) {
|
||||
|
|
|
@ -1074,7 +1074,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
|
|||
Expression initializer = node.initializer;
|
||||
_inferLocalVariableType(node, initializer);
|
||||
if (initializer != null) {
|
||||
DartType rightType = initializer.bestType;
|
||||
DartType rightType = initializer.staticType;
|
||||
SimpleIdentifier name = node.name;
|
||||
VariableElement element = name.staticElement as VariableElement;
|
||||
if (element != null) {
|
||||
|
|
|
@ -305,8 +305,8 @@ abstract class A<K, V> = Object with MapMixin<K, V>;
|
|||
void test_isEnum() {
|
||||
String firstConst = "A";
|
||||
String secondConst = "B";
|
||||
EnumElementImpl enumE = ElementFactory
|
||||
.enumElement(new TestTypeProvider(), "E", [firstConst, secondConst]);
|
||||
EnumElementImpl enumE = ElementFactory.enumElement(
|
||||
new TestTypeProvider(), "E", [firstConst, secondConst]);
|
||||
|
||||
// E is an enum
|
||||
expect(enumE.isEnum, true);
|
||||
|
@ -1024,7 +1024,7 @@ main() {
|
|||
ExpressionStatement statement = body.block.statements[0];
|
||||
MethodInvocation invocation = statement.expression;
|
||||
ParameterElement parameter =
|
||||
invocation.argumentList.arguments[0].bestParameterElement;
|
||||
invocation.argumentList.arguments[0].staticParameterElement;
|
||||
ElementAnnotation annotation = parameter.metadata[0];
|
||||
expect(annotation.constantValue, isNull);
|
||||
DartObject value = annotation.computeConstantValue();
|
||||
|
@ -1276,8 +1276,8 @@ class FunctionTypeImplTest extends EngineTestCase {
|
|||
|
||||
void test_getNamedParameterTypes_namedParameters() {
|
||||
TestTypeProvider typeProvider = new TestTypeProvider();
|
||||
FunctionElement element = ElementFactory
|
||||
.functionElementWithParameters('f', VoidTypeImpl.instance, [
|
||||
FunctionElement element = ElementFactory.functionElementWithParameters(
|
||||
'f', VoidTypeImpl.instance, [
|
||||
ElementFactory.requiredParameter2('a', typeProvider.intType),
|
||||
ElementFactory.requiredParameter('b'),
|
||||
ElementFactory.namedParameter2('c', typeProvider.stringType),
|
||||
|
@ -1292,8 +1292,8 @@ class FunctionTypeImplTest extends EngineTestCase {
|
|||
|
||||
void test_getNamedParameterTypes_noNamedParameters() {
|
||||
TestTypeProvider typeProvider = new TestTypeProvider();
|
||||
FunctionElement element = ElementFactory
|
||||
.functionElementWithParameters('f', VoidTypeImpl.instance, [
|
||||
FunctionElement element = ElementFactory.functionElementWithParameters(
|
||||
'f', VoidTypeImpl.instance, [
|
||||
ElementFactory.requiredParameter2('a', typeProvider.intType),
|
||||
ElementFactory.requiredParameter('b'),
|
||||
ElementFactory.positionalParameter2('c', typeProvider.stringType)
|
||||
|
@ -1311,8 +1311,8 @@ class FunctionTypeImplTest extends EngineTestCase {
|
|||
|
||||
void test_getNormalParameterTypes_noNormalParameters() {
|
||||
TestTypeProvider typeProvider = new TestTypeProvider();
|
||||
FunctionElement element = ElementFactory
|
||||
.functionElementWithParameters('f', VoidTypeImpl.instance, [
|
||||
FunctionElement element = ElementFactory.functionElementWithParameters(
|
||||
'f', VoidTypeImpl.instance, [
|
||||
ElementFactory.positionalParameter2('c', typeProvider.stringType),
|
||||
ElementFactory.positionalParameter('d')
|
||||
]);
|
||||
|
@ -1329,8 +1329,8 @@ class FunctionTypeImplTest extends EngineTestCase {
|
|||
|
||||
void test_getNormalParameterTypes_normalParameters() {
|
||||
TestTypeProvider typeProvider = new TestTypeProvider();
|
||||
FunctionElement element = ElementFactory
|
||||
.functionElementWithParameters('f', VoidTypeImpl.instance, [
|
||||
FunctionElement element = ElementFactory.functionElementWithParameters(
|
||||
'f', VoidTypeImpl.instance, [
|
||||
ElementFactory.requiredParameter2('a', typeProvider.intType),
|
||||
ElementFactory.requiredParameter('b'),
|
||||
ElementFactory.positionalParameter2('c', typeProvider.stringType)
|
||||
|
@ -1344,8 +1344,8 @@ class FunctionTypeImplTest extends EngineTestCase {
|
|||
|
||||
void test_getOptionalParameterTypes_noOptionalParameters() {
|
||||
TestTypeProvider typeProvider = new TestTypeProvider();
|
||||
FunctionElement element = ElementFactory
|
||||
.functionElementWithParameters('f', VoidTypeImpl.instance, [
|
||||
FunctionElement element = ElementFactory.functionElementWithParameters(
|
||||
'f', VoidTypeImpl.instance, [
|
||||
ElementFactory.requiredParameter2('a', typeProvider.intType),
|
||||
ElementFactory.requiredParameter('b'),
|
||||
ElementFactory.namedParameter2('c', typeProvider.stringType),
|
||||
|
@ -1364,8 +1364,8 @@ class FunctionTypeImplTest extends EngineTestCase {
|
|||
|
||||
void test_getOptionalParameterTypes_optionalParameters() {
|
||||
TestTypeProvider typeProvider = new TestTypeProvider();
|
||||
FunctionElement element = ElementFactory
|
||||
.functionElementWithParameters('f', VoidTypeImpl.instance, [
|
||||
FunctionElement element = ElementFactory.functionElementWithParameters(
|
||||
'f', VoidTypeImpl.instance, [
|
||||
ElementFactory.requiredParameter2('a', typeProvider.intType),
|
||||
ElementFactory.requiredParameter('b'),
|
||||
ElementFactory.positionalParameter2('c', typeProvider.stringType),
|
||||
|
@ -1581,8 +1581,8 @@ class FunctionTypeImplTest extends EngineTestCase {
|
|||
void test_isSubtypeOf_normalAndPositionalArgs_2() {
|
||||
// (a, [a]) -> void <: (a) -> void
|
||||
ClassElement a = ElementFactory.classElement2("A");
|
||||
FunctionType t = ElementFactory
|
||||
.functionElement6("t", <ClassElement>[a], <ClassElement>[a]).type;
|
||||
FunctionType t = ElementFactory.functionElement6(
|
||||
"t", <ClassElement>[a], <ClassElement>[a]).type;
|
||||
FunctionType s =
|
||||
ElementFactory.functionElement5("s", <ClassElement>[a]).type;
|
||||
expect(t.isSubtypeOf(s), isTrue);
|
||||
|
@ -1608,8 +1608,8 @@ class FunctionTypeImplTest extends EngineTestCase {
|
|||
ClassElement e = ElementFactory.classElement2("E");
|
||||
FunctionType t = ElementFactory.functionElement6(
|
||||
"t", <ClassElement>[a, b], <ClassElement>[c, d, e]).type;
|
||||
FunctionType s = ElementFactory
|
||||
.functionElement6("s", <ClassElement>[a, b, c], <ClassElement>[d]).type;
|
||||
FunctionType s = ElementFactory.functionElement6(
|
||||
"s", <ClassElement>[a, b, c], <ClassElement>[d]).type;
|
||||
expect(t.isSubtypeOf(s), isTrue);
|
||||
expect(s.isSubtypeOf(t), isFalse);
|
||||
}
|
||||
|
@ -1741,11 +1741,11 @@ class FunctionTypeImplTest extends EngineTestCase {
|
|||
|
||||
void test_isSubtypeOf_returnType_tNotAssignableToS() {
|
||||
// ! () -> A <: () -> B
|
||||
FunctionType t = ElementFactory
|
||||
.functionElement2("t", ElementFactory.classElement2("A").type)
|
||||
FunctionType t = ElementFactory.functionElement2(
|
||||
"t", ElementFactory.classElement2("A").type)
|
||||
.type;
|
||||
FunctionType s = ElementFactory
|
||||
.functionElement2("s", ElementFactory.classElement2("B").type)
|
||||
FunctionType s = ElementFactory.functionElement2(
|
||||
"s", ElementFactory.classElement2("B").type)
|
||||
.type;
|
||||
expect(t.isSubtypeOf(s), isFalse);
|
||||
}
|
||||
|
@ -1790,8 +1790,8 @@ class FunctionTypeImplTest extends EngineTestCase {
|
|||
ClassElement a = ElementFactory.classElement2("A");
|
||||
FunctionType t =
|
||||
ElementFactory.functionElement5("t", <ClassElement>[a]).type;
|
||||
FunctionType s = ElementFactory
|
||||
.functionElement7("s", null, <String>["name"], <ClassElement>[a]).type;
|
||||
FunctionType s = ElementFactory.functionElement7(
|
||||
"s", null, <String>["name"], <ClassElement>[a]).type;
|
||||
expect(t.isSubtypeOf(s), isFalse);
|
||||
expect(s.isSubtypeOf(t), isFalse);
|
||||
}
|
||||
|
@ -1802,8 +1802,8 @@ class FunctionTypeImplTest extends EngineTestCase {
|
|||
ClassElement a = ElementFactory.classElement2("A");
|
||||
FunctionType t =
|
||||
ElementFactory.functionElement6("t", null, <ClassElement>[a]).type;
|
||||
FunctionType s = ElementFactory
|
||||
.functionElement7("s", null, <String>["name"], <ClassElement>[a]).type;
|
||||
FunctionType s = ElementFactory.functionElement7(
|
||||
"s", null, <String>["name"], <ClassElement>[a]).type;
|
||||
expect(t.isSubtypeOf(s), isFalse);
|
||||
expect(s.isSubtypeOf(t), isFalse);
|
||||
}
|
||||
|
@ -3108,8 +3108,9 @@ class InterfaceTypeImplTest extends EngineTestCase {
|
|||
classA.methods = <MethodElement>[
|
||||
ElementFactory.methodElement("call", VoidTypeImpl.instance, [stringType])
|
||||
];
|
||||
FunctionType functionType = ElementFactory
|
||||
.functionElement5("f", <ClassElement>[stringType.element]).type;
|
||||
FunctionType functionType =
|
||||
ElementFactory.functionElement5("f", <ClassElement>[stringType.element])
|
||||
.type;
|
||||
expect(classA.type.isSubtypeOf(functionType), isTrue);
|
||||
}
|
||||
|
||||
|
@ -3901,9 +3902,10 @@ class B<S> extends A<S> {
|
|||
MethodElement AfElement = elementB.type
|
||||
.lookUpInheritedMethod("f", library: libraryElement, thisType: false);
|
||||
expect(
|
||||
BfElement.getReifiedType(objectType), // ignore: deprecated_member_use
|
||||
equals(AfElement
|
||||
.getReifiedType(objectType))); // ignore: deprecated_member_use
|
||||
// ignore: deprecated_member_use
|
||||
BfElement.getReifiedType(objectType),
|
||||
// ignore: deprecated_member_use
|
||||
equals(AfElement.getReifiedType(objectType)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4117,7 +4119,7 @@ main() {
|
|||
ExpressionStatement statement = body.block.statements[0];
|
||||
MethodInvocation invocation = statement.expression;
|
||||
SimpleIdentifier argument = invocation.argumentList.arguments[0];
|
||||
PropertyAccessorElementImpl getter = argument.bestElement;
|
||||
PropertyAccessorElementImpl getter = argument.staticElement;
|
||||
TopLevelVariableElement constant = getter.variable;
|
||||
expect(constant.constantValue, isNull);
|
||||
DartObject value = constant.computeConstantValue();
|
||||
|
|
|
@ -524,7 +524,7 @@ class DartEditBuilderImpl extends EditBuilderImpl implements DartEditBuilder {
|
|||
void writeParameterMatchingArgument(
|
||||
Expression argument, int index, Set<String> usedNames) {
|
||||
// append type name
|
||||
DartType type = argument.bestType;
|
||||
DartType type = argument.staticType;
|
||||
if (type == null || type.isBottom || type.isDartCoreNull) {
|
||||
type = DynamicTypeImpl.instance;
|
||||
}
|
||||
|
|
|
@ -339,7 +339,7 @@ class CompletionTarget {
|
|||
parent = parent.parent;
|
||||
}
|
||||
if (parent is InstanceCreationExpression) {
|
||||
DartType instType = parent.bestType;
|
||||
DartType instType = parent.staticType;
|
||||
if (instType != null) {
|
||||
Element intTypeElem = instType.element;
|
||||
if (intTypeElem is ClassElement) {
|
||||
|
@ -355,7 +355,7 @@ class CompletionTarget {
|
|||
} else if (parent is MethodInvocation) {
|
||||
SimpleIdentifier methodName = parent.methodName;
|
||||
if (methodName != null) {
|
||||
Element methodElem = methodName.bestElement;
|
||||
Element methodElem = methodName.staticElement;
|
||||
if (methodElem is MethodElement) {
|
||||
return _isFunctionalParameter(
|
||||
methodElem.parameters, argIndex, containingNode);
|
||||
|
|
|
@ -279,9 +279,9 @@ class _OpTypeAstVisitor extends GeneralizingAstVisitor {
|
|||
Element constructor;
|
||||
SimpleIdentifier name = parent.constructorName?.name;
|
||||
if (name != null) {
|
||||
constructor = name.bestElement;
|
||||
constructor = name.staticElement;
|
||||
} else {
|
||||
var classElem = parent.constructorName?.type?.name?.bestElement;
|
||||
var classElem = parent.constructorName?.type?.name?.staticElement;
|
||||
if (classElem is ClassElement) {
|
||||
constructor = classElem.unnamedConstructor;
|
||||
}
|
||||
|
@ -295,7 +295,7 @@ class _OpTypeAstVisitor extends GeneralizingAstVisitor {
|
|||
} else if (parent is InvocationExpression) {
|
||||
Expression function = parent.function;
|
||||
if (function is SimpleIdentifier) {
|
||||
var elem = function.bestElement;
|
||||
var elem = function.staticElement;
|
||||
if (elem is FunctionTypedElement) {
|
||||
parameters = elem.parameters;
|
||||
} else if (elem == null) {
|
||||
|
@ -544,6 +544,13 @@ class _OpTypeAstVisitor extends GeneralizingAstVisitor {
|
|||
}
|
||||
}
|
||||
|
||||
@override
|
||||
visitFieldDeclaration(FieldDeclaration node) {
|
||||
if (offset <= node.semicolon.offset) {
|
||||
optype.includeVarNameSuggestions = true;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void visitFieldFormalParameter(FieldFormalParameter node) {
|
||||
if (entity == node.identifier) {
|
||||
|
@ -988,13 +995,6 @@ class _OpTypeAstVisitor extends GeneralizingAstVisitor {
|
|||
}
|
||||
}
|
||||
|
||||
@override
|
||||
visitFieldDeclaration(FieldDeclaration node) {
|
||||
if (offset <= node.semicolon.offset) {
|
||||
optype.includeVarNameSuggestions = true;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void visitVariableDeclarationList(VariableDeclarationList node) {
|
||||
if (node.keyword == null || node.keyword.lexeme != 'var') {
|
||||
|
|
|
@ -107,7 +107,7 @@ class TypeMemberContributor implements CompletionContributor {
|
|||
LibraryElement containingLibrary,
|
||||
Expression expression) {
|
||||
if (expression is Identifier) {
|
||||
Element element = expression.bestElement;
|
||||
Element element = expression.staticElement;
|
||||
if (element is ClassElement) {
|
||||
// Suggestions provided by StaticMemberContributor
|
||||
return;
|
||||
|
@ -119,12 +119,12 @@ class TypeMemberContributor implements CompletionContributor {
|
|||
}
|
||||
|
||||
// Determine the target expression's type
|
||||
DartType type = expression.bestType;
|
||||
if (type.isDynamic) {
|
||||
DartType type = expression.staticType;
|
||||
if (type == null || type.isDynamic) {
|
||||
// If the expression does not provide a good type
|
||||
// then attempt to get a better type from the element
|
||||
if (expression is Identifier) {
|
||||
Element elem = expression.bestElement;
|
||||
Element elem = expression.staticElement;
|
||||
if (elem is FunctionTypedElement) {
|
||||
type = elem.returnType;
|
||||
} else if (elem is ParameterElement) {
|
||||
|
@ -159,7 +159,7 @@ class TypeMemberContributor implements CompletionContributor {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (type.isDynamic) {
|
||||
if (type == null || type.isDynamic) {
|
||||
// Suggest members from object if target is "dynamic"
|
||||
type = request.result.typeProvider.objectType;
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ class _LocalBestTypeVisitor extends LocalDeclarationVisitor {
|
|||
@override
|
||||
void declaredLocalVar(SimpleIdentifier name, TypeAnnotation type) {
|
||||
if (name.name == targetName) {
|
||||
typeFound = name.bestType;
|
||||
typeFound = name.staticType;
|
||||
finished();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue