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

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

Issue 990343002: Add an optional 'typeParameters' to Element. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update version. Created 5 years, 9 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
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 c8351dff1a8e8b000335d5d1de7a1c01a8b76e83..c591b287b8d0eb1a92f74aca4125c3ec86f7781e 100644
--- a/pkg/analysis_server/lib/src/computer/computer_outline.dart
+++ b/pkg/analysis_server/lib/src/computer/computer_outline.dart
@@ -157,30 +157,31 @@ class DartUnitOutlineComputer {
return new _SourceRegion(prevSiblingEnd, endOffset - prevSiblingEnd);
}
- Outline _newClassOutline(
- ClassDeclaration classDeclaration, List<Outline> classContents) {
- SimpleIdentifier nameNode = classDeclaration.name;
+ Outline _newClassOutline(ClassDeclaration node, List<Outline> classContents) {
+ SimpleIdentifier nameNode = node.name;
String name = nameNode.name;
- _SourceRegion sourceRegion = _getSourceRegion(classDeclaration);
+ _SourceRegion sourceRegion = _getSourceRegion(node);
Element element = new Element(ElementKind.CLASS, name, Element.makeFlags(
isPrivate: Identifier.isPrivateName(name),
- isDeprecated: _isDeprecated(classDeclaration),
- isAbstract: classDeclaration.isAbstract),
- location: _getLocationNode(nameNode));
+ isDeprecated: _isDeprecated(node),
+ isAbstract: node.isAbstract),
+ location: _getLocationNode(nameNode),
+ typeParameters: _getTypeParametersStr(node.typeParameters));
return new Outline(element, sourceRegion.offset, sourceRegion.length,
children: nullIfEmpty(classContents));
}
- Outline _newClassTypeAlias(ClassTypeAlias alias) {
- SimpleIdentifier nameNode = alias.name;
+ Outline _newClassTypeAlias(ClassTypeAlias node) {
+ SimpleIdentifier nameNode = node.name;
String name = nameNode.name;
- _SourceRegion sourceRegion = _getSourceRegion(alias);
+ _SourceRegion sourceRegion = _getSourceRegion(node);
Element element = new Element(ElementKind.CLASS_TYPE_ALIAS, name, Element
.makeFlags(
isPrivate: Identifier.isPrivateName(name),
- isDeprecated: _isDeprecated(alias),
- isAbstract: alias.isAbstract),
- location: _getLocationNode(nameNode));
+ isDeprecated: _isDeprecated(node),
+ isAbstract: node.isAbstract),
+ location: _getLocationNode(nameNode),
+ typeParameters: _getTypeParametersStr(node.typeParameters));
return new Outline(element, sourceRegion.offset, sourceRegion.length);
}
@@ -268,21 +269,22 @@ class DartUnitOutlineComputer {
return outline;
}
- Outline _newFunctionTypeAliasOutline(FunctionTypeAlias alias) {
- TypeName returnType = alias.returnType;
- SimpleIdentifier nameNode = alias.name;
+ Outline _newFunctionTypeAliasOutline(FunctionTypeAlias node) {
+ TypeName returnType = node.returnType;
+ SimpleIdentifier nameNode = node.name;
String name = nameNode.name;
- _SourceRegion sourceRegion = _getSourceRegion(alias);
- FormalParameterList parameters = alias.parameters;
+ _SourceRegion sourceRegion = _getSourceRegion(node);
+ 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(alias)),
+ isDeprecated: _isDeprecated(node)),
location: _getLocationNode(nameNode),
parameters: parametersStr,
- returnType: returnTypeStr);
+ returnType: returnTypeStr,
+ typeParameters: _getTypeParametersStr(node.typeParameters));
return new Outline(element, sourceRegion.offset, sourceRegion.length);
}
@@ -325,6 +327,13 @@ class DartUnitOutlineComputer {
children: nullIfEmpty(unitContents));
}
+ static String _getTypeParametersStr(TypeParameterList parameters) {
+ if (parameters == null) {
+ return null;
+ }
+ return parameters.toSource();
+ }
+
Outline _newVariableOutline(String typeName, ElementKind kind,
VariableDeclaration variable, bool isStatic) {
SimpleIdentifier nameNode = variable.name;
« no previous file with comments | « pkg/analysis_server/lib/src/analysis_server.dart ('k') | pkg/analysis_server/lib/src/generated_protocol.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698