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

Unified Diff: pkg/analyzer/lib/src/generated/utilities_dart.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/generated/utilities_collection.dart ('k') | pkg/analyzer/test/enum_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/utilities_dart.dart
diff --git a/pkg/analyzer/lib/src/generated/utilities_dart.dart b/pkg/analyzer/lib/src/generated/utilities_dart.dart
index 3c0ab8d46cf377ae6251a90efad9f077edc61005..8dd40dffe09c8d33dafe3aa69bcb2e4ecc1705ac 100644
--- a/pkg/analyzer/lib/src/generated/utilities_dart.dart
+++ b/pkg/analyzer/lib/src/generated/utilities_dart.dart
@@ -8,7 +8,6 @@ import 'package:analyzer/dart/ast/ast.dart' show AnnotatedNode, Comment;
import 'package:analyzer/dart/ast/token.dart' show Token;
import 'package:analyzer/exception/exception.dart';
import 'package:analyzer/src/dart/element/element.dart' show ElementImpl;
-import 'package:analyzer/src/generated/java_core.dart';
import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/util/fast_uri.dart';
@@ -83,11 +82,11 @@ bool startsWith(Uri uri1, Uri uri2) {
}
/**
- * The enumeration `ParameterKind` defines the different kinds of parameters. There are two
- * basic kinds of parameters: required and optional. Optional parameters are further divided into
- * two kinds: positional optional and named optional.
+ * The kinds of a parameter. There are two basic kinds of parameters: required
+ * and optional. Optional parameters are further divided into two kinds:
+ * positional optional and named optional.
*/
-class ParameterKind extends Enum<ParameterKind> {
+class ParameterKind implements Comparable<ParameterKind> {
static const ParameterKind REQUIRED =
const ParameterKind('REQUIRED', 0, false);
@@ -99,15 +98,31 @@ class ParameterKind extends Enum<ParameterKind> {
static const List<ParameterKind> values = const [REQUIRED, POSITIONAL, NAMED];
/**
+ * The name of this parameter.
+ */
+ final String name;
+
+ /**
+ * The ordinal value of the parameter.
+ */
+ final int ordinal;
+
+ /**
* A flag indicating whether this is an optional parameter.
*/
final bool isOptional;
/**
* Initialize a newly created kind with the given state.
- *
- * @param isOptional `true` if this is an optional parameter
*/
- const ParameterKind(String name, int ordinal, this.isOptional)
- : super(name, ordinal);
+ const ParameterKind(this.name, this.ordinal, this.isOptional);
+
+ @override
+ int get hashCode => ordinal;
+
+ @override
+ int compareTo(ParameterKind other) => ordinal - other.ordinal;
+
+ @override
+ String toString() => name;
}
« no previous file with comments | « pkg/analyzer/lib/src/generated/utilities_collection.dart ('k') | pkg/analyzer/test/enum_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698