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

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

Issue 422573003: Implementation of the 'search.getTypeHierarchy' API. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 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/element.dart
diff --git a/pkg/analysis_server/lib/src/computer/element.dart b/pkg/analysis_server/lib/src/computer/element.dart
index fb9943a1a804b2880ab78a65b7bc44770e3a5398..4ccca7f8c1fbf66bbb78863d6687676da2873343 100644
--- a/pkg/analysis_server/lib/src/computer/element.dart
+++ b/pkg/analysis_server/lib/src/computer/element.dart
@@ -11,6 +11,14 @@ import 'package:analyzer/src/generated/utilities_dart.dart' as engine;
/**
+ * Returns a JSON correponding to the given Engine element.
+ */
+Map<String, Object> engineElementToJson(engine.Element element) {
+ return new Element.fromEngine(element).toJson();
+}
+
+
+/**
* Information about an element.
*/
class Element {
@@ -354,6 +362,15 @@ class Location {
startColumn);
}
+ factory Location.fromJson(Map<String, Object> map) {
+ return new Location(
+ map[FILE],
+ map[OFFSET],
+ map[LENGTH],
+ map[START_LINE],
+ map[START_COLUMN]);
+ }
+
factory Location.fromOffset(engine.Element element, int offset, int length) {
Source source = element.source;
LineInfo lineInfo = element.context.getLineInfo(source);
@@ -370,15 +387,6 @@ class Location {
startColumn);
}
- factory Location.fromJson(Map<String, Object> map) {
- return new Location(
- map[FILE],
- map[OFFSET],
- map[LENGTH],
- map[START_LINE],
- map[START_COLUMN]);
- }
-
Map<String, Object> toJson() {
return {
FILE: file,
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/constants.dart » ('j') | pkg/analysis_server/lib/src/search/type_hierarchy.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698