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 81e9b508d1394e7f520175f35c4c0617694fd25d..a052b13f2ab815327b865e8d01a35cf744b514ac 100644 |
--- a/pkg/analysis_server/lib/src/computer/computer_outline.dart |
+++ b/pkg/analysis_server/lib/src/computer/computer_outline.dart |
@@ -137,7 +137,7 @@ class DartUnitOutlineComputer { |
} |
// unit or class member |
if (parent is CompilationUnit) { |
- firstOffset = 0; |
+ firstOffset = node.offset; |
siblings = parent.declarations; |
} else if (parent is ClassDeclaration) { |
firstOffset = parent.leftBracket.end; |
@@ -160,7 +160,10 @@ class DartUnitOutlineComputer { |
SimpleIdentifier nameNode = node.name; |
String name = nameNode.name; |
_SourceRegion sourceRegion = _getSourceRegion(node); |
- Element element = new Element(ElementKind.CLASS, name, Element.makeFlags( |
+ Element element = new Element( |
+ ElementKind.CLASS, |
+ name, |
+ Element.makeFlags( |
isPrivate: Identifier.isPrivateName(name), |
isDeprecated: _isDeprecated(node), |
isAbstract: node.isAbstract), |
@@ -174,11 +177,13 @@ class DartUnitOutlineComputer { |
SimpleIdentifier nameNode = node.name; |
String name = nameNode.name; |
_SourceRegion sourceRegion = _getSourceRegion(node); |
- Element element = new Element(ElementKind.CLASS_TYPE_ALIAS, name, Element |
- .makeFlags( |
- isPrivate: Identifier.isPrivateName(name), |
- isDeprecated: _isDeprecated(node), |
- isAbstract: node.isAbstract), |
+ Element element = new Element( |
+ ElementKind.CLASS_TYPE_ALIAS, |
+ name, |
+ Element.makeFlags( |
+ isPrivate: Identifier.isPrivateName(name), |
+ isDeprecated: _isDeprecated(node), |
+ isAbstract: node.isAbstract), |
location: _getLocationNode(nameNode), |
typeParameters: _getTypeParametersStr(node.typeParameters)); |
return new Outline(element, sourceRegion.offset, sourceRegion.length); |
@@ -201,9 +206,11 @@ class DartUnitOutlineComputer { |
_SourceRegion sourceRegion = _getSourceRegion(constructor); |
FormalParameterList parameters = constructor.parameters; |
String parametersStr = parameters != null ? parameters.toSource() : ''; |
- Element element = new Element(ElementKind.CONSTRUCTOR, name, Element |
- .makeFlags( |
- isPrivate: isPrivate, isDeprecated: _isDeprecated(constructor)), |
+ Element element = new Element( |
+ ElementKind.CONSTRUCTOR, |
+ name, |
+ Element.makeFlags( |
+ isPrivate: isPrivate, isDeprecated: _isDeprecated(constructor)), |
location: _getLocationOffsetLength(offset, length), |
parameters: parametersStr); |
List<Outline> contents = _addLocalFunctionOutlines(constructor.body); |
@@ -217,10 +224,12 @@ class DartUnitOutlineComputer { |
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)), |
+ 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); |
} |
@@ -229,7 +238,10 @@ class DartUnitOutlineComputer { |
SimpleIdentifier nameNode = node.name; |
String name = nameNode.name; |
_SourceRegion sourceRegion = _getSourceRegion(node); |
- Element element = new Element(ElementKind.ENUM, name, Element.makeFlags( |
+ Element element = new Element( |
+ ElementKind.ENUM, |
+ name, |
+ Element.makeFlags( |
isPrivate: Identifier.isPrivateName(name), |
isDeprecated: _isDeprecated(node)), |
location: _getLocationNode(nameNode)); |
@@ -254,7 +266,10 @@ class DartUnitOutlineComputer { |
_SourceRegion sourceRegion = _getSourceRegion(function); |
String parametersStr = parameters != null ? parameters.toSource() : ''; |
String returnTypeStr = returnType != null ? returnType.toSource() : ''; |
- Element element = new Element(kind, name, Element.makeFlags( |
+ Element element = new Element( |
+ kind, |
+ name, |
+ Element.makeFlags( |
isPrivate: Identifier.isPrivateName(name), |
isDeprecated: _isDeprecated(function), |
isStatic: isStatic), |
@@ -276,10 +291,12 @@ class DartUnitOutlineComputer { |
FormalParameterList parameters = node.parameters; |
String parametersStr = parameters != null ? parameters.toSource() : ''; |
String returnTypeStr = returnType != null ? returnType.toSource() : ''; |
- Element element = new Element(ElementKind.FUNCTION_TYPE_ALIAS, name, Element |
- .makeFlags( |
- isPrivate: Identifier.isPrivateName(name), |
- isDeprecated: _isDeprecated(node)), |
+ Element element = new Element( |
+ ElementKind.FUNCTION_TYPE_ALIAS, |
+ name, |
+ Element.makeFlags( |
+ isPrivate: Identifier.isPrivateName(name), |
+ isDeprecated: _isDeprecated(node)), |
location: _getLocationNode(nameNode), |
parameters: parametersStr, |
returnType: returnTypeStr, |
@@ -303,7 +320,10 @@ class DartUnitOutlineComputer { |
_SourceRegion sourceRegion = _getSourceRegion(method); |
String parametersStr = parameters != null ? parameters.toSource() : null; |
String returnTypeStr = returnType != null ? returnType.toSource() : ''; |
- Element element = new Element(kind, name, Element.makeFlags( |
+ Element element = new Element( |
+ kind, |
+ name, |
+ Element.makeFlags( |
isPrivate: Identifier.isPrivateName(name), |
isDeprecated: _isDeprecated(method), |
isAbstract: method.isAbstract, |
@@ -338,13 +358,17 @@ class DartUnitOutlineComputer { |
SimpleIdentifier nameNode = variable.name; |
String name = nameNode.name; |
_SourceRegion sourceRegion = _getSourceRegion(variable); |
- Element element = new Element(kind, name, Element.makeFlags( |
+ Element element = new Element( |
+ kind, |
+ name, |
+ Element.makeFlags( |
isPrivate: Identifier.isPrivateName(name), |
isDeprecated: _isDeprecated(variable), |
isStatic: isStatic, |
isConst: variable.isConst, |
isFinal: variable.isFinal), |
- location: _getLocationNode(nameNode), returnType: typeName); |
+ location: _getLocationNode(nameNode), |
+ returnType: typeName); |
Outline outline = |
new Outline(element, sourceRegion.offset, sourceRegion.length); |
return outline; |