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

Side by Side Diff: test/codegen/expect/opassign.js

Issue 1138793002: Tag closures with their types (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Rebase Created 5 years, 7 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 unified diff | Download patch
OLDNEW
1 var opassign = dart.defineLibrary(opassign, {}); 1 var opassign = dart.defineLibrary(opassign, {});
2 var core = dart.import(core); 2 var core = dart.import(core);
3 (function(exports, core) { 3 (function(exports, core) {
4 'use strict'; 4 'use strict';
5 dart.copyProperties(exports, { 5 dart.copyProperties(exports, {
6 get index() { 6 get index() {
7 core.print('called "index" getter'); 7 core.print('called "index" getter');
8 return 0; 8 return 0;
9 } 9 }
10 }); 10 });
11 dart.defineLazyProperties(exports, { 11 dart.defineLazyProperties(exports, {
12 get _foo() { 12 get _foo() {
13 return new Foo(); 13 return new Foo();
14 } 14 }
15 }); 15 });
16 dart.copyProperties(exports, { 16 dart.copyProperties(exports, {
17 get foo() { 17 get foo() {
18 core.print('called "foo" getter'); 18 core.print('called "foo" getter');
19 return exports._foo; 19 return exports._foo;
20 } 20 }
21 }); 21 });
22 class Foo extends core.Object { 22 class Foo extends core.Object {
23 Foo() { 23 Foo() {
24 this.x = 100; 24 this.x = 100;
25 } 25 }
26 } 26 }
27 // Function main: () → dynamic 27 dart.setSignature(Foo, {});
28 function main() { 28 function main() {
29 let f = dart.map([0, 40]); 29 let f = dart.map([0, 40]);
30 core.print('should only call "index" 2 times:'); 30 core.print('should only call "index" 2 times:');
31 let i = exports.index; 31 let i = exports.index;
32 f.set(i, dart.dsend(f.get(i), '+', 1)); 32 f.set(i, dart.dsend(f.get(i), '+', 1));
33 forcePostfix((() => { 33 forcePostfix((() => {
34 let i = exports.index, x = f.get(i); 34 let i = exports.index, x = f.get(i);
35 f.set(i, dart.dsend(x, '+', 1)); 35 f.set(i, dart.dsend(x, '+', 1));
36 return x; 36 return x;
37 })()); 37 })());
38 core.print('should only call "foo" 2 times:'); 38 core.print('should only call "foo" 2 times:');
39 let o = exports.foo; 39 let o = exports.foo;
40 dart.dput(o, 'x', dart.dsend(dart.dload(o, 'x'), '+', 1)); 40 dart.dput(o, 'x', dart.dsend(dart.dload(o, 'x'), '+', 1));
41 forcePostfix((() => { 41 forcePostfix((() => {
42 let o = exports.foo, x = dart.dload(o, 'x'); 42 let o = exports.foo, x = dart.dload(o, 'x');
43 dart.dput(o, 'x', dart.dsend(x, '+', 1)); 43 dart.dput(o, 'x', dart.dsend(x, '+', 1));
44 return x; 44 return x;
45 })()); 45 })());
46 core.print('op assign test, should only call "index" twice:'); 46 core.print('op assign test, should only call "index" twice:');
47 let i$ = exports.index; 47 let i$ = exports.index;
48 f.set(i$, dart.dsend(f.get(i$), '+', f.get(exports.index))); 48 f.set(i$, dart.dsend(f.get(i$), '+', f.get(exports.index)));
49 } 49 }
50 // Function forcePostfix: (dynamic) → dynamic 50 dart.fn(main);
51 function forcePostfix(x) { 51 function forcePostfix(x) {
52 } 52 }
53 dart.fn(forcePostfix);
53 // Exports: 54 // Exports:
54 exports.Foo = Foo; 55 exports.Foo = Foo;
55 exports.main = main; 56 exports.main = main;
56 exports.forcePostfix = forcePostfix; 57 exports.forcePostfix = forcePostfix;
57 })(opassign, core); 58 })(opassign, core);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698