Files
sdk/pkg/dev_compiler/test/codegen/expect/temps.js
T
Olivier Chafik 3307317454 JS: Format if statements with no else on a single line
To match Dart style:
https://www.dartlang.org/effective-dart/style/#do-use-curly-braces-for-all-flow-control-structures

(also, that's the style we use in our .js runtime files, so that will help with diffs of the js->dart runtime migration from https://github.com/dart-lang/dev_compiler/issues/310)

BUG=
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1524843002 .
2015-12-16 19:45:19 +00:00

52 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;
const _x = Symbol('_x');
const __x = Symbol('__x');
const _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]]})
});
const _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;
});