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

Unified Diff: pkg/analysis_server/lib/src/generated_protocol.dart

Issue 492243002: Introduce convenience methods into generated analysis server classes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
« no previous file with comments | « pkg/analysis_server/lib/src/edit/edit_domain.dart ('k') | pkg/analysis_server/lib/src/protocol2.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/generated_protocol.dart
diff --git a/pkg/analysis_server/lib/src/generated_protocol.dart b/pkg/analysis_server/lib/src/generated_protocol.dart
index f1999892502767db41bab0673a09ea58d8a9b826..400856e77103e5aed56900625236634566a61c4d 100644
--- a/pkg/analysis_server/lib/src/generated_protocol.dart
+++ b/pkg/analysis_server/lib/src/generated_protocol.dart
@@ -4012,6 +4012,12 @@ class AnalysisError implements HasToJson {
}
}
+ /**
+ * Construct based on error information from the analyzer engine.
+ */
+ factory AnalysisError.fromEngine(engine.LineInfo lineInfo, engine.AnalysisError error) =>
+ _analysisErrorFromEngine(lineInfo, error);
+
Map<String, dynamic> toJson() {
Map<String, dynamic> result = {};
result["severity"] = severity.toJson();
@@ -4922,6 +4928,24 @@ class DebugService {
* }
*/
class Element implements HasToJson {
+ static const int FLAG_ABSTRACT = 0x01;
+ static const int FLAG_CONST = 0x02;
+ static const int FLAG_FINAL = 0x04;
+ static const int FLAG_STATIC = 0x08;
+ static const int FLAG_PRIVATE = 0x10;
+ static const int FLAG_DEPRECATED = 0x20;
+
+ static int makeFlags({isAbstract: false, isConst: false, isFinal: false, isStatic: false, isPrivate: false, isDeprecated: false}) {
+ int flags = 0;
+ if (isAbstract) flags |= FLAG_ABSTRACT;
+ if (isConst) flags |= FLAG_CONST;
+ if (isFinal) flags |= FLAG_FINAL;
+ if (isStatic) flags |= FLAG_STATIC;
+ if (isPrivate) flags |= FLAG_PRIVATE;
+ if (isDeprecated) flags |= FLAG_DEPRECATED;
+ return flags;
+ }
+
/**
* The kind of the element.
*/
@@ -5008,6 +5032,13 @@ class Element implements HasToJson {
}
}
+ bool get isAbstract => (flags & FLAG_ABSTRACT) != 0;
+ bool get isConst => (flags & FLAG_CONST) != 0;
+ bool get isFinal => (flags & FLAG_FINAL) != 0;
+ bool get isStatic => (flags & FLAG_STATIC) != 0;
+ bool get isPrivate => (flags & FLAG_PRIVATE) != 0;
+ bool get isDeprecated => (flags & FLAG_DEPRECATED) != 0;
+
Map<String, dynamic> toJson() {
Map<String, dynamic> result = {};
result["kind"] = kind.toJson();
@@ -5172,6 +5203,12 @@ class ElementKind {
throw jsonDecoder.mismatch(jsonPath, "ElementKind");
}
+ /**
+ * Construct based on a value from the analyzer engine.
+ */
+ factory ElementKind.fromEngine(engine.ElementKind kind) =>
+ _elementKindFromEngine(kind);
+
@override
String toString() => "ElementKind.$name";
@@ -7867,6 +7904,13 @@ class SourceChange implements HasToJson {
*/
class SourceEdit implements HasToJson {
/**
+ * Get the result of applying a set of [edits] to the given [code]. Edits are
+ * applied in the order they appear in [edits].
+ */
+ static String applySequence(String code, Iterable<SourceEdit> edits) =>
+ _applySequence(code, edits);
+
+ /**
* The offset of the region to be modified.
*/
int offset;
@@ -7928,6 +7972,17 @@ class SourceEdit implements HasToJson {
}
}
+ /**
+ * Construct based on a SourceRange.
+ */
+ SourceEdit.range(engine.SourceRange range, String replacement, {String id})
+ : this(range.offset, range.length, replacement, id: id);
+
+ /**
+ * The end of the region to be modified.
+ */
+ int get end => offset + length;
+
Map<String, dynamic> toJson() {
Map<String, dynamic> result = {};
result["offset"] = offset;
@@ -7939,6 +7994,11 @@ class SourceEdit implements HasToJson {
return result;
}
+ /**
+ * Get the result of applying the edit to the given [code].
+ */
+ String apply(String code) => _applyEdit(code, this);
+
@override
String toString() => JSON.encode(toJson());
« no previous file with comments | « pkg/analysis_server/lib/src/edit/edit_domain.dart ('k') | pkg/analysis_server/lib/src/protocol2.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698