Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(218)

Unified Diff: pkg/analysis_server/lib/src/computer/computer_outline.dart

Issue 934353002: Issue 22476. Outline for enums. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analysis_server/doc/api.html ('k') | pkg/analysis_server/lib/src/generated_protocol.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « pkg/analysis_server/doc/api.html ('k') | pkg/analysis_server/lib/src/generated_protocol.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698