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

Unified Diff: pkg/observe/lib/src/path_observer.dart

Issue 180273004: Fixes in smoke, which in turn should fix todomvc. (Closed) Base URL: https://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 | « no previous file | pkg/polymer/lib/polymer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/observe/lib/src/path_observer.dart
diff --git a/pkg/observe/lib/src/path_observer.dart b/pkg/observe/lib/src/path_observer.dart
index 29af241490b928fd6b16469b710e0c9d6384ef77..be551024c0427482269a36282f8842ca73d8e90c 100644
--- a/pkg/observe/lib/src/path_observer.dart
+++ b/pkg/observe/lib/src/path_observer.dart
@@ -506,14 +506,13 @@ abstract class _Observer extends Bindable {
throw new StateError('Observer has already been opened.');
}
- if (_minArgumentCount(callback) > _reportArgumentCount) {
+ if (smoke.minArgs(callback) > _reportArgumentCount) {
throw new ArgumentError('callback should take $_reportArgumentCount or '
'fewer arguments');
}
_notifyCallback = callback;
- _notifyArgumentCount = min(_reportArgumentCount,
- _maxArgumentCount(callback));
+ _notifyArgumentCount = min(_reportArgumentCount, smoke.maxArgs(callback));
_connect();
return _value;
@@ -560,27 +559,6 @@ abstract class _Observer extends Bindable {
}
}
-typedef _Func0();
-typedef _Func1(a);
-typedef _Func2(a, b);
-typedef _Func3(a, b, c);
-
-int _minArgumentCount(fn) {
- if (fn is _Func0) return 0;
- if (fn is _Func1) return 1;
- if (fn is _Func2) return 2;
- if (fn is _Func3) return 3;
- return 4; // at least 4 arguments are required.
-}
-
-int _maxArgumentCount(fn) {
- if (fn is _Func3) return 3;
- if (fn is _Func2) return 2;
- if (fn is _Func1) return 1;
- if (fn is _Func0) return 0;
- return -1;
-}
-
class _ObservedSet {
/// To prevent sequential [PathObserver]s and [CompoundObserver]s from
/// observing the same object, we check if they are observing the same root
« no previous file with comments | « no previous file | pkg/polymer/lib/polymer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698