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

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

Issue 1138793002: Tag closures with their types (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: More comment fixes 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
« no previous file with comments | « test/codegen/expect/DeltaBlue.js ('k') | test/codegen/expect/constructors.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 var cascade = dart.defineLibrary(cascade, {}); 1 var cascade = dart.defineLibrary(cascade, {});
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 class A extends core.Object { 5 class A extends core.Object {
6 A() { 6 A() {
7 this.x = null; 7 this.x = null;
8 } 8 }
9 } 9 }
10 // Function test_closure_with_mutate: () → void 10 dart.setSignature(A, {});
11 function test_closure_with_mutate() { 11 function test_closure_with_mutate() {
12 let a = new A(); 12 let a = new A();
13 a.x = () => { 13 a.x = dart.fn(() => {
14 core.print("hi"); 14 core.print("hi");
15 a = null; 15 a = null;
16 }; 16 });
17 let _ = a; 17 let _ = a;
18 dart.dcall(_.x); 18 dart.dcall(_.x);
19 dart.dcall(_.x); 19 dart.dcall(_.x);
20 core.print(a); 20 core.print(a);
21 } 21 }
22 // Function test_closure_without_mutate: () → void 22 dart.fn(test_closure_with_mutate, dart.void, []);
23 function test_closure_without_mutate() { 23 function test_closure_without_mutate() {
24 let a = new A(); 24 let a = new A();
25 a.x = () => { 25 a.x = dart.fn(() => {
26 core.print(a); 26 core.print(a);
27 }; 27 });
28 dart.dcall(a.x); 28 dart.dcall(a.x);
29 dart.dcall(a.x); 29 dart.dcall(a.x);
30 core.print(a); 30 core.print(a);
31 } 31 }
32 // Function test_mutate_inside_cascade: () → void 32 dart.fn(test_closure_without_mutate, dart.void, []);
33 function test_mutate_inside_cascade() { 33 function test_mutate_inside_cascade() {
34 let a = null; 34 let a = null;
35 let _ = new A(); 35 let _ = new A();
36 _.x = a = null; 36 _.x = a = null;
37 _.x = a = null; 37 _.x = a = null;
38 a = _; 38 a = _;
39 core.print(a); 39 core.print(a);
40 } 40 }
41 // Function test_mutate_outside_cascade: () → void 41 dart.fn(test_mutate_inside_cascade, dart.void, []);
42 function test_mutate_outside_cascade() { 42 function test_mutate_outside_cascade() {
43 let a = null, b = null; 43 let a = null, b = null;
44 a = new A(); 44 a = new A();
45 a.x = b = null; 45 a.x = b = null;
46 a.x = b = null; 46 a.x = b = null;
47 a = null; 47 a = null;
48 core.print(a); 48 core.print(a);
49 } 49 }
50 // Function test_VariableDeclaration_single: () → void 50 dart.fn(test_mutate_outside_cascade, dart.void, []);
51 function test_VariableDeclaration_single() { 51 function test_VariableDeclaration_single() {
52 let a = []; 52 let a = [];
53 a[core.$length] = 2; 53 a[core.$length] = 2;
54 a[core.$add](42); 54 a[core.$add](42);
55 core.print(a); 55 core.print(a);
56 } 56 }
57 // Function test_VariableDeclaration_last: () → void 57 dart.fn(test_VariableDeclaration_single, dart.void, []);
58 function test_VariableDeclaration_last() { 58 function test_VariableDeclaration_last() {
59 let a = 42, b = (() => { 59 let a = 42, b = (() => {
60 let _ = []; 60 let _ = [];
61 _[core.$length] = 2; 61 _[core.$length] = 2;
62 _[core.$add](a); 62 _[core.$add](a);
63 return _; 63 return _;
64 })(); 64 })();
65 core.print(b); 65 core.print(b);
66 } 66 }
67 // Function test_VariableDeclaration_first: () → void 67 dart.fn(test_VariableDeclaration_last, dart.void, []);
68 function test_VariableDeclaration_first() { 68 function test_VariableDeclaration_first() {
69 let a = (() => { 69 let a = (() => {
70 let _ = []; 70 let _ = [];
71 _[core.$length] = 2; 71 _[core.$length] = 2;
72 _[core.$add](3); 72 _[core.$add](3);
73 return _; 73 return _;
74 })(), b = 2; 74 })(), b = 2;
75 core.print(a); 75 core.print(a);
76 } 76 }
77 // Function test_increment: () → void 77 dart.fn(test_VariableDeclaration_first, dart.void, []);
78 function test_increment() { 78 function test_increment() {
79 let a = new A(); 79 let a = new A();
80 let y = ((() => { 80 let y = ((() => {
81 a.x = dart.dsend(a.x, '+', 1); 81 a.x = dart.dsend(a.x, '+', 1);
82 a.x = dart.dsend(a.x, '-', 1); 82 a.x = dart.dsend(a.x, '-', 1);
83 return a; 83 return a;
84 })()); 84 })());
85 } 85 }
86 dart.fn(test_increment, dart.void, []);
86 let Base$ = dart.generic(function(T) { 87 let Base$ = dart.generic(function(T) {
87 class Base extends core.Object { 88 class Base extends core.Object {
88 Base() { 89 Base() {
89 this.x = dart.setType([], core.List$(T)); 90 this.x = dart.setType([], core.List$(T));
90 } 91 }
91 } 92 }
93 dart.setSignature(Base, {});
92 return Base; 94 return Base;
93 }); 95 });
94 let Base = Base$(); 96 let Base = Base$();
95 class Foo extends Base$(core.int) { 97 class Foo extends Base$(core.int) {
96 Foo() { 98 Foo() {
97 super.Base(); 99 super.Base();
98 } 100 }
99 test_final_field_generic(t) { 101 test_final_field_generic(t) {
100 this.x[core.$add](1); 102 this.x[core.$add](1);
101 this.x[core.$add](2); 103 this.x[core.$add](2);
102 this.x[core.$add](3); 104 this.x[core.$add](3);
103 this.x[core.$add](4); 105 this.x[core.$add](4);
104 } 106 }
105 } 107 }
108 dart.setSignature(Foo, {
109 methods: () => ({test_final_field_generic: dart.functionType(dart.void, [dar t.dynamic])})
110 });
106 // Exports: 111 // Exports:
107 exports.A = A; 112 exports.A = A;
108 exports.test_closure_with_mutate = test_closure_with_mutate; 113 exports.test_closure_with_mutate = test_closure_with_mutate;
109 exports.test_closure_without_mutate = test_closure_without_mutate; 114 exports.test_closure_without_mutate = test_closure_without_mutate;
110 exports.test_mutate_inside_cascade = test_mutate_inside_cascade; 115 exports.test_mutate_inside_cascade = test_mutate_inside_cascade;
111 exports.test_mutate_outside_cascade = test_mutate_outside_cascade; 116 exports.test_mutate_outside_cascade = test_mutate_outside_cascade;
112 exports.test_VariableDeclaration_single = test_VariableDeclaration_single; 117 exports.test_VariableDeclaration_single = test_VariableDeclaration_single;
113 exports.test_VariableDeclaration_last = test_VariableDeclaration_last; 118 exports.test_VariableDeclaration_last = test_VariableDeclaration_last;
114 exports.test_VariableDeclaration_first = test_VariableDeclaration_first; 119 exports.test_VariableDeclaration_first = test_VariableDeclaration_first;
115 exports.test_increment = test_increment; 120 exports.test_increment = test_increment;
116 exports.Base$ = Base$; 121 exports.Base$ = Base$;
117 exports.Base = Base; 122 exports.Base = Base;
118 exports.Foo = Foo; 123 exports.Foo = Foo;
119 })(cascade, core); 124 })(cascade, core);
OLDNEW
« no previous file with comments | « test/codegen/expect/DeltaBlue.js ('k') | test/codegen/expect/constructors.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698