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

Side by Side 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, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /// Implementation of the smoke services using mirrors. 5 /// Implementation of the smoke services using mirrors.
6 library smoke.mirrors; 6 library smoke.mirrors;
7 7
8 import 'dart:mirrors'; 8 import 'dart:mirrors';
9 import 'package:smoke/smoke.dart'; 9 import 'package:smoke/smoke.dart';
10 import 'package:logging/logging.dart'; 10 import 'package:logging/logging.dart';
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 ..write(']')).toString(); 290 ..write(']')).toString();
291 } 291 }
292 } 292 }
293 293
294 class _MethodClosure extends Function { 294 class _MethodClosure extends Function {
295 final receiver; 295 final receiver;
296 final Symbol methodName; 296 final Symbol methodName;
297 297
298 _MethodClosure(this.receiver, this.methodName); 298 _MethodClosure(this.receiver, this.methodName);
299 299
300 // We shouldn't need to include [call] here, but we do to work around an 300 // 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
301 // analyzer bug (see dartbug.com/16078). Interestingly, if [call] is invoked 301 // don't for 3 reasons:
302 // with the wrong number of arguments, then noSuchMethod is anyways invoked 302 // * noSuchMethod makes the code a lot bigger.
303 // instead. 303 // * even with noSuchMethod, an analyzer bug requires to declare [call] (see
304 call() => invoke(receiver, methodName, const []); 304 // dartbug.com/16078).
305 305 // * having [call] also allows `is` checks to work for functions of 0
306 noSuchMethod(Invocation inv) { 306 // through 3 arguments. We depend on this in
307 if (inv.memberName != #call) return null; 307 // `polymer_expressions/lib/eval.dart` to check whether a function is a
308 return invoke(receiver, methodName, 308 // filter (takes a single argument). (Note that it's possible to include
309 inv.positionalArguments, namedArgs: inv.namedArguments); 309 // both [call] and [noSuchMethod], which would make instance-of checks
310 } 310 // work with the signature of [call], but will allow invoking the function
311 // using [noSuchMethod].
312 call([a, b, c]) => invoke(receiver, methodName, [a, b, c], adjust: true);
311 } 313 }
OLDNEW
« 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