Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Side by Side Diff: pkg/kernel/testcases/closures/blocks.dart

Issue 3000333002: Fix several bugs in closure conversion. (Closed)
Patch Set: Comments. Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
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.
4 //
5 // This test checks that we don't create duplicate local contexts in the same
6 // function. It's modeled after the 'startIsolateMock' function which was broken
7 // in the standard library.
8 class X {}
9
10 typedef dynamic fn(dynamic x);
11 typedef dynamic fn2(dynamic x, dynamic y);
12
13 void startIsolateMock(
14 dynamic parentPort,
15 dynamic entryPoint,
16 dynamic args,
17 dynamic message,
18 dynamic isSpawnUri,
19 dynamic controlPort,
20 List<dynamic> capabilities) {
21 if (controlPort != null) {
22 controlPort.handler = (dynamic _) {};
23 }
24 if (parentPort != null) {
25 dynamic readyMessage = new List<dynamic>(2);
26 readyMessage[0] = controlPort.sendPort;
27 readyMessage[1] = capabilities;
28 capabilities = null;
29 parentPort.send(readyMessage);
30 }
31 assert(capabilities == null);
32 dynamic port = "abc";
33 port.handler = (dynamic _) {
34 port.close();
35 if (isSpawnUri) {
36 if (entryPoint is fn2) {
37 entryPoint.call(args, message);
38 } else if (entryPoint is fn) {
39 entryPoint.call(args);
40 } else {
41 entryPoint.call();
42 }
43 } else {
44 entryPoint.call(message);
45 }
46 };
47 port.sendPort.send(null);
48 }
49
50 main() {
51 // No code here -- we just check that duplicate contexts aren't created above.
52 }
OLDNEW
« no previous file with comments | « pkg/kernel/testcases/closures/arity.dart.expect ('k') | pkg/kernel/testcases/closures/blocks.dart.expect » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698