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

Side by Side Diff: lib/src/mirrors.dart

Issue 17553018: Initial stream support (Closed) Base URL: https://github.com/dart-lang/fancy-syntax.git@master
Patch Set: Created 7 years, 6 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
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 fancy_syntax.mirrors;
6
7 import 'dart:mirrors';
8
9 /**
10 * Walks up the class hierarchy to find a method declaration with the given
11 * [name].
12 *
13 * Note that it's not possible to tell if there's an implementation via
14 * noSuchMethod().
15 */
16 Mirror getMemberMirror(ClassMirror classMirror, Symbol name) {
17 if (classMirror.members.containsKey(name)) {
18 return classMirror.members[name];
19 }
20 if (hasSuperclass(classMirror)) {
21 var mirror = getMemberMirror(classMirror.superclass, name);
22 if (mirror != null) {
23 return mirror;
24 }
25 }
26 for (ClassMirror supe in classMirror.superinterfaces) {
27 var mirror = getMemberMirror(supe, name);
28 if (mirror != null) {
29 return mirror;
30 }
31 }
32 return null;
33 }
34
35 /**
36 * Work-around for http://dartbug.com/5794
37 */
38 bool hasSuperclass(ClassMirror classMirror) {
39 ClassMirror superclass = classMirror.superclass;
40 return (superclass != null)
41 && (superclass.qualifiedName != new Symbol("dart.core.Object"));
Jennifer Messerly 2013/06/24 18:30:35 perhaps: var obj = reflectClass(Object); return s
justinfagnani 2013/06/25 03:45:36 Done.
42 }
OLDNEW
« example/streams/count_clicks.html ('K') | « lib/eval.dart ('k') | lib/syntax.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698