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

Unified Diff: tests/language/compound_assignment_operator_test.dart

Issue 10270028: Fix wrong order of execution in compound assignment nodes (located by Kevin). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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
« runtime/vm/parser.cc ('K') | « runtime/vm/parser.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/compound_assignment_operator_test.dart
===================================================================
--- tests/language/compound_assignment_operator_test.dart (revision 7165)
+++ tests/language/compound_assignment_operator_test.dart (working copy)
@@ -17,6 +17,14 @@
var _f;
}
+var result;
+
+class A {
+ get field() { result.add(1); return 1; }
+ set field(value) {}
+}
+
+
class CompoundAssignmentOperatorTest {
static void testIndexed() {
@@ -37,11 +45,37 @@
indexed[3][i++] += 1;
Expect.equals(1, i);
}
+
+
+ static testIndexedMore() {
+ result = [];
+ array() { result.add(0); return [0]; }
+ index() { result.add(1); return 0; }
+ middle() { result.add(2); }
+ sequence(a, b, c) { result.add(3); }
+ sequence(array()[index()] += 1, middle(), array()[index()] += 1);
+ Expect.listEquals([0, 1, 2, 0, 1, 3], result);
+ }
+
+ static testIndexedMoreMore() {
+ result = [];
+ middle() { result.add(2); }
+ obj() { result.add(0); return new A(); }
+ sequence(a, b, c) { result.add(3); }
+
+ sequence(obj().field += 1, middle(), obj().field += 1);
+ Expect.listEquals([0, 1, 2, 0, 1, 3], result);
+ }
+
+
static void testMain() {
testIndexed();
+ testIndexedMore();
+ testIndexedMoreMore();
}
}
+
main() {
CompoundAssignmentOperatorTest.testMain();
}
« runtime/vm/parser.cc ('K') | « runtime/vm/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698