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

Unified Diff: pkg/kernel/testcases/closures/blocks.dart

Issue 3000333002: Fix several bugs in closure conversion. (Closed)
Patch Set: Comments. Created 3 years, 4 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/kernel/testcases/closures/blocks.dart
diff --git a/pkg/kernel/testcases/closures/blocks.dart b/pkg/kernel/testcases/closures/blocks.dart
new file mode 100644
index 0000000000000000000000000000000000000000..82e7fe60f5f980f994dce457d17f8bb705e1b5b6
--- /dev/null
+++ b/pkg/kernel/testcases/closures/blocks.dart
@@ -0,0 +1,52 @@
+// Copyright (c) 2017, 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.
+//
+// This test checks that we don't create duplicate local contexts in the same
+// function. It's modeled after the 'startIsolateMock' function which was broken
+// in the standard library.
+class X {}
+
+typedef dynamic fn(dynamic x);
+typedef dynamic fn2(dynamic x, dynamic y);
+
+void startIsolateMock(
+ dynamic parentPort,
+ dynamic entryPoint,
+ dynamic args,
+ dynamic message,
+ dynamic isSpawnUri,
+ dynamic controlPort,
+ List<dynamic> capabilities) {
+ if (controlPort != null) {
+ controlPort.handler = (dynamic _) {};
+ }
+ if (parentPort != null) {
+ dynamic readyMessage = new List<dynamic>(2);
+ readyMessage[0] = controlPort.sendPort;
+ readyMessage[1] = capabilities;
+ capabilities = null;
+ parentPort.send(readyMessage);
+ }
+ assert(capabilities == null);
+ dynamic port = "abc";
+ port.handler = (dynamic _) {
+ port.close();
+ if (isSpawnUri) {
+ if (entryPoint is fn2) {
+ entryPoint.call(args, message);
+ } else if (entryPoint is fn) {
+ entryPoint.call(args);
+ } else {
+ entryPoint.call();
+ }
+ } else {
+ entryPoint.call(message);
+ }
+ };
+ port.sendPort.send(null);
+}
+
+main() {
+ // No code here -- we just check that duplicate contexts aren't created above.
+}
« 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