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

Unified Diff: pkg/unittest/lib/src/spread_args_helper.dart

Issue 187653007: Revert https://code.google.com/p/dart/source/detail?r=33346 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 10 months 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 | « pkg/pkg.status ('k') | pkg/unittest/lib/unittest.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/unittest/lib/src/spread_args_helper.dart
===================================================================
--- pkg/unittest/lib/src/spread_args_helper.dart (revision 33351)
+++ pkg/unittest/lib/src/spread_args_helper.dart (working copy)
@@ -1,15 +1,9 @@
part of unittest;
-const _PLACE_HOLDER = const _ArgPlaceHolder();
-
-class _ArgPlaceHolder {
- const _ArgPlaceHolder();
-}
-
/** Simulates spread arguments using named arguments. */
// TODO(sigmund): remove this class and simply use a closure with named
// arguments (if still applicable).
-class _SpreadArgsHelper implements Function {
+class _SpreadArgsHelper {
final Function callback;
final int minExpectedCalls;
final int maxExpectedCalls;
@@ -20,7 +14,7 @@
bool complete;
_SpreadArgsHelper(Function callback, int minExpected, int maxExpected,
- String id, {bool isDone()})
+ Function isDone, String id)
: this.callback = callback,
minExpectedCalls = minExpected,
maxExpectedCalls = (maxExpected == 0 && minExpected > 0)
@@ -96,16 +90,31 @@
}
}
- call([a0 = _PLACE_HOLDER, a1 = _PLACE_HOLDER, a2 = _PLACE_HOLDER,
- a3 = _PLACE_HOLDER, a4 = _PLACE_HOLDER, a5 = _PLACE_HOLDER]) {
+ invoke0() {
+ return _guardAsync(
+ () {
+ if (shouldCallBack()) {
+ return callback();
+ }
+ },
+ after, testCase);
+ }
- var args = [a0, a1, a2, a3, a4, a5];
- args.removeWhere((a) => a == _PLACE_HOLDER);
+ invoke1(arg1) {
+ return _guardAsync(
+ () {
+ if (shouldCallBack()) {
+ return callback(arg1);
+ }
+ },
+ after, testCase);
+ }
+ invoke2(arg1, arg2) {
return _guardAsync(
() {
if (shouldCallBack()) {
- return Function.apply(callback, args);
+ return callback(arg1, arg2);
}
},
after, testCase);
« no previous file with comments | « pkg/pkg.status ('k') | pkg/unittest/lib/unittest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698