7add882a7a
Prepare for writing all the runtime in Dart: - Move js runtime files to lib/runtime/dart (dart_runtime.js -> dart/_runtime.js), - Use rest params instead of arguments slicing in a couple of places. BUG=https://github.com/dart-lang/dev_compiler/issues/310 R=jmesserly@google.com Review URL: https://codereview.chromium.org/1413683006 .
53 lines
1.4 KiB
JavaScript
53 lines
1.4 KiB
JavaScript
dart_library.library('temps', null, /* Imports */[
|
|
"dart/_runtime",
|
|
'dart/core'
|
|
], /* Lazy imports */[
|
|
], function(exports, dart, core) {
|
|
'use strict';
|
|
let dartx = dart.dartx;
|
|
let _x = Symbol('_x');
|
|
let __x = Symbol('__x');
|
|
let _function = Symbol('_function');
|
|
class FormalCollision extends core.Object {
|
|
FormalCollision(x, _x$, func) {
|
|
this[_x] = x;
|
|
this[__x] = _x$;
|
|
this[_function] = func;
|
|
}
|
|
}
|
|
dart.setSignature(FormalCollision, {
|
|
constructors: () => ({FormalCollision: [FormalCollision, [core.int, core.int, core.Function]]})
|
|
});
|
|
let _opt = Symbol('_opt');
|
|
class OptionalArg extends core.Object {
|
|
OptionalArg(opt) {
|
|
if (opt === void 0)
|
|
opt = 123;
|
|
this[_opt] = opt;
|
|
this.opt = null;
|
|
}
|
|
named(opts) {
|
|
let opt = opts && 'opt' in opts ? opts.opt : 456;
|
|
this.opt = opt;
|
|
this[_opt] = null;
|
|
}
|
|
}
|
|
dart.defineNamedConstructor(OptionalArg, 'named');
|
|
dart.setSignature(OptionalArg, {
|
|
constructors: () => ({
|
|
OptionalArg: [OptionalArg, [], [core.int]],
|
|
named: [OptionalArg, [], {opt: core.int}]
|
|
})
|
|
});
|
|
function main() {
|
|
core.print(new FormalCollision(1, 2, dart.fn(x => x)));
|
|
core.print(new OptionalArg()[_opt]);
|
|
core.print(new OptionalArg.named()[_opt]);
|
|
}
|
|
dart.fn(main);
|
|
// Exports:
|
|
exports.FormalCollision = FormalCollision;
|
|
exports.OptionalArg = OptionalArg;
|
|
exports.main = main;
|
|
});
|