Chromium Code Reviews

Unified Diff: lib/runtime/dart/_isolate_helper.js

Issue 1484263002: Use destructuring assignments for named parameters (#180) (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Destructure function params directly (no more opts in most cases) Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: lib/runtime/dart/_isolate_helper.js
diff --git a/lib/runtime/dart/_isolate_helper.js b/lib/runtime/dart/_isolate_helper.js
index 99b1e88b9a330c6526d14ea296bbc0863028f929..f63e5eba07935222bdae37c927bfc2014ba068c7 100644
--- a/lib/runtime/dart/_isolate_helper.js
+++ b/lib/runtime/dart/_isolate_helper.js
@@ -34,8 +34,7 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
let _id = Symbol('_id');
let _receivePort = Symbol('_receivePort');
class _Serializer extends core.Object {
- _Serializer(opts) {
- let serializeSendPorts = opts && 'serializeSendPorts' in opts ? opts.serializeSendPorts : true;
+ _Serializer({serializeSendPorts = true} = {}) {
this.serializedObjectIds = core.Map$(dart.dynamic, core.int).identity();
this[_serializeSendPorts] = dart.as(serializeSendPorts, core.bool);
}
@@ -191,8 +190,7 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
});
let _adjustSendPorts = Symbol('_adjustSendPorts');
class _Deserializer extends core.Object {
- _Deserializer(opts) {
- let adjustSendPorts = opts && 'adjustSendPorts' in opts ? opts.adjustSendPorts : true;
+ _Deserializer({adjustSendPorts = true} = {}) {
this.deserializedObjects = core.List.new();
this[_adjustSendPorts] = dart.as(adjustSendPorts, core.bool);
}
@@ -1412,10 +1410,7 @@ 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, 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;
+ listen(onData, {onError = null, onDone = null, cancelOnError = null} = {}) {
return this[_controller].stream.listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
}
close() {

Powered by Google App Engine