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

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

Issue 1310483004: Redo "Inline single-use local closures." (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: test updates Created 5 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/compiler/lib/src/cps_ir/type_propagation.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/js_backend_cps_ir_closures_test.dart
diff --git a/tests/compiler/dart2js/js_backend_cps_ir_closures_test.dart b/tests/compiler/dart2js/js_backend_cps_ir_closures_test.dart
index f5345c0d59d9de885be67abafb1e3c2b5b18cc31..9c6d44e3a587ab47be80a7bd696dc9b5001149b7 100644
--- a/tests/compiler/dart2js/js_backend_cps_ir_closures_test.dart
+++ b/tests/compiler/dart2js/js_backend_cps_ir_closures_test.dart
@@ -23,7 +23,26 @@ function(x) {
var _box_0 = {};
_box_0._captured_x_0 = x;
_box_0._captured_x_0 = J.getInterceptor$ns(x = _box_0._captured_x_0).$add(x, "1");
- P.print(new V.main_a(_box_0).call$0());
+ P.print(new V.main_a(_box_0)._box_0._captured_x_0);
+}"""),
+
+ const TestEntry("""
+main(x) {
+ a() {
+ return x;
+ }
+ x = x + '1';
+ print(a());
+ return a;
+}
+""",
+r"""
+function(x) {
+ var _box_0 = {}, a = new V.main_a(_box_0);
+ _box_0._captured_x_0 = x;
+ _box_0._captured_x_0 = J.getInterceptor$ns(x = _box_0._captured_x_0).$add(x, "1");
+ P.print(a.call$0());
+ return a;
}"""),
const TestEntry("""
@@ -36,7 +55,23 @@ main(x) {
""",
r"""
function(x) {
- P.print(new V.main_a(x).call$0());
+ P.print(new V.main_a(x)._captured_x_0);
+}"""),
+
+ const TestEntry("""
+main(x) {
+ a() {
+ return x;
+ }
+ print(a());
+ return a;
+}
+""",
+r"""
+function(x) {
+ var a = new V.main_a(x);
+ P.print(a.call$0());
+ return a;
}"""),
const TestEntry("""
@@ -52,7 +87,25 @@ function() {
var _box_0 = {};
_box_0._captured_x_0 = 122;
_box_0._captured_x_0 = _box_0._captured_x_0 + 1;
- P.print(new V.main_closure(_box_0).call$0());
+ P.print(new V.main_closure(_box_0)._box_0._captured_x_0);
+}"""),
+
+ const TestEntry("""
+main() {
+ var x = 122;
+ var a = () => x;
+ x = x + 1;
+ print(a());
+ return a;
+}
+""",
+r"""
+function() {
+ var _box_0 = {}, a = new V.main_closure(_box_0);
+ _box_0._captured_x_0 = 122;
+ _box_0._captured_x_0 = _box_0._captured_x_0 + 1;
+ P.print(a.call$0());
+ return a;
}"""),
const TestEntry("""
@@ -71,7 +124,28 @@ function() {
var _box_0 = {};
_box_0._captured_x_0 = 122;
_box_0._captured_x_0 = _box_0._captured_x_0 + 1;
- P.print(new V.main_closure(_box_0).call$0().call$0());
+ P.print(new V.main__closure(new V.main_closure(_box_0)._box_0._captured_x_0)._captured_y_1);
+}"""),
+
+ const TestEntry("""
+main() {
+ var x = 122;
+ var a = () {
+ var y = x;
+ return () => y;
+ };
+ x = x + 1;
+ print(a()());
+ return a;
+}
+""",
+r"""
+function() {
+ var _box_0 = {}, a = new V.main_closure(_box_0);
+ _box_0._captured_x_0 = 122;
+ _box_0._captured_x_0 = _box_0._captured_x_0 + 1;
+ P.print(a.call$0().call$0());
+ return a;
}"""),
const TestEntry("""
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/type_propagation.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698