Index: pkg/analysis_server/lib/src/computer/computer_outline.dart |
diff --git a/pkg/analysis_server/lib/src/computer/computer_outline.dart b/pkg/analysis_server/lib/src/computer/computer_outline.dart |
index be1c3acfee5f5cd9143d7b92ddfe72eb89cb689c..8efd18e078b09efc13883414088285e2e33df468 100644 |
--- a/pkg/analysis_server/lib/src/computer/computer_outline.dart |
+++ b/pkg/analysis_server/lib/src/computer/computer_outline.dart |
@@ -59,6 +59,14 @@ class DartUnitOutlineComputer { |
} |
unitContents.add(_newClassOutline(classDeclaration, classContents)); |
} |
+ if (unitMember is EnumDeclaration) { |
+ EnumDeclaration enumDeclaration = unitMember; |
+ List<Outline> constantOutlines = <Outline>[]; |
+ for (EnumConstantDeclaration constant in enumDeclaration.constants) { |
+ constantOutlines.add(_newEnumConstant(constant)); |
+ } |
+ unitContents.add(_newEnumOutline(enumDeclaration, constantOutlines)); |
+ } |
if (unitMember is TopLevelVariableDeclaration) { |
TopLevelVariableDeclaration fieldDeclaration = unitMember; |
VariableDeclarationList fields = fieldDeclaration.variables; |
@@ -227,6 +235,38 @@ class DartUnitOutlineComputer { |
return outline; |
} |
+ Outline _newEnumConstant(EnumConstantDeclaration node) { |
+ SimpleIdentifier nameNode = node.name; |
+ String name = nameNode.name; |
+ _SourceRegion sourceRegion = _getSourceRegion(node); |
+ Element element = new Element( |
+ ElementKind.ENUM_CONSTANT, |
+ name, |
+ Element.makeFlags( |
+ isPrivate: Identifier.isPrivateName(name), |
+ isDeprecated: _isDeprecated(node)), |
+ location: _getLocationNode(nameNode)); |
+ return new Outline(element, sourceRegion.offset, sourceRegion.length); |
+ } |
+ |
+ Outline _newEnumOutline(EnumDeclaration node, List<Outline> children) { |
+ SimpleIdentifier nameNode = node.name; |
+ String name = nameNode.name; |
+ _SourceRegion sourceRegion = _getSourceRegion(node); |
+ Element element = new Element( |
+ ElementKind.ENUM, |
+ name, |
+ Element.makeFlags( |
+ isPrivate: Identifier.isPrivateName(name), |
+ isDeprecated: _isDeprecated(node)), |
+ location: _getLocationNode(nameNode)); |
+ return new Outline( |
+ element, |
+ sourceRegion.offset, |
+ sourceRegion.length, |
+ children: nullIfEmpty(children)); |
+ } |
+ |
Outline _newFunctionOutline(FunctionDeclaration function, bool isStatic) { |
TypeName returnType = function.returnType; |
SimpleIdentifier nameNode = function.name; |