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

Side by Side Diff: pkg/checked_mirrors/lib/src/utils.dart

Issue 111643015: Preliminary checked mirrors (not ready for review yet) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years 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
« no previous file with comments | « pkg/checked_mirrors/lib/src/checker.dart ('k') | pkg/checked_mirrors/lib/src/wrappers.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 /// Holds some common functions that manipulate mirror objects.
6 library checked_mirrors.src.utils;
7
8 import 'dart:mirrors';
9
10 /// Helper to retrieve the library uri where [object] is defined.
11 Uri getLibraryUriOf(Mirror object) {
12 var declaration = getDeclarationOf(object);
13 if (declaration == null) return null;
14 if (declaration is LibraryMirror) return declaration.uri;
15 return getLibraryUriOf(declaration.owner);
16 }
17
18 /// Helper to retrieve the declaration of [object].
19 DeclarationMirror getDeclarationOf(Mirror object) {
20 if (object is DeclarationMirror) return object;
21 if (object is InstanceMirror) return object.type;
22 return null;
23 }
OLDNEW
« no previous file with comments | « pkg/checked_mirrors/lib/src/checker.dart ('k') | pkg/checked_mirrors/lib/src/wrappers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698