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

Side by Side Diff: test/browser/runtime_tests.js

Issue 1093353004: fix list initializers (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: baselines 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 unified diff | Download patch
« no previous file with comments | « lib/src/dependency_graph.dart ('k') | test/codegen/expect/DeltaBlue.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 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 var assert = chai.assert; 5 var assert = chai.assert;
6 6
7 suite('generic', () => { 7 suite('generic', () => {
8 "use strict"; 8 "use strict";
9 9
10 let generic = dart.generic; 10 let generic = dart.generic;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 suite('instanceOf', () => { 78 suite('instanceOf', () => {
79 "use strict"; 79 "use strict";
80 80
81 let expect = assert.equal; 81 let expect = assert.equal;
82 let isGroundType = dart.isGroundType; 82 let isGroundType = dart.isGroundType;
83 let generic = dart.generic; 83 let generic = dart.generic;
84 let intIsNonNullable = false; 84 let intIsNonNullable = false;
85 let cast = dart.as; 85 let cast = dart.as;
86 let instanceOf = dart.is; 86 let instanceOf = dart.is;
87 let getRuntimeType = dart.getRuntimeType; 87 let getRuntimeType = dart.getRuntimeType;
88 let runtimeType = dart.runtimeType; 88 let setType = dart.setType;
89 let functionType = dart.functionType; 89 let functionType = dart.functionType;
90 let typedef = dart.typedef; 90 let typedef = dart.typedef;
91 91
92 let Object = core.Object; 92 let Object = core.Object;
93 let String = core.String; 93 let String = core.String;
94 let dynamic = dart.dynamic; 94 let dynamic = dart.dynamic;
95 let List = core.List; 95 let List = core.List;
96 let Map = core.Map; 96 let Map = core.Map;
97 let Map$ = core.Map$; 97 let Map$ = core.Map$;
98 let int = core.int; 98 let int = core.int;
(...skipping 12 matching lines...) Expand all
111 111
112 let Func2 = typedef('Func2', () => functionType(dynamic, [dynamic, dynamic])); 112 let Func2 = typedef('Func2', () => functionType(dynamic, [dynamic, dynamic]));
113 let Foo = typedef('Foo', () => functionType(B, [B, String])); 113 let Foo = typedef('Foo', () => functionType(B, [B, String]));
114 114
115 let FuncG$ = generic((T, U) => typedef('FuncG', () => functionType(T, [T, U])) ) 115 let FuncG$ = generic((T, U) => typedef('FuncG', () => functionType(T, [T, U])) )
116 let FuncG = FuncG$(); 116 let FuncG = FuncG$();
117 117
118 // TODO(vsm): Revisit when we encode types on functions properly. 118 // TODO(vsm): Revisit when we encode types on functions properly.
119 // A bar1(C c, String s) => null; 119 // A bar1(C c, String s) => null;
120 function bar1(c, s) { return null; } 120 function bar1(c, s) { return null; }
121 bar1[runtimeType] = functionType(A, [C, String]); 121 setType(bar1, functionType(A, [C, String]));
122 122
123 // bar2(B b, String s) => null; 123 // bar2(B b, String s) => null;
124 function bar2(b, s) { return null; } 124 function bar2(b, s) { return null; }
125 bar2[runtimeType] = functionType(dynamic, [B, String]); 125 setType(bar2, functionType(dynamic, [B, String]));
126 126
127 // B bar3(B b, Object o) => null; 127 // B bar3(B b, Object o) => null;
128 function bar3(b, o) { return null; } 128 function bar3(b, o) { return null; }
129 bar3[runtimeType] = functionType(B, [B, Object]); 129 setType(bar3, functionType(B, [B, Object]));
130 130
131 // B bar4(B b, o) => null; 131 // B bar4(B b, o) => null;
132 function bar4(b, o) { return null; } 132 function bar4(b, o) { return null; }
133 bar4[runtimeType] = functionType(B, [B, dynamic]); 133 setType(bar4, functionType(B, [B, dynamic]));
134 134
135 // C bar5(A a, Object o) => null; 135 // C bar5(A a, Object o) => null;
136 function bar5(a, o) { return null; } 136 function bar5(a, o) { return null; }
137 bar5[runtimeType] = functionType(C, [A, Object]); 137 setType(bar5, functionType(C, [A, Object]));
138 138
139 // B bar6(B b, String s, String o) => null; 139 // B bar6(B b, String s, String o) => null;
140 function bar6(b, s, o) { return null; } 140 function bar6(b, s, o) { return null; }
141 bar6[runtimeType] = functionType(B, [B, String, String]); 141 setType(bar6, functionType(B, [B, String, String]));
142 142
143 // B bar7(B b, String s, [Object o]) => null; 143 // B bar7(B b, String s, [Object o]) => null;
144 function bar7(b, s, o) { return null; } 144 function bar7(b, s, o) { return null; }
145 bar7[runtimeType] = functionType(B, [B, String], [Object]); 145 setType(bar7, functionType(B, [B, String], [Object]));
146 146
147 // B bar8(B b, String s, {Object p}) => null; 147 // B bar8(B b, String s, {Object p}) => null;
148 function bar8(b, s, o) { return null; } 148 function bar8(b, s, o) { return null; }
149 bar8[runtimeType] = functionType(B, [B, String], {p: Object}); 149 setType(bar8, functionType(B, [B, String], {p: Object}));
150 150
151 function checkType(x, type, expectedTrue) { 151 function checkType(x, type, expectedTrue) {
152 if (expectedTrue === undefined) expectedTrue = true; 152 if (expectedTrue === undefined) expectedTrue = true;
153 expect(instanceOf(x, type), expectedTrue); 153 expect(instanceOf(x, type), expectedTrue);
154 } 154 }
155 155
156 test('int', () => { 156 test('int', () => {
157 expect(isGroundType(int), true); 157 expect(isGroundType(int), true);
158 expect(isGroundType(getRuntimeType(5)), true); 158 expect(isGroundType(getRuntimeType(5)), true);
159 159
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 checkType(bar3, functionType(B, [B, String])); 331 checkType(bar3, functionType(B, [B, String]));
332 checkType(bar4, Foo, false); 332 checkType(bar4, Foo, false);
333 // TODO(vsm): Revisit. bar4 is (B, *) -> B. Perhaps it should be treated a s top for a reified object. 333 // TODO(vsm): Revisit. bar4 is (B, *) -> B. Perhaps it should be treated a s top for a reified object.
334 checkType(bar4, functionType(B, [B, String]), false); 334 checkType(bar4, functionType(B, [B, String]), false);
335 checkType(bar5, Foo); 335 checkType(bar5, Foo);
336 checkType(bar5, functionType(B, [B, String])); 336 checkType(bar5, functionType(B, [B, String]));
337 checkType(bar6, Foo, false); 337 checkType(bar6, Foo, false);
338 checkType(bar6, functionType(B, [B, String]), false); 338 checkType(bar6, functionType(B, [B, String]), false);
339 checkType(bar7, Foo); 339 checkType(bar7, Foo);
340 checkType(bar7, functionType(B, [B, String])); 340 checkType(bar7, functionType(B, [B, String]));
341 checkType(bar7, bar6[runtimeType]); 341 checkType(bar7, getRuntimeType(bar6));
342 checkType(bar8, Foo); 342 checkType(bar8, Foo);
343 checkType(bar8, functionType(B, [B, String])); 343 checkType(bar8, functionType(B, [B, String]));
344 checkType(bar8, bar6[runtimeType], false); 344 checkType(bar8, getRuntimeType(bar6), false);
345 checkType(bar7, bar8[runtimeType], false); 345 checkType(bar7, getRuntimeType(bar8), false);
346 checkType(bar8, bar7[runtimeType], false); 346 checkType(bar8, getRuntimeType(bar7), false);
347 347
348 // Parameterized typedefs 348 // Parameterized typedefs
349 expect(isGroundType(FuncG), true); 349 expect(isGroundType(FuncG), true);
350 expect(isGroundType(FuncG$(B, String)), false); 350 expect(isGroundType(FuncG$(B, String)), false);
351 checkType(bar1, FuncG$(B, String), false); 351 checkType(bar1, FuncG$(B, String), false);
352 checkType(bar3, FuncG$(B, String)); 352 checkType(bar3, FuncG$(B, String));
353 }); 353 });
354 }); 354 });
OLDNEW
« no previous file with comments | « lib/src/dependency_graph.dart ('k') | test/codegen/expect/DeltaBlue.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698