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

Unified Diff: tests/language/propagate_past_constant_test.dart

Issue 918653002: Propagate pseudo-constants expressions separately in tree rewriter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Comment, bugfix, and test case Created 5 years, 10 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
Index: tests/language/propagate_past_constant_test.dart
diff --git a/tests/language/regress_21998_1_test.dart b/tests/language/propagate_past_constant_test.dart
similarity index 56%
copy from tests/language/regress_21998_1_test.dart
copy to tests/language/propagate_past_constant_test.dart
index 3237f3396629f6fd11270e1adc290bec78713958..dcb30eb74b2f3dfb4fa894030b0d59bd150e505b 100644
--- a/tests/language/regress_21998_1_test.dart
+++ b/tests/language/propagate_past_constant_test.dart
@@ -2,17 +2,19 @@
// 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 'dart:math' as Math;
import 'package:expect/expect.dart';
-main() {
- Expect.equals(4, new C().m());
-}
+foo(x) => x;
-class C {
- max(a) => a;
+check(y) {
+ Expect.equals('foo', y);
+}
- m() {
- return max(Math.max(2, 4));
- }
-}
+main() {
+ var x = foo('foo');
+ var y = foo(x);
+ x = 'constant';
+ check(y); // 'y' should not propagate here unless reference to 'x' is rewritten
+ foo(x);
+ foo(x);
+}

Powered by Google App Engine
This is Rietveld 408576698