Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(404)

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

Issue 1484263002: Use destructuring assignments for named parameters (#180) (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/runtime/dart/_interceptors.js ('k') | lib/runtime/dart/_isolate_helper.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/runtime/dart/_internal.js
diff --git a/lib/runtime/dart/_internal.js b/lib/runtime/dart/_internal.js
index b79ef83a4f98bdb1e07b2761578847c90b801383..4823c44738fd77b7a407b20a2fda82c14df2e489 100644
--- a/lib/runtime/dart/_internal.js
+++ b/lib/runtime/dart/_internal.js
@@ -83,9 +83,8 @@ dart_library.library('dart/_internal', null, /* Imports */[
}
return false;
}
- firstWhere(test, opts) {
+ firstWhere(test, {orElse = null} = {}) {
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) {
@@ -100,9 +99,8 @@ dart_library.library('dart/_internal', null, /* Imports */[
return orElse();
dart.throw(IterableElementError.noElement());
}
- lastWhere(test, opts) {
+ lastWhere(test, {orElse = null} = {}) {
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) {
@@ -218,8 +216,7 @@ dart_library.library('dart/_internal', null, /* Imports */[
dart.as(test, dart.functionType(core.bool, [E]));
return super.takeWhile(test);
}
- toList(opts) {
- let growable = opts && 'growable' in opts ? opts.growable : true;
+ toList({growable = true} = {}) {
let result = null;
if (dart.notNull(growable)) {
result = core.List$(E).new();
@@ -357,8 +354,7 @@ dart_library.library('dart/_internal', null, /* Imports */[
return new (SubListIterable$(E))(this[_iterable], this[_start], newEnd);
}
}
- toList(opts) {
- let growable = opts && 'growable' in opts ? opts.growable : true;
+ toList({growable = true} = {}) {
let start = this[_start];
let end = this[_iterable][dartx.length];
if (this[_endOrLength] != null && dart.notNull(this[_endOrLength]) < dart.notNull(end))
@@ -972,25 +968,22 @@ dart_library.library('dart/_internal', null, /* Imports */[
dart.as(test, dart.functionType(core.bool, [E]));
return false;
}
- firstWhere(test, opts) {
+ firstWhere(test, {orElse = null} = {}) {
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, opts) {
+ lastWhere(test, {orElse = null} = {}) {
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, opts) {
+ singleWhere(test, {orElse = null} = {}) {
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();
@@ -1033,8 +1026,7 @@ dart_library.library('dart/_internal', null, /* Imports */[
dart.as(test, dart.functionType(core.bool, [E]));
return this;
}
- toList(opts) {
- let growable = opts && 'growable' in opts ? opts.growable : true;
+ toList({growable = true} = {}) {
return dart.notNull(growable) ? dart.list([], E) : core.List$(E).new(0);
}
toSet() {
« no previous file with comments | « lib/runtime/dart/_interceptors.js ('k') | lib/runtime/dart/_isolate_helper.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698