| Index: pkg/analysis_server/lib/src/computer/computer_highlights.dart
|
| diff --git a/pkg/analysis_server/lib/src/computer/computer_highlights.dart b/pkg/analysis_server/lib/src/computer/computer_highlights.dart
|
| index 0491336d3a78565f4190ac6118ecef43760da9e8..17dbcbb3e7afbb1981e4963a0a92bc6706252a9a 100644
|
| --- a/pkg/analysis_server/lib/src/computer/computer_highlights.dart
|
| +++ b/pkg/analysis_server/lib/src/computer/computer_highlights.dart
|
| @@ -63,7 +63,7 @@ class DartUnitHighlightsComputer {
|
| if (_addIdentifierRegion_constructor(node)) {
|
| return;
|
| }
|
| - if (_addIdentifierRegion_dynamicType(node)) {
|
| + if (_addIdentifierRegion_untyped(node)) {
|
| return;
|
| }
|
| if (_addIdentifierRegion_getterSetterDeclaration(node)) {
|
| @@ -135,7 +135,7 @@ class DartUnitHighlightsComputer {
|
| return _addRegion_node(node, HighlightRegionType.CONSTRUCTOR);
|
| }
|
|
|
| - bool _addIdentifierRegion_dynamicType(SimpleIdentifier node) {
|
| + bool _addIdentifierRegion_untyped(SimpleIdentifier node) {
|
| // should be variable
|
| Element element = node.staticElement;
|
| if (element is! VariableElement) {
|
| @@ -151,7 +151,7 @@ class DartUnitHighlightsComputer {
|
| return false;
|
| }
|
| // OK
|
| - return _addRegion_node(node, HighlightRegionType.DYNAMIC_TYPE);
|
| + return _addRegion_node(node, HighlightRegionType.UNTYPED_VARIABLE);
|
| }
|
|
|
| bool _addIdentifierRegion_field(SimpleIdentifier node) {
|
| @@ -169,12 +169,18 @@ class DartUnitHighlightsComputer {
|
| if (enclosingElement is ClassElement && enclosingElement.isEnum) {
|
| type = HighlightRegionType.ENUM_CONSTANT;
|
| } else if (element.isStatic) {
|
| - type = HighlightRegionType.FIELD_STATIC;
|
| + type = node.inDeclarationContext()
|
| + ? HighlightRegionType.STATIC_FIELD_DECLARATION
|
| + : HighlightRegionType.STATIC_FIELD_REFERENCE;
|
| } else {
|
| - type = HighlightRegionType.FIELD;
|
| + type = node.inDeclarationContext()
|
| + ? HighlightRegionType.INSTANCE_FIELD_DECLARATION
|
| + : HighlightRegionType.INSTANCE_FIELD_REFERENCE;
|
| }
|
| } else if (element is TopLevelVariableElement) {
|
| - type = HighlightRegionType.TOP_LEVEL_VARIABLE;
|
| + type = node.inDeclarationContext()
|
| + ? HighlightRegionType.TOP_LEVEL_VARIABLE_DECLARATION
|
| + : HighlightRegionType.TOP_LEVEL_VARIABLE_REFERENCE;
|
| }
|
| // add region
|
| if (type != null) {
|
| @@ -189,10 +195,15 @@ class DartUnitHighlightsComputer {
|
| return false;
|
| }
|
| HighlightRegionType type;
|
| + bool isTopLevel = element.enclosingElement is CompilationUnitElement;
|
| if (node.inDeclarationContext()) {
|
| - type = HighlightRegionType.FUNCTION_DECLARATION;
|
| + type = isTopLevel
|
| + ? HighlightRegionType.TOP_LEVEL_FUNCTION_DECLARATION
|
| + : HighlightRegionType.LOCAL_FUNCTION_DECLARATION;
|
| } else {
|
| - type = HighlightRegionType.FUNCTION;
|
| + type = isTopLevel
|
| + ? HighlightRegionType.TOP_LEVEL_FUNCTION_REFERENCE
|
| + : HighlightRegionType.LOCAL_FUNCTION_REFERENCE;
|
| }
|
| return _addRegion_node(node, type);
|
| }
|
| @@ -219,11 +230,38 @@ class DartUnitHighlightsComputer {
|
| // getter or setter
|
| PropertyAccessorElement propertyAccessorElement =
|
| element as PropertyAccessorElement;
|
| + bool isTopLevel = element.enclosingElement is CompilationUnitElement;
|
| + HighlightRegionType type;
|
| if (propertyAccessorElement.isGetter) {
|
| - return _addRegion_node(node, HighlightRegionType.GETTER_DECLARATION);
|
| + if (isTopLevel) {
|
| + type = node.inDeclarationContext()
|
| + ? HighlightRegionType.TOP_LEVEL_GETTER_DECLARATION
|
| + : HighlightRegionType.TOP_LEVEL_VARIABLE_REFERENCE;
|
| + } else if (propertyAccessorElement.isStatic) {
|
| + type = node.inDeclarationContext()
|
| + ? HighlightRegionType.STATIC_GETTER_DECLARATION
|
| + : HighlightRegionType.STATIC_FIELD_REFERENCE;
|
| + } else {
|
| + type = node.inDeclarationContext()
|
| + ? HighlightRegionType.INSTANCE_GETTER_DECLARATION
|
| + : HighlightRegionType.INSTANCE_FIELD_REFERENCE;
|
| + }
|
| } else {
|
| - return _addRegion_node(node, HighlightRegionType.SETTER_DECLARATION);
|
| + if (isTopLevel) {
|
| + type = node.inDeclarationContext()
|
| + ? HighlightRegionType.TOP_LEVEL_SETTER_DECLARATION
|
| + : HighlightRegionType.TOP_LEVEL_VARIABLE_REFERENCE;
|
| + } else if (propertyAccessorElement.isStatic) {
|
| + type = node.inDeclarationContext()
|
| + ? HighlightRegionType.STATIC_SETTER_DECLARATION
|
| + : HighlightRegionType.STATIC_FIELD_REFERENCE;
|
| + } else {
|
| + type = node.inDeclarationContext()
|
| + ? HighlightRegionType.INSTANCE_SETTER_DECLARATION
|
| + : HighlightRegionType.INSTANCE_FIELD_REFERENCE;
|
| + }
|
| }
|
| + return _addRegion_node(node, type);
|
| }
|
|
|
| bool _addIdentifierRegion_importPrefix(SimpleIdentifier node) {
|
| @@ -256,12 +294,9 @@ class DartUnitHighlightsComputer {
|
| return false;
|
| }
|
| // OK
|
| - HighlightRegionType type;
|
| - if (node.inDeclarationContext()) {
|
| - type = HighlightRegionType.LOCAL_VARIABLE_DECLARATION;
|
| - } else {
|
| - type = HighlightRegionType.LOCAL_VARIABLE;
|
| - }
|
| + HighlightRegionType type = node.inDeclarationContext()
|
| + ? HighlightRegionType.LOCAL_VARIABLE_DECLARATION
|
| + : HighlightRegionType.LOCAL_VARIABLE_REFERENCE;
|
| return _addRegion_node(node, type);
|
| }
|
|
|
| @@ -276,15 +311,15 @@ class DartUnitHighlightsComputer {
|
| HighlightRegionType type;
|
| if (node.inDeclarationContext()) {
|
| if (isStatic) {
|
| - type = HighlightRegionType.METHOD_DECLARATION_STATIC;
|
| + type = HighlightRegionType.STATIC_METHOD_DECLARATION;
|
| } else {
|
| - type = HighlightRegionType.METHOD_DECLARATION;
|
| + type = HighlightRegionType.INSTANCE_METHOD_DECLARATION;
|
| }
|
| } else {
|
| if (isStatic) {
|
| - type = HighlightRegionType.METHOD_STATIC;
|
| + type = HighlightRegionType.STATIC_METHOD_REFERENCE;
|
| } else {
|
| - type = HighlightRegionType.METHOD;
|
| + type = HighlightRegionType.INSTANCE_METHOD_REFERENCE;
|
| }
|
| }
|
| return _addRegion_node(node, type);
|
| @@ -295,7 +330,10 @@ class DartUnitHighlightsComputer {
|
| if (element is! ParameterElement) {
|
| return false;
|
| }
|
| - return _addRegion_node(node, HighlightRegionType.PARAMETER);
|
| + HighlightRegionType type = node.inDeclarationContext()
|
| + ? HighlightRegionType.PARAMETER_DECLARATION
|
| + : HighlightRegionType.PARAMETER_REFERENCE;
|
| + return _addRegion_node(node, type);
|
| }
|
|
|
| bool _addIdentifierRegion_typeParameter(SimpleIdentifier node) {
|
|
|