Skip to content

Commit

Permalink
Compile the sdk with --no-destructure-named-params (#396)
Browse files Browse the repository at this point in the history
This is so the Atom plugin doesn't need to regenerate the SDK (it still
needs to be compiled with --no-destructure-named-params, though, until
Atom is updated to more ES6-compliant node/Chrome).
  • Loading branch information
ochafik committed Dec 11, 2015
1 parent 7263b20 commit ee79328
Show file tree
Hide file tree
Showing 12 changed files with 316 additions and 107 deletions.
13 changes: 9 additions & 4 deletions pkg/dev_compiler/lib/runtime/dart/_interceptors.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,15 @@ dart_library.library('dart/_interceptors', null, /* Imports */[
dart.as(combine, dart.functionType(dart.dynamic, [dart.dynamic, E]));
return _internal.IterableMixinWorkaround.fold(this, initialValue, combine);
}
[dartx.firstWhere](test, {orElse = null} = {}) {
[dartx.firstWhere](test, opts) {
dart.as(test, dart.functionType(core.bool, [E]));
let orElse = opts && 'orElse' in opts ? opts.orElse : null;
dart.as(orElse, dart.functionType(E, []));
return dart.as(_internal.IterableMixinWorkaround.firstWhere(this, test, orElse), E);
}
[dartx.lastWhere](test, {orElse = null} = {}) {
[dartx.lastWhere](test, opts) {
dart.as(test, dart.functionType(core.bool, [E]));
let orElse = opts && 'orElse' in opts ? opts.orElse : null;
dart.as(orElse, dart.functionType(E, []));
return dart.as(_internal.IterableMixinWorkaround.lastWhereList(this, test, orElse), E);
}
Expand Down Expand Up @@ -343,7 +345,8 @@ dart_library.library('dart/_interceptors', null, /* Imports */[
toString() {
return collection.ListBase.listToString(this);
}
[dartx.toList]({growable = true} = {}) {
[dartx.toList](opts) {
let growable = opts && 'growable' in opts ? opts.growable : true;
let list = this.slice();
if (!dart.notNull(growable))
JSArray$().markFixedList(dart.as(list, core.List));
Expand Down Expand Up @@ -1002,7 +1005,9 @@ dart_library.library('dart/_interceptors', null, /* Imports */[
[dartx.replaceAllMapped](from, convert) {
return this[dartx.splitMapJoin](from, {onMatch: convert});
}
[dartx.splitMapJoin](from, {onMatch = null, onNonMatch = null} = {}) {
[dartx.splitMapJoin](from, opts) {
let onMatch = opts && 'onMatch' in opts ? opts.onMatch : null;
let onNonMatch = opts && 'onNonMatch' in opts ? opts.onNonMatch : null;
return dart.as(_js_helper.stringReplaceAllFuncUnchecked(this, from, onMatch, onNonMatch), core.String);
}
[dartx.replaceFirst](from, to, startIndex) {
Expand Down
24 changes: 16 additions & 8 deletions pkg/dev_compiler/lib/runtime/dart/_internal.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,9 @@ dart_library.library('dart/_internal', null, /* Imports */[
}
return false;
}
firstWhere(test, {orElse = null} = {}) {
firstWhere(test, opts) {
dart.as(test, dart.functionType(core.bool, [E]));
let orElse = opts && 'orElse' in opts ? opts.orElse : null;
dart.as(orElse, dart.functionType(E, []));
let length = this.length;
for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull(i) + 1) {
Expand All @@ -99,8 +100,9 @@ dart_library.library('dart/_internal', null, /* Imports */[
return orElse();
dart.throw(IterableElementError.noElement());
}
lastWhere(test, {orElse = null} = {}) {
lastWhere(test, opts) {
dart.as(test, dart.functionType(core.bool, [E]));
let orElse = opts && 'orElse' in opts ? opts.orElse : null;
dart.as(orElse, dart.functionType(E, []));
let length = this.length;
for (let i = dart.notNull(length) - 1; dart.notNull(i) >= 0; i = dart.notNull(i) - 1) {
Expand Down Expand Up @@ -216,7 +218,8 @@ dart_library.library('dart/_internal', null, /* Imports */[
dart.as(test, dart.functionType(core.bool, [E]));
return super.takeWhile(test);
}
toList({growable = true} = {}) {
toList(opts) {
let growable = opts && 'growable' in opts ? opts.growable : true;
let result = null;
if (dart.notNull(growable)) {
result = core.List$(E).new();
Expand Down Expand Up @@ -354,7 +357,8 @@ dart_library.library('dart/_internal', null, /* Imports */[
return new (SubListIterable$(E))(this[_iterable], this[_start], newEnd);
}
}
toList({growable = true} = {}) {
toList(opts) {
let growable = opts && 'growable' in opts ? opts.growable : true;
let start = this[_start];
let end = this[_iterable][dartx.length];
if (this[_endOrLength] != null && dart.notNull(this[_endOrLength]) < dart.notNull(end))
Expand Down Expand Up @@ -968,22 +972,25 @@ dart_library.library('dart/_internal', null, /* Imports */[
dart.as(test, dart.functionType(core.bool, [E]));
return false;
}
firstWhere(test, {orElse = null} = {}) {
firstWhere(test, opts) {
dart.as(test, dart.functionType(core.bool, [E]));
let orElse = opts && 'orElse' in opts ? opts.orElse : null;
dart.as(orElse, dart.functionType(E, []));
if (orElse != null)
return orElse();
dart.throw(IterableElementError.noElement());
}
lastWhere(test, {orElse = null} = {}) {
lastWhere(test, opts) {
dart.as(test, dart.functionType(core.bool, [E]));
let orElse = opts && 'orElse' in opts ? opts.orElse : null;
dart.as(orElse, dart.functionType(E, []));
if (orElse != null)
return orElse();
dart.throw(IterableElementError.noElement());
}
singleWhere(test, {orElse = null} = {}) {
singleWhere(test, opts) {
dart.as(test, dart.functionType(core.bool, [E]));
let orElse = opts && 'orElse' in opts ? opts.orElse : null;
dart.as(orElse, dart.functionType(E, []));
if (orElse != null)
return orElse();
Expand Down Expand Up @@ -1026,7 +1033,8 @@ dart_library.library('dart/_internal', null, /* Imports */[
dart.as(test, dart.functionType(core.bool, [E]));
return this;
}
toList({growable = true} = {}) {
toList(opts) {
let growable = opts && 'growable' in opts ? opts.growable : true;
return dart.notNull(growable) ? dart.list([], E) : core.List$(E).new(0);
}
toSet() {
Expand Down
11 changes: 8 additions & 3 deletions pkg/dev_compiler/lib/runtime/dart/_isolate_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
const _id = Symbol('_id');
const _receivePort = Symbol('_receivePort');
class _Serializer extends core.Object {
_Serializer({serializeSendPorts = true} = {}) {
_Serializer(opts) {
let serializeSendPorts = opts && 'serializeSendPorts' in opts ? opts.serializeSendPorts : true;
this.serializedObjectIds = core.Map$(dart.dynamic, core.int).identity();
this[_serializeSendPorts] = dart.as(serializeSendPorts, core.bool);
}
Expand Down Expand Up @@ -190,7 +191,8 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
});
const _adjustSendPorts = Symbol('_adjustSendPorts');
class _Deserializer extends core.Object {
_Deserializer({adjustSendPorts = true} = {}) {
_Deserializer(opts) {
let adjustSendPorts = opts && 'adjustSendPorts' in opts ? opts.adjustSendPorts : true;
this.deserializedObjects = core.List.new();
this[_adjustSendPorts] = dart.as(adjustSendPorts, core.bool);
}
Expand Down Expand Up @@ -1406,7 +1408,10 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
this[_controller] = async.StreamController.new({onCancel: dart.bind(this, 'close'), sync: true});
this[_rawPort].handler = dart.bind(this[_controller], 'add');
}
listen(onData, {onError = null, onDone = null, cancelOnError = null} = {}) {
listen(onData, opts) {
let onError = opts && 'onError' in opts ? opts.onError : null;
let onDone = opts && 'onDone' in opts ? opts.onDone : null;
let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
return this[_controller].stream.listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
}
close() {
Expand Down
7 changes: 5 additions & 2 deletions pkg/dev_compiler/lib/runtime/dart/_js_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ dart_library.library('dart/_js_helper', null, /* Imports */[
constructors: () => ({Native: [Native, [core.String]]})
});
class JsPeerInterface extends core.Object {
JsPeerInterface({name = null} = {}) {
JsPeerInterface(opts) {
let name = opts && 'name' in opts ? opts.name : null;
this.name = name;
}
}
Expand Down Expand Up @@ -78,7 +79,9 @@ dart_library.library('dart/_js_helper', null, /* Imports */[
toString() {
return `RegExp/${this.pattern}/`;
}
JSSyntaxRegExp(source, {multiLine = false, caseSensitive = true} = {}) {
JSSyntaxRegExp(source, opts) {
let multiLine = opts && 'multiLine' in opts ? opts.multiLine : false;
let caseSensitive = opts && 'caseSensitive' in opts ? opts.caseSensitive : true;
this.pattern = source;
this[_nativeRegExp] = JSSyntaxRegExp.makeNative(source, multiLine, caseSensitive, false);
this[_nativeGlobalRegExp] = null;
Expand Down
Loading

0 comments on commit ee79328

Please sign in to comment.