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

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

Issue 311053005: Updates for the Outline API and use it in Editor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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 9ae5cdf6794d6eb70fd97068e40f40a0c04a14b8..360975959158f10b8413044dd82719962b7df05b 100644
--- a/pkg/analysis_server/lib/src/computer/computer_outline.dart
+++ b/pkg/analysis_server/lib/src/computer/computer_outline.dart
@@ -249,7 +249,7 @@ class DartUnitOutlineComputer {
_Outline _newUnitOutline() {
return new _Outline(
- _OutlineKind.COMPILATION_UNIT, null,
+ _OutlineKind.COMPILATION_UNIT, "<unit>",
_unit.offset, _unit.length,
_unit.offset, _unit.length,
false, false,
@@ -338,7 +338,7 @@ class _Outline {
final int elementLength;
final bool isAbstract;
final bool isStatic;
- final String arguments;
+ final String parameters;
final String returnType;
final List<_Outline> children = <_Outline>[];
@@ -346,10 +346,10 @@ class _Outline {
this.nameOffset, this.nameLength,
this.elementOffset, this.elementLength,
this.isAbstract, this.isStatic,
- this.arguments, this.returnType);
+ this.parameters, this.returnType);
Map<String, Object> toJson() {
- return {
+ Map<String, Object> json = {
KIND: kind.name,
NAME: name,
NAME_OFFSET: nameOffset,
@@ -357,10 +357,17 @@ class _Outline {
ELEMENT_OFFSET: elementOffset,
ELEMENT_LENGTH: elementLength,
IS_ABSTRACT: isAbstract,
- IS_STATIC: isStatic,
- ARGUMENTS: arguments,
- RETURN_TYPE: returnType,
- CHILDREN: children.map((child) => child.toJson()).toList(growable: false)
+ IS_STATIC: isStatic
};
+ if (parameters != null) {
+ json[PARAMETERS] = parameters;
+ }
+ if (returnType != null) {
+ json[RETURN_TYPE] = returnType;
+ }
+ if (children.isNotEmpty) {
+ json[CHILDREN] = children.map((child) => child.toJson()).toList();
+ }
+ return json;
}
}

Powered by Google App Engine
This is Rietveld 408576698