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

Unified Diff: tests/language/if_and_test.dart

Issue 10669035: Don't lose the expected precedence during && compilation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments Created 8 years, 6 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/if_and_test.dart
diff --git a/tests/language/if_and_test.dart b/tests/language/if_and_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..75b5b91169570f3a3b5dc176b0e59a2f5fecb48d
--- /dev/null
+++ b/tests/language/if_and_test.dart
@@ -0,0 +1,31 @@
+// Copyright (c) 2012, 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.
+
+// The "if (negative) res2 |= 3" below can be emitted as negative && (res2 |= 3)
+// in JavaScript. Dart2js produced the wrong output.
+
+_shiftRight(x, y) => x;
+int64_bits(x) => x;
+
+class A {
+ opshr(int n, a2) {
+ int res2;
+ bool negative = a2 === 496;
+
+ res2 = _shiftRight(a2, n);
+ if (negative) {
+ res2 |= 3;
+ }
+ return int64_bits(res2);
+ }
+}
+
+main() {
+ var a = new A();
+ var t;
+ for (int i = 0; i < 3; i++) {
+ t = a.opshr(99, 496);
+ }
+ Expect.equals(499, t);
+}
« lib/compiler/implementation/ssa/codegen.dart ('K') | « lib/compiler/implementation/ssa/codegen.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698