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

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

Issue 1145283002: Use short array syntax in method signatures (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Address comments 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/constructors.js ('k') | test/codegen/expect/fieldtest.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 covariance = dart.defineLibrary(covariance, {}); 1 var covariance = dart.defineLibrary(covariance, {});
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 let _t = Symbol('_t'); 5 let _t = Symbol('_t');
6 let Foo$ = dart.generic(function(T) { 6 let Foo$ = dart.generic(function(T) {
7 class Foo extends core.Object { 7 class Foo extends core.Object {
8 Foo() { 8 Foo() {
9 this[_t] = null; 9 this[_t] = null;
10 } 10 }
11 add(t) { 11 add(t) {
12 dart.as(t, T); 12 dart.as(t, T);
13 this[_t] = t; 13 this[_t] = t;
14 } 14 }
15 forEach(fn) { 15 forEach(fn) {
16 dart.as(fn, dart.functionType(dart.void, [T])); 16 dart.as(fn, dart.functionType(dart.void, [T]));
17 fn(this[_t]); 17 fn(this[_t]);
18 } 18 }
19 } 19 }
20 dart.setSignature(Foo, { 20 dart.setSignature(Foo, {
21 methods: () => ({ 21 methods: () => ({
22 add: dart.functionType(dart.dynamic, [T]), 22 add: [dart.dynamic, [T]],
23 forEach: dart.functionType(dart.dynamic, [dart.functionType(dart.void, [ T])]) 23 forEach: [dart.dynamic, [dart.functionType(dart.void, [T])]]
24 }) 24 })
25 }); 25 });
26 return Foo; 26 return Foo;
27 }); 27 });
28 let Foo = Foo$(); 28 let Foo = Foo$();
29 class Bar extends Foo$(core.int) { 29 class Bar extends Foo$(core.int) {
30 Bar() { 30 Bar() {
31 super.Foo(); 31 super.Foo();
32 } 32 }
33 add(x) { 33 add(x) {
34 core.print(`Bar.add got ${x}`); 34 core.print(`Bar.add got ${x}`);
35 super.add(x); 35 super.add(x);
36 } 36 }
37 } 37 }
38 dart.setSignature(Bar, { 38 dart.setSignature(Bar, {
39 methods: () => ({add: dart.functionType(dart.dynamic, [core.int])}) 39 methods: () => ({add: [dart.dynamic, [core.int]]})
40 }); 40 });
41 function main() { 41 function main() {
42 let foo = new Bar(); 42 let foo = new Bar();
43 foo.add('hi'); 43 foo.add('hi');
44 } 44 }
45 dart.fn(main); 45 dart.fn(main);
46 // Exports: 46 // Exports:
47 exports.Foo$ = Foo$; 47 exports.Foo$ = Foo$;
48 exports.Foo = Foo; 48 exports.Foo = Foo;
49 exports.Bar = Bar; 49 exports.Bar = Bar;
50 exports.main = main; 50 exports.main = main;
51 })(covariance, core); 51 })(covariance, core);
OLDNEW
« no previous file with comments | « test/codegen/expect/constructors.js ('k') | test/codegen/expect/fieldtest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698