d73d6de73d
Make enum classes implement hashCode, rather than use the identity hash code, so that they can be portably serialized. BUG=dart:21675 R=asiva@google.com, lrn@google.com Review URL: https://codereview.chromium.org//752123003 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44278 260f80e4-7a28-3924-810f-c04153c831b5
28 lines
657 B
Dart
28 lines
657 B
Dart
// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
// SharedOptions=--enable-enum
|
|
|
|
import 'package:expect/expect.dart';
|
|
import "dart:isolate";
|
|
|
|
enum Foo { BAR, BAZ }
|
|
|
|
main() {
|
|
var p;
|
|
p = new RawReceivePort((map) {
|
|
Expect.equals(1, map.keys.length);
|
|
Expect.equals(42, map.values.first);
|
|
var key = map.keys.first;
|
|
Expect.equals(42, map[key]);
|
|
p.close();
|
|
});
|
|
Isolate.spawn(sendIt, p.sendPort);
|
|
}
|
|
|
|
void sendIt(port) {
|
|
var map = { Foo.BAR: 42 };
|
|
port.send(map);
|
|
}
|