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

Unified Diff: pkg/analyzer/lib/src/dart/element/element.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/error/error.dart ('k') | pkg/analyzer/lib/src/generated/engine.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/dart/element/element.dart
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index 5d70df8c45ec1ec15a4f8384af627469031b6858..37120461b8efef10d0faf164384c8e8105884641 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -21,7 +21,6 @@ import 'package:analyzer/src/error/codes.dart' show CompileTimeErrorCode;
import 'package:analyzer/src/generated/constant.dart' show EvaluationResultImpl;
import 'package:analyzer/src/generated/engine.dart'
show AnalysisContext, AnalysisEngine;
-import 'package:analyzer/src/generated/java_core.dart';
import 'package:analyzer/src/generated/java_engine.dart';
import 'package:analyzer/src/generated/resolver.dart';
import 'package:analyzer/src/generated/sdk.dart' show DartSdk;
@@ -3074,7 +3073,7 @@ abstract class ElementImpl implements Element {
* Return `true` if this element has the given [modifier] associated with it.
*/
bool hasModifier(Modifier modifier) =>
- BooleanArray.getEnum(_modifiers, modifier);
+ BooleanArray.get(_modifiers, modifier.ordinal);
@override
bool isAccessibleIn(LibraryElement library) {
@@ -3109,7 +3108,7 @@ abstract class ElementImpl implements Element {
* correspond to the given [value].
*/
void setModifier(Modifier modifier, bool value) {
- _modifiers = BooleanArray.setEnum(_modifiers, modifier, value);
+ _modifiers = BooleanArray.set(_modifiers, modifier.ordinal, value);
}
@override
@@ -6179,12 +6178,12 @@ class MethodElementImpl extends ExecutableElementImpl implements MethodElement {
}
/**
- * The enumeration `Modifier` defines constants for all of the modifiers defined
- * by the Dart language and for a few additional flags that are useful.
+ * The constants for all of the modifiers defined by the Dart language and for a
+ * few additional flags that are useful.
*
* Clients may not extend, implement or mix-in this class.
*/
-class Modifier extends Enum<Modifier> {
+class Modifier implements Comparable<Modifier> {
/**
* Indicates that the modifier 'abstract' was applied to the element.
*/
@@ -6301,7 +6300,26 @@ class Modifier extends Enum<Modifier> {
SYNTHETIC
];
- const Modifier(String name, int ordinal) : super(name, ordinal);
+ /**
+ * The name of this modifier.
+ */
+ final String name;
+
+ /**
+ * The ordinal value of the modifier.
+ */
+ final int ordinal;
+
+ const Modifier(this.name, this.ordinal);
+
+ @override
+ int get hashCode => ordinal;
+
+ @override
+ int compareTo(Modifier other) => ordinal - other.ordinal;
+
+ @override
+ String toString() => name;
}
/**
« no previous file with comments | « pkg/analyzer/lib/error/error.dart ('k') | pkg/analyzer/lib/src/generated/engine.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698