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

Unified Diff: tests/compiler/dart2js/map_tracer_const_test.dart

Issue 223403003: Use closure tracer to identify closures that are not passed to Function.apply (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fixed issue with failing test Created 6 years, 8 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 | « sdk/lib/_internal/compiler/implementation/world.dart ('k') | tests/compiler/dart2js/mock_compiler.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/map_tracer_const_test.dart
diff --git a/tests/compiler/dart2js/map_tracer_const_test.dart b/tests/compiler/dart2js/map_tracer_const_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..8389de61ff990192df74dcf21511c6e8053b8776
--- /dev/null
+++ b/tests/compiler/dart2js/map_tracer_const_test.dart
@@ -0,0 +1,43 @@
+// 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.
+
+import 'package:expect/expect.dart';
+import "package:async_helper/async_helper.dart";
+
+import 'compiler_helper.dart';
+import 'type_mask_test_helper.dart';
+
+const String TEST = '''
+int closure(int x) {
+ return x;
+}
+
+class A {
+ static const DEFAULT = const {'fun' : closure};
+
+ final map;
+
+ A([maparg]) : map = maparg == null ? DEFAULT : maparg;
+}
+
+main() {
+ var a = new A();
+ a.map['fun'](3.3);
+ print(closure(22));
+}
+''';
+
+void main() {
+ Uri uri = new Uri(scheme: 'source');
+ var compiler = compilerFor(TEST, uri,
+ expectedErrors: 0, expectedWarnings: 0);
+ compiler.stopAfterTypeInference = true;
+ asyncTest(() => compiler.runCompiler(uri).then((_) {
+ var typesTask = compiler.typesTask;
+ var typesInferrer = typesTask.typesInferrer;
+ var element = findElement(compiler, 'closure');
+ var mask = typesInferrer.getReturnTypeOfElement(element);
+ Expect.equals(typesTask.numType, simplify(mask, compiler));
+ }));
+}
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/world.dart ('k') | tests/compiler/dart2js/mock_compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698