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

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

Issue 1988503002: Move generated files to gen/. (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Created 4 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
(Empty)
1 dart_library.library('covariance', null, /* Imports */[
2 'dart_sdk'
3 ], function(exports, dart_sdk) {
4 'use strict';
5 const core = dart_sdk.core;
6 const dart = dart_sdk.dart;
7 const dartx = dart_sdk.dartx;
8 const covariance = Object.create(null);
9 const _t = Symbol('_t');
10 covariance.Foo$ = dart.generic(T => {
11 class Foo extends core.Object {
12 Foo() {
13 this[_t] = null;
14 }
15 add(t) {
16 dart.as(t, T);
17 this[_t] = t;
18 }
19 forEach(fn) {
20 dart.as(fn, dart.functionType(dart.void, [T]));
21 fn(this[_t]);
22 }
23 }
24 dart.setSignature(Foo, {
25 methods: () => ({
26 add: [dart.dynamic, [T]],
27 forEach: [dart.dynamic, [dart.functionType(dart.void, [T])]]
28 })
29 });
30 return Foo;
31 });
32 covariance.Foo = covariance.Foo$();
33 covariance.Bar = class Bar extends covariance.Foo$(core.int) {
34 Bar() {
35 super.Foo();
36 }
37 add(x) {
38 core.print(`Bar.add got ${x}`);
39 super.add(x);
40 }
41 };
42 dart.setSignature(covariance.Bar, {
43 methods: () => ({add: [dart.dynamic, [core.int]]})
44 });
45 covariance.main = function() {
46 let foo = new covariance.Bar();
47 foo.add('hi');
48 };
49 dart.fn(covariance.main);
50 // Exports:
51 exports.covariance = covariance;
52 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698