| Index: pkg/analysis_server/lib/src/computer/computer_highlights2.dart
|
| diff --git a/pkg/analysis_server/lib/src/computer/computer_highlights2.dart b/pkg/analysis_server/lib/src/computer/computer_highlights2.dart
|
| index 1a8b5a6eef54478d986f3aaea1753db00dc37c58..c847670466c56701a752f7ba3ee76424c462e919 100644
|
| --- a/pkg/analysis_server/lib/src/computer/computer_highlights2.dart
|
| +++ b/pkg/analysis_server/lib/src/computer/computer_highlights2.dart
|
| @@ -96,6 +96,9 @@ class DartUnitHighlightsComputer2 {
|
| if (_addIdentifierRegion_typeParameter(node)) {
|
| return;
|
| }
|
| + if (_addIdentifierRegion_unresolvedInstanceMemberReference(node)) {
|
| + return;
|
| + }
|
| _addRegion_node(node, HighlightRegionType.IDENTIFIER_DEFAULT);
|
| }
|
|
|
| @@ -352,6 +355,38 @@ class DartUnitHighlightsComputer2 {
|
| return _addRegion_node(node, HighlightRegionType.TYPE_PARAMETER);
|
| }
|
|
|
| + bool _addIdentifierRegion_unresolvedInstanceMemberReference(
|
| + SimpleIdentifier node) {
|
| + // unresolved
|
| + Element element = node.bestElement;
|
| + if (element != null) {
|
| + return false;
|
| + }
|
| + // invoke / get / set
|
| + bool decorate = false;
|
| + AstNode parent = node.parent;
|
| + if (parent is MethodInvocation) {
|
| + Expression target = parent.realTarget;
|
| + if (parent.methodName == node &&
|
| + target != null &&
|
| + _isDynamicExpression(target)) {
|
| + decorate = true;
|
| + }
|
| + } else if (node.inGetterContext() || node.inSetterContext()) {
|
| + if (parent is PrefixedIdentifier) {
|
| + decorate = parent.identifier == node;
|
| + } else if (parent is PropertyAccess) {
|
| + decorate = parent.propertyName == node;
|
| + }
|
| + }
|
| + if (decorate) {
|
| + _addRegion_node(
|
| + node, HighlightRegionType.UNRESOLVED_INSTANCE_MEMBER_REFERENCE);
|
| + return true;
|
| + }
|
| + return false;
|
| + }
|
| +
|
| void _addRegion(int offset, int length, HighlightRegionType type) {
|
| _regions.add(new HighlightRegion(type, offset, length));
|
| }
|
| @@ -384,6 +419,13 @@ class DartUnitHighlightsComputer2 {
|
| int end = b.end;
|
| _addRegion(offset, end - offset, type);
|
| }
|
| +
|
| + static bool _isDynamicExpression(Expression e) {
|
| + if (e is SimpleIdentifier && e.staticElement is PrefixElement) {
|
| + return false;
|
| + }
|
| + return e.bestType.isDynamic;
|
| + }
|
| }
|
|
|
| /**
|
|
|