031a7ffe41
Dart2JS and the VM prefer for Enum names to be stored inline in the Enum object to avoid having the static array of all Enum values. A base class for Enums is provided to avoid repeating the common fields and accessors between Enum definitions. Bug: Change-Id: I783f863015b45f13317fda06e627d14844fe2ddf Reviewed-on: https://dart-review.googlesource.com/16526 Reviewed-by: Johnni Winther <johnniwinther@google.com> Reviewed-by: Vyacheslav Egorov <vegorov@google.com> Reviewed-by: Peter von der Ahé <ahe@google.com>
21 lines
768 B
Plaintext
21 lines
768 B
Plaintext
library;
|
|
import self as self;
|
|
import "dart:core" as core;
|
|
|
|
@self::a
|
|
class E extends core::Object {
|
|
final field core::int index;
|
|
final field core::String _name;
|
|
static const field core::List<self::E> values = const <self::E>[self::E::E1, self::E::E2, self::E::E3];
|
|
static const field self::E E1 = const self::E::•(0, "E.E1");
|
|
static const field self::E E2 = const self::E::•(1, "E.E2");
|
|
static const field self::E E3 = const self::E::•(2, "E.E3");
|
|
const constructor •(core::int index, core::String _name) → void
|
|
: self::E::index = index, self::E::_name = _name, super core::Object::•()
|
|
;
|
|
method toString() → core::String
|
|
return this.{=self::E::_name};
|
|
}
|
|
static const field dynamic a = null;
|
|
static method main() → dynamic {}
|