| Index: tests/isolate/function_send1_test.dart
|
| diff --git a/tests/isolate/function_send1_test.dart b/tests/isolate/function_send1_test.dart
|
| index 073ed763ed59ccf34b25f84fd966167c9a45039b..b1a9aea757afb74d7666ad381dc3130f8ff0540b 100644
|
| --- a/tests/isolate/function_send1_test.dart
|
| +++ b/tests/isolate/function_send1_test.dart
|
| @@ -7,26 +7,50 @@ import "dart:async";
|
| import "package:expect/expect.dart";
|
| import "package:async_helper/async_helper.dart";
|
|
|
| -void toplevel(port, message) { port.send("toplevel:$message"); }
|
| -Function createFuncToplevel() => (p, m) { p.send(m); };
|
| +void toplevel(port, message) {
|
| + port.send("toplevel:$message");
|
| +}
|
| +
|
| +Function createFuncToplevel() => (p, m) {
|
| + p.send(m);
|
| + };
|
| +
|
| class C {
|
| Function initializer;
|
| Function body;
|
| - C() : initializer = ((p, m) { throw "initializer"; }) {
|
| - body = (p, m) { throw "body"; };
|
| + C()
|
| + : initializer = ((p, m) {
|
| + throw "initializer";
|
| + }) {
|
| + body = (p, m) {
|
| + throw "body";
|
| + };
|
| + }
|
| + static void staticFunc(port, message) {
|
| + port.send("static:$message");
|
| + }
|
| +
|
| + static Function createFuncStatic() => (p, m) {
|
| + throw "static expr";
|
| + };
|
| + void instanceMethod(p, m) {
|
| + throw "instanceMethod";
|
| + }
|
| +
|
| + Function createFuncMember() => (p, m) {
|
| + throw "instance expr";
|
| + };
|
| + void call(n, p) {
|
| + throw "C";
|
| }
|
| - static void staticFunc(port, message) { port.send("static:$message"); }
|
| - static Function createFuncStatic() => (p, m) { throw "static expr"; };
|
| - void instanceMethod(p, m) { throw "instanceMethod"; }
|
| - Function createFuncMember() => (p, m) { throw "instance expr"; };
|
| - void call(n, p) { throw "C"; }
|
| }
|
|
|
| class Callable {
|
| - void call(p, m) { p.send(["callable", m]); }
|
| + void call(p, m) {
|
| + p.send(["callable", m]);
|
| + }
|
| }
|
|
|
| -
|
| void main() {
|
| asyncStart();
|
|
|
| @@ -54,7 +78,10 @@ void main() {
|
| // Pass the message to `callback` and return the sendPort.
|
| SendPort singleMessagePort(callback) {
|
| var p;
|
| - p = new RawReceivePort((v) { p.close(); callback(v); });
|
| + p = new RawReceivePort((v) {
|
| + p.close();
|
| + callback(v);
|
| + });
|
| return p.sendPort;
|
| }
|
|
|
| @@ -77,8 +104,8 @@ Future<SendPort> echoPort(callback(value)) {
|
| completer.complete(p);
|
| initPort.close();
|
| });
|
| - return Isolate.spawn(_echo, [replyPort, initPort.sendPort])
|
| - .then((isolate) => completer.future);
|
| + return Isolate.spawn(_echo, [replyPort, initPort.sendPort]).then(
|
| + (isolate) => completer.future);
|
| }
|
|
|
| void _echo(msg) {
|
| @@ -86,7 +113,7 @@ void _echo(msg) {
|
| RawReceivePort requestPort;
|
| requestPort = new RawReceivePort((msg) {
|
| replyPort.send(msg);
|
| - requestPort.close(); // Single echo only.
|
| + requestPort.close(); // Single echo only.
|
| });
|
| msg[1].send(requestPort.sendPort);
|
| }
|
| @@ -96,8 +123,7 @@ void _echo(msg) {
|
| Future<SendPort> callPort() {
|
| Completer completer = new Completer<SendPort>();
|
| SendPort initPort = singleMessagePort(completer.complete);
|
| - return Isolate.spawn(_call, initPort)
|
| - .then((_) => completer.future);
|
| + return Isolate.spawn(_call, initPort).then((_) => completer.future);
|
| }
|
|
|
| void _call(initPort) {
|
| @@ -106,11 +132,16 @@ void _call(initPort) {
|
|
|
| void testUnsendable(name, func) {
|
| asyncStart();
|
| - Isolate.spawnUri(Uri.parse("function_send_test.dart"), [], func)
|
| - .then((v) => throw "allowed spawn direct?", onError: (e,s){ asyncEnd(); });
|
| + Isolate
|
| + .spawnUri(Uri.parse("function_send_test.dart"), [], func)
|
| + .then((v) => throw "allowed spawn direct?", onError: (e, s) {
|
| + asyncEnd();
|
| + });
|
| asyncStart();
|
| - Isolate.spawnUri(Uri.parse("function_send_test.dart"), [], [func])
|
| - .then((v) => throw "allowed spawn wrapped?", onError: (e,s){ asyncEnd(); });
|
| + Isolate.spawnUri(Uri.parse("function_send_test.dart"), [], [func]).then(
|
| + (v) => throw "allowed spawn wrapped?", onError: (e, s) {
|
| + asyncEnd();
|
| + });
|
| }
|
|
|
| void callFunc(message) {
|
|
|