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

Unified Diff: test/codegen/expect/opassign.js

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
Index: test/codegen/expect/opassign.js
diff --git a/test/codegen/expect/opassign.js b/test/codegen/expect/opassign.js
new file mode 100644
index 0000000000000000000000000000000000000000..0fad7f7541cdede308a9d993cb30af0ca898744c
--- /dev/null
+++ b/test/codegen/expect/opassign.js
@@ -0,0 +1,48 @@
+var opassign;
+(function(exports) {
+ 'use strict';
+ dart.copyProperties(exports, {
+ get index() {
+ core.print('called "index" getter');
+ return 0;
+ }
+ });
+ dart.defineLazyProperties(exports, {
+ get _foo() {
+ return new Foo();
+ }
+ });
+ dart.copyProperties(exports, {
+ get foo() {
+ core.print('called "foo" getter');
+ return exports._foo;
+ }
+ });
+ class Foo extends core.Object {
+ Foo() {
+ this.x = 100;
+ }
+ }
+ // Function main: () → dynamic
+ function main() {
+ let f = dart.map([0, 40]);
+ core.print('should only call "index" 2 times:');
+ let i = exports.index;
+ f.set(i, dart.dbinary(f.get(i), '+', 1));
+ forcePostfix(((i, x$) => f.set(i, dart.dbinary(x$, '+', 1)), x$)(exports.index, f.get(i)));
+ core.print('should only call "foo" 2 times:');
+ let o = exports.foo;
+ dart.dput(o, 'x', dart.dbinary(dart.dload(o, 'x'), '+', 1));
+ forcePostfix(((o, x$) => dart.dput(o, 'x', dart.dbinary(x$, '+', 1)), x$)(exports.foo, dart.dload(o, 'x')));
+ core.print('op assign test, should only call "index" twice:');
+ let i = exports.index;
+ f.set(i, dart.dbinary(f.get(i), '+', f.get(exports.index)));
+ }
+ // Function forcePostfix: (dynamic) → dynamic
+ function forcePostfix(x) {
+ }
+ // Exports:
+ exports.Foo = Foo;
+ exports.main = main;
+ exports.forcePostfix = forcePostfix;
+})(opassign || (opassign = {}));

Powered by Google App Engine
This is Rietveld 408576698