OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 #library('mirrors'); | 5 #library('mirrors'); |
6 | 6 |
7 #import('dart:uri'); | 7 #import('dart:uri'); |
8 #import('dart2js_mirror.dart'); | 8 #import('dart2js_mirror.dart'); |
9 | 9 |
10 /** | 10 /** |
11 * [Compilation] encapsulates the compilation of a program. | 11 * [Compilation] encapsulates the compilation of a program. |
12 */ | 12 */ |
13 class Compilation { | 13 class Compilation { |
14 /** | 14 /** |
15 * Creates a new compilation which has [script] as its entry point. | 15 * Creates a new compilation which has [script] as its entry point. |
16 */ | 16 */ |
17 factory Compilation(String script, String libraryRoot, | 17 factory Compilation(String script, |
| 18 String libraryRoot, |
18 [String packageRoot, | 19 [String packageRoot, |
19 List<String> opts = const <String>[]]) { | 20 List<String> opts = const <String>[]]) { |
20 return new Dart2jsCompilation(script, libraryRoot, packageRoot, opts); | 21 return new Dart2JsCompilation(script, libraryRoot, packageRoot, opts); |
| 22 } |
| 23 factory Compilation.library(List<String> libraries, |
| 24 String libraryRoot, |
| 25 [String packageRoot, |
| 26 List<String> opts = const []]) { |
| 27 return new Dart2JsCompilation.library(libraries, libraryRoot, |
| 28 packageRoot, opts); |
21 } | 29 } |
22 | 30 |
23 /** | 31 /** |
24 * Returns the mirror system for this compilation. | 32 * Returns the mirror system for this compilation. |
25 */ | 33 */ |
26 abstract MirrorSystem mirrors(); | 34 abstract MirrorSystem mirrors(); |
27 } | 35 } |
28 | 36 |
29 /** | 37 /** |
30 * The main interface for the whole mirror system. | 38 * The main interface for the whole mirror system. |
31 */ | 39 */ |
32 interface MirrorSystem { | 40 interface MirrorSystem { |
33 /** | 41 /** |
34 * Returns an unmodifiable map of all libraries in this mirror system. | 42 * Returns an unmodifiable map of all libraries in this mirror system. |
35 */ | 43 */ |
36 Map<Object, LibraryMirror> libraries(); | 44 Map<Object, LibraryMirror> libraries(); |
37 } | 45 } |
38 | 46 |
39 | 47 |
40 /** | 48 /** |
41 * An entity in the mirror system. | 49 * An entity in the mirror system. |
42 */ | 50 */ |
43 interface Mirror { | 51 interface Mirror extends Hashable { |
44 /** | 52 /** |
45 * The simple name of the entity. The simple name is in most cases the | 53 * The simple name of the entity. The simple name is in most cases the |
46 * the declared single identifier name of the entity, such as 'method' for | 54 * the declared single identifier name of the entity, such as 'method' for |
47 * a method [:void method() {...}:]. | 55 * a method [:void method() {...}:]. |
48 */ | 56 */ |
49 String simpleName(); | 57 String simpleName(); |
50 | 58 |
51 /** | 59 /** |
52 * Returns the name of this entity qualified by is enclosing context. For | 60 * Returns the name of this entity qualified by is enclosing context. For |
53 * instance, the qualified name of a method 'method' in class 'Class' in | 61 * instance, the qualified name of a method 'method' in class 'Class' in |
54 * library 'library' is 'library.Class.method'. | 62 * library 'library' is 'library.Class.method'. |
55 */ | 63 */ |
56 String qualifiedName(); | 64 String qualifiedName(); |
| 65 |
| 66 /** |
| 67 * Returns the mirror system which contains this mirror. |
| 68 */ |
| 69 final MirrorSystem system; |
57 } | 70 } |
58 | 71 |
59 /** | 72 /** |
60 * Common interface for interface types and libraries. | 73 * Common interface for interface types and libraries. |
61 */ | 74 */ |
62 interface ObjectMirror extends Mirror { | 75 interface ObjectMirror extends Mirror { |
63 | 76 |
64 /** | 77 /** |
65 * Returns an unmodifiable map of the members of declared in this type or | 78 * Returns an unmodifiable map of the members of declared in this type or |
66 * library. | 79 * library. |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 interface Source { | 441 interface Source { |
429 /** | 442 /** |
430 * Returns the URI where the source originated. | 443 * Returns the URI where the source originated. |
431 */ | 444 */ |
432 Uri uri(); | 445 Uri uri(); |
433 | 446 |
434 /** | 447 /** |
435 * Returns the text of this source. | 448 * Returns the text of this source. |
436 */ | 449 */ |
437 String text(); | 450 String text(); |
438 } | 451 } |
OLD | NEW |