Files
sdk/pkg/dev_compiler/test/codegen/expect/functions.js
T
Olivier Chafik 3886194414 Generate _runtime.js from dart (https://github.com/dart-lang/dev_compiler/issues/310)
The following part files were ported from the original .js (lib/runtime/dart/_foo.js -> input_sdk/private/foo.dart):
- input_sdk/private/rtti.dart
- input_sdk/private/types.dart
- input_sdk/private/classes.dart
- input_sdk/private/errors.dart
- input_sdk/private/generators.dart
- input_sdk/private/operations.dart
- input_sdk/private/runtime.dart

Notes:
- Introduced genericTypeConstructor intrinsic: `JS('', '#(type)', genericTypeConstructor(List))` generates `core.List$(type)`
- Used new JS quasiquotes everywhere
- Depends on new internal `@JSExportName` annotation to alias symbols like dart.{as, is, const, assert, export, implements, throw, async, dynamic, void} (see https://codereview.chromium.org/1580413002/)

BUG=
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1530563003 .
2016-01-21 00:45:31 +00:00

34 lines
901 B
JavaScript

dart_library.library('functions', null, /* Imports */[
'dart/_runtime',
'dart/core'
], /* Lazy imports */[
], function(exports, dart, core) {
'use strict';
let dartx = dart.dartx;
function bootstrap() {
return dart.list([new Foo()], Foo);
}
dart.fn(bootstrap, () => dart.definiteFunctionType(core.List$(Foo), []));
const A2B$ = dart.generic(function(A, B) {
const A2B = dart.typedef('A2B', () => dart.functionType(B, [A]));
return A2B;
});
let A2B = A2B$();
function id(f) {
return f;
}
dart.fn(id, () => dart.definiteFunctionType(A2B$(Foo, Foo), [A2B$(Foo, Foo)]));
class Foo extends core.Object {}
function main() {
core.print(bootstrap()[dartx.get](0));
}
dart.fn(main, dart.void, []);
// Exports:
exports.bootstrap = bootstrap;
exports.A2B$ = A2B$;
exports.A2B = A2B;
exports.id = id;
exports.Foo = Foo;
exports.main = main;
});