OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import "dart:isolate"; | 5 import "dart:isolate"; |
6 import "dart:async"; | 6 import "dart:async"; |
7 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
8 import "package:async_helper/async_helper.dart"; | 8 import "package:async_helper/async_helper.dart"; |
9 | 9 |
10 void toplevel(port, message) { | 10 void toplevel(port, message) { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 testUnsendable("instance method", c.instanceMethod); | 62 testUnsendable("instance method", c.instanceMethod); |
63 testUnsendable("static context expression", createFuncToplevel()); | 63 testUnsendable("static context expression", createFuncToplevel()); |
64 testUnsendable("static context expression", C.createFuncStatic()); | 64 testUnsendable("static context expression", C.createFuncStatic()); |
65 testUnsendable("initializer context expression", c.initializer); | 65 testUnsendable("initializer context expression", c.initializer); |
66 testUnsendable("constructor context expression", c.body); | 66 testUnsendable("constructor context expression", c.body); |
67 testUnsendable("instance method context expression", c.createFuncMember()); | 67 testUnsendable("instance method context expression", c.createFuncMember()); |
68 | 68 |
69 // The result of `toplevel.call` and `staticFunc.call` may or may not be | 69 // The result of `toplevel.call` and `staticFunc.call` may or may not be |
70 // identical to `toplevel` and `staticFunc` respectively. If they are not | 70 // identical to `toplevel` and `staticFunc` respectively. If they are not |
71 // equal, they may or may not be considered toplevel/static functions anyway, | 71 // equal, they may or may not be considered toplevel/static functions anyway, |
72 // and therefore sendable. The VM and dart2js curretnly disagrees on whether | 72 // and therefore sendable. The VM and dart2js currently disagree on whether |
73 // `toplevel` and `toplevel.call` are identical, both allow them to be sent. | 73 // `toplevel` and `toplevel.call` are identical, both allow them to be sent. |
74 // If this is ever specified to something else, use: | 74 // If this is ever specified to something else, use: |
75 // testUnsendable("toplevel.call", toplevel.call); | 75 // testUnsendable("toplevel.call", toplevel.call); |
76 // testUnsendable("static.call", C.staticFunc.call); | 76 // testUnsendable("static.call", C.staticFunc.call); |
77 // instead. | 77 // instead. |
78 // These two tests should be considered canaries for accidental behavior | 78 // These two tests should be considered canaries for accidental behavior |
79 // change rather than requirements. | 79 // change rather than requirements. |
80 testSendable("toplevel", toplevel.call); | 80 testSendable("toplevel", toplevel.call); |
81 testSendable("static", C.staticFunc.call); | 81 testSendable("static", C.staticFunc.call); |
82 | 82 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 }).then((p) => throw "unreachable 2", onError: (e, s) { | 211 }).then((p) => throw "unreachable 2", onError: (e, s) { |
212 asyncEnd(); | 212 asyncEnd(); |
213 }); | 213 }); |
214 } | 214 } |
215 | 215 |
216 void nop(_) {} | 216 void nop(_) {} |
217 | 217 |
218 void callFunc(message) { | 218 void callFunc(message) { |
219 message[0](message[1], message[2]); | 219 message[0](message[1], message[2]); |
220 } | 220 } |
OLD | NEW |