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

Unified Diff: pkg/analyzer/lib/src/generated/engine.dart

Issue 2365553004: Convert subclasses of Enum (Closed)
Patch Set: Created 4 years, 3 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/analyzer/lib/src/dart/element/element.dart ('k') | pkg/analyzer/lib/src/generated/java_core.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/engine.dart
diff --git a/pkg/analyzer/lib/src/generated/engine.dart b/pkg/analyzer/lib/src/generated/engine.dart
index e890d38dfb2b1dd780e6028c3bf670c31a5dff46..a5ffe6a1d6c02dd5d978d914658d39c6c7d210e0 100644
--- a/pkg/analyzer/lib/src/generated/engine.dart
+++ b/pkg/analyzer/lib/src/generated/engine.dart
@@ -950,19 +950,21 @@ class AnalysisErrorInfoImpl implements AnalysisErrorInfo {
/**
* The levels at which a source can be analyzed.
*/
-class AnalysisLevel extends Enum<AnalysisLevel> {
+class AnalysisLevel implements Comparable<AnalysisLevel> {
/**
* Indicates a source should be fully analyzed.
*/
static const AnalysisLevel ALL = const AnalysisLevel('ALL', 0);
/**
- * Indicates a source should be resolved and that errors, warnings and hints are needed.
+ * Indicates a source should be resolved and that errors, warnings and hints
+ * are needed.
*/
static const AnalysisLevel ERRORS = const AnalysisLevel('ERRORS', 1);
/**
- * Indicates a source should be resolved, but that errors, warnings and hints are not needed.
+ * Indicates a source should be resolved, but that errors, warnings and hints
+ * are not needed.
*/
static const AnalysisLevel RESOLVED = const AnalysisLevel('RESOLVED', 2);
@@ -973,7 +975,26 @@ class AnalysisLevel extends Enum<AnalysisLevel> {
static const List<AnalysisLevel> values = const [ALL, ERRORS, RESOLVED, NONE];
- const AnalysisLevel(String name, int ordinal) : super(name, ordinal);
+ /**
+ * The name of this analysis level.
+ */
+ final String name;
+
+ /**
+ * The ordinal value of the analysis level.
+ */
+ final int ordinal;
+
+ const AnalysisLevel(this.name, this.ordinal);
+
+ @override
+ int get hashCode => ordinal;
+
+ @override
+ int compareTo(AnalysisLevel other) => ordinal - other.ordinal;
+
+ @override
+ String toString() => name;
}
/**
@@ -1229,13 +1250,6 @@ class AnalysisOptionsImpl implements AnalysisOptions {
@override
bool enableAssertMessage = false;
- @deprecated
- @override
- bool get enableAsync => true;
-
- @deprecated
- void set enableAsync(bool enable) {}
-
@override
bool enableGenericMethods = false;
@@ -1391,6 +1405,13 @@ class AnalysisOptionsImpl implements AnalysisOptions {
_analyzeFunctionBodiesPredicate = value;
}
+ @deprecated
+ @override
+ bool get enableAsync => true;
+
+ @deprecated
+ void set enableAsync(bool enable) {}
+
/**
* A flag indicating whether interface libraries are to be supported (DEP 40).
*/
@@ -1578,7 +1599,7 @@ abstract class CacheConsistencyValidator {
/**
* The possible states of cached data.
*/
-class CacheState extends Enum<CacheState> {
+class CacheState implements Comparable<CacheState> {
/**
* The data is not in the cache and the last time an attempt was made to
* compute the data an exception occurred, making it pointless to attempt to
@@ -1639,7 +1660,26 @@ class CacheState extends Enum<CacheState> {
VALID
];
- const CacheState(String name, int ordinal) : super(name, ordinal);
+ /**
+ * The name of this cache state.
+ */
+ final String name;
+
+ /**
+ * The ordinal value of the cache state.
+ */
+ final int ordinal;
+
+ const CacheState(this.name, this.ordinal);
+
+ @override
+ int get hashCode => ordinal;
+
+ @override
+ int compareTo(CacheState other) => ordinal - other.ordinal;
+
+ @override
+ String toString() => name;
}
/**
« no previous file with comments | « pkg/analyzer/lib/src/dart/element/element.dart ('k') | pkg/analyzer/lib/src/generated/java_core.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698