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

Side by Side Diff: pkg/polymer_expressions/lib/src/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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
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.
4
5 library polymer_expressions.src.mirrors;
6
7 import 'package:observe/observe.dart' show Reflectable, ObservableProperty;
8
9 @MirrorsUsed(metaTargets: const [Reflectable, ObservableProperty],
10 override: 'polymer_expressions.src.mirrors')
11 import 'dart:mirrors';
12
13 /**
14 * Walks up the class hierarchy to find a method declaration with the given
15 * [name].
16 *
17 * Note that it's not possible to tell if there's an implementation via
18 * noSuchMethod().
19 */
20 Mirror getMemberMirror(ClassMirror classMirror, Symbol name) {
21 if (classMirror.declarations.containsKey(name)) {
22 return classMirror.declarations[name];
23 }
24 if (hasSuperclass(classMirror)) {
25 var mirror = getMemberMirror(classMirror.superclass, name);
26 if (mirror != null) {
27 return mirror;
28 }
29 }
30 for (ClassMirror supe in classMirror.superinterfaces) {
31 var mirror = getMemberMirror(supe, name);
32 if (mirror != null) {
33 return mirror;
34 }
35 }
36 return null;
37 }
38
39 /**
40 * Work-around for http://dartbug.com/5794
41 */
42 bool hasSuperclass(ClassMirror classMirror) {
43 var superclass = classMirror.superclass;
44 return (superclass != null) &&
45 (superclass.qualifiedName != #dart.core.Object);
46 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698