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

Unified Diff: pkg/analysis_server/tool/spec/codegen_java_types.dart

Issue 517043002: Re-implementation of the analysis.outline in the java layer, this uses the generated types, and rem… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase with bleeding_edge Created 6 years, 4 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/tool/spec/codegen_java_types.dart
diff --git a/pkg/analysis_server/tool/spec/codegen_java_types.dart b/pkg/analysis_server/tool/spec/codegen_java_types.dart
index 6cbe5104b91eb394e915d32986d0d960b7cce110..5c90cea4110ede0a2e11114dd54b6311625de7a4 100644
--- a/pkg/analysis_server/tool/spec/codegen_java_types.dart
+++ b/pkg/analysis_server/tool/spec/codegen_java_types.dart
@@ -259,34 +259,39 @@ class CodegenJavaType extends CodegenJavaVisitor {
} else {
publicMethod('fromJson', () {
writeln(
- '''private Outline fromJson(Outline parent, JsonObject outlineObject) {
- JsonObject elementObject = outlineObject.get("element").getAsJsonObject();
- Element element = Element.fromJson(elementObject);
- int offset = outlineObject.get("offset").getAsInt();
- int length = outlineObject.get("length").getAsInt();
-
- // create outline object
- Outline outline = new Outline(parent, element, offset, length);
-
- // compute children recursively
- List<Outline> childrenList = Lists.newArrayList();
- JsonElement childrenJsonArray = outlineObject.get("children");
- if (childrenJsonArray instanceof JsonArray) {
- Iterator<JsonElement> childrenElementIterator = ((JsonArray) childrenJsonArray).iterator();
- while (childrenElementIterator.hasNext()) {
- JsonObject childObject = childrenElementIterator.next().getAsJsonObject();
- childrenList.add(fromJson(outline, childObject));
- }
+ '''public static Outline fromJson(Outline parent, JsonObject outlineObject) {
+ JsonObject elementObject = outlineObject.get("element").getAsJsonObject();
+ Element element = Element.fromJson(elementObject);
+ int offset = outlineObject.get("offset").getAsInt();
+ int length = outlineObject.get("length").getAsInt();
+
+ // create outline object
+ Outline outline = new Outline(parent, element, offset, length);
+
+ // compute children recursively
+ List<Outline> childrenList = Lists.newArrayList();
+ JsonElement childrenJsonArray = outlineObject.get("children");
+ if (childrenJsonArray instanceof JsonArray) {
+ Iterator<JsonElement> childrenElementIterator = ((JsonArray) childrenJsonArray).iterator();
+ while (childrenElementIterator.hasNext()) {
+ JsonObject childObject = childrenElementIterator.next().getAsJsonObject();
+ childrenList.add(fromJson(outline, childObject));
}
- outline.setChildren(childrenList);
- return outline;
- }''');
+ }
+ outline.setChildren(childrenList);
+ return outline;
+}''');
});
publicMethod('setChildren', () {
writeln('''public void setChildren(List<Outline> children) {
- this.children = children;
- }''');
+ this.children = children;
+}''');
});
+ publicMethod('getParent', () {
+ writeln('''public Outline getParent() {
+ return parent;
+}''');
+ });
}
//

Powered by Google App Engine
This is Rietveld 408576698