Chromium Code Reviews| Index: sdk/lib/_internal/compiler/implementation/mirrors/mirrors_util.dart |
| diff --git a/sdk/lib/_internal/compiler/implementation/mirrors/mirrors_util.dart b/sdk/lib/_internal/compiler/implementation/mirrors/mirrors_util.dart |
| index ae01ea08c5c2c595968bf5568fc61aab40ba4a80..08c243e199632bfc7795b8560da7da090b62c372 100644 |
| --- a/sdk/lib/_internal/compiler/implementation/mirrors/mirrors_util.dart |
| +++ b/sdk/lib/_internal/compiler/implementation/mirrors/mirrors_util.dart |
| @@ -217,3 +217,25 @@ String stripComment(String comment) { |
| } |
| throw new ArgumentError('Invalid comment $comment'); |
| } |
| + |
| +/** |
| + * Looks up [name] in the scope [declaration]. |
| + * |
| + * For methods and constructors, the scope includes the parameters. |
| + * |
| + * If [name] is of the form [: a.b.c :], [:a:] is looked up in the scope of |
| + * [declaration], [:b:] is looked up in the scope of [:a:], and finally [:c:] is |
| + * looked up in the scope of [:b:]. |
| + */ |
| +DeclarationMirror lookupQualifiedInScope(DeclarationMirror declaration, |
| + String name) { |
| + // TODO(johnniwinther): Support lookup of constructors using the [:new Foo:] |
| + // syntax. |
| + for (String part in name.split('.')) { |
| + if (declaration == null) { |
|
Andrei Mouravski
2013/07/01 17:46:26
Nit: One line this?
Johnni Winther
2013/07/03 05:47:57
Done.
|
| + return null; |
| + } |
| + declaration = declaration.lookupInScope(part); |
| + } |
| + return declaration; |
| +} |