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

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

Issue 1325143003: Issue 24277. Use node's offset as the source range start for the first unit node in Outline. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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 | « no previous file | pkg/analysis_server/test/analysis/notification_outline_test.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 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;
« no previous file with comments | « no previous file | pkg/analysis_server/test/analysis/notification_outline_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698