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

Unified Diff: test/codegen/opassign.dart

Issue 1069493002: implement opassign, fix bugs in pre/postfix, introduce a let* helper (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 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
« test/codegen/expect/cascade.js ('K') | « test/codegen/expect/opassign.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/codegen/opassign.dart
diff --git a/test/codegen/opassign.dart b/test/codegen/opassign.dart
new file mode 100644
index 0000000000000000000000000000000000000000..8cc7da663f7b3347d2558a9520fccd9891a246dc
--- /dev/null
+++ b/test/codegen/opassign.dart
@@ -0,0 +1,33 @@
+// Copyright (c) 2015, 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.
+
+get index {
+ print('called "index" getter');
+ return 0;
+}
+
+final _foo = new Foo();
+get foo {
+ print('called "foo" getter');
+ return _foo;
+}
+
+class Foo { int x = 100; }
+
+main() {
+ var f = { 0: 40 };
+ print('should only call "index" 2 times:');
+ ++f[index];
+ forcePostfix(f[index]++);
+
+ print('should only call "foo" 2 times:');
+ ++foo.x;
+ forcePostfix(foo.x++);
+
+ print('op assign test, should only call "index" twice:');
+ f[index] += f[index];
+}
+
+// Postfix generates as prefix if the value isn't used. This method prevents it.
+forcePostfix(x) {}
« test/codegen/expect/cascade.js ('K') | « test/codegen/expect/opassign.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698