Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 var covariance; | |
| 2 (function(exports) { | |
| 3 'use strict'; | |
| 4 let _t = Symbol('_t'); | |
| 5 let Foo$ = dart.generic(function(T) { | |
| 6 class Foo extends core.Object { | |
| 7 Foo() { | |
| 8 this[_t] = null; | |
| 9 } | |
| 10 add(t) { | |
| 11 dart.as(t, T); | |
| 12 this[_t] = t; | |
| 13 } | |
| 14 forEach(fn) { | |
| 15 dart.as(fn, dart.functionType(dart.void, [T])); | |
| 16 fn(this[_t]); | |
| 17 } | |
| 18 } | |
| 19 return Foo; | |
| 20 }); | |
| 21 let Foo = Foo$(); | |
| 22 class Bar extends Foo$(core.int) { | |
| 23 add(x) { | |
| 24 core.print(`Bar.add got ${x}`); | |
| 25 super.add(x); | |
| 26 } | |
| 27 } | |
| 28 // Function main: () → dynamic | |
| 29 function main() { | |
| 30 let foo = new Bar(); | |
| 31 foo.add('hi'); | |
| 32 } | |
| 33 // Exports: | |
| 34 exports.Foo$ = Foo$; | |
| 35 exports.Foo = Foo; | |
| 36 exports.Bar = Bar; | |
| 37 exports.main = main; | |
| 38 })(covariance || (covariance = {})); | |
| OLD | NEW |