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>
18 lines
678 B
Plaintext
18 lines
678 B
Plaintext
library;
|
|
import self as self;
|
|
import "dart:core" as core;
|
|
|
|
class Foo extends core::Object {
|
|
final field core::int index;
|
|
final field core::String _name;
|
|
static const field core::List<self::Foo> values = const <self::Foo>[self::Foo::ec1, self::Foo::ec2];
|
|
static const field self::Foo ec1 = const self::Foo::•(0, "Foo.ec1");
|
|
static const field self::Foo ec2 = const self::Foo::•(1, "Foo.ec2");
|
|
const constructor •(core::int index, core::String _name) → void
|
|
: self::Foo::index = index, self::Foo::_name = _name, super core::Object::•()
|
|
;
|
|
method toString() → core::String
|
|
return this.{=self::Foo::_name};
|
|
}
|
|
static method main() → dynamic {}
|