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

Unified Diff: pkg/smoke/lib/mirrors.dart

Issue 173003006: Use smoke in polymer and polymer_expressions. (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 | « pkg/polymer_expressions/lib/src/mirrors.dart ('k') | pkg/smoke/lib/src/default_transformer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/smoke/lib/mirrors.dart
diff --git a/pkg/smoke/lib/mirrors.dart b/pkg/smoke/lib/mirrors.dart
index ffd815d40cffbdd1a52fc23173b9407d2d1f7676..38ea40bce1048b5f7ca5bbf798b685e8124256ed 100644
--- a/pkg/smoke/lib/mirrors.dart
+++ b/pkg/smoke/lib/mirrors.dart
@@ -297,15 +297,17 @@ class _MethodClosure extends Function {
_MethodClosure(this.receiver, this.methodName);
- // We shouldn't need to include [call] here, but we do to work around an
- // analyzer bug (see dartbug.com/16078). Interestingly, if [call] is invoked
- // with the wrong number of arguments, then noSuchMethod is anyways invoked
- // instead.
- call() => invoke(receiver, methodName, const []);
-
- noSuchMethod(Invocation inv) {
- if (inv.memberName != #call) return null;
- return invoke(receiver, methodName,
- inv.positionalArguments, namedArgs: inv.namedArguments);
- }
+ // Technically we could just use noSuchMethod to implement [call], but we
Siggi Cherem (dart-lang) 2014/02/24 23:12:43 I did one last change here to remove the use of nS
+ // don't for 3 reasons:
+ // * noSuchMethod makes the code a lot bigger.
+ // * even with noSuchMethod, an analyzer bug requires to declare [call] (see
+ // dartbug.com/16078).
+ // * having [call] also allows `is` checks to work for functions of 0
+ // through 3 arguments. We depend on this in
+ // `polymer_expressions/lib/eval.dart` to check whether a function is a
+ // filter (takes a single argument). (Note that it's possible to include
+ // both [call] and [noSuchMethod], which would make instance-of checks
+ // work with the signature of [call], but will allow invoking the function
+ // using [noSuchMethod].
+ call([a, b, c]) => invoke(receiver, methodName, [a, b, c], adjust: true);
}
« no previous file with comments | « pkg/polymer_expressions/lib/src/mirrors.dart ('k') | pkg/smoke/lib/src/default_transformer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698