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:async'; | 7 import 'dart:async'; |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 import 'dart:uri'; | 9 import 'dart:uri'; |
10 | 10 |
11 // TODO(rnystrom): Use "package:" URL (#4968). | 11 // TODO(rnystrom): Use "package:" URL (#4968). |
12 import 'dart2js_mirror.dart'; | 12 import 'dart2js_mirror.dart'; |
13 | 13 |
14 /** | 14 /** |
15 * [Compilation] encapsulates the compilation of a program. | |
16 */ | |
17 abstract class Compilation { | |
18 /** | |
19 * Creates a new compilation which has [script] as its entry point. | |
20 */ | |
21 factory Compilation(Path script, | |
22 Path libraryRoot, | |
23 [Path packageRoot, | |
24 List<String> opts = const <String>[]]) { | |
25 return new Dart2JsCompilation(script, libraryRoot, packageRoot, opts); | |
26 } | |
27 | |
28 /** | |
29 * Creates a new compilation which consists of a set of libraries, but which | |
30 * has no entry point. This compilation cannot generate output but can only | |
31 * be used for static inspection of the source code. | |
32 */ | |
33 factory Compilation.library(List<Path> libraries, | |
34 Path libraryRoot, | |
35 [Path packageRoot, | |
36 List<String> opts = const []]) { | |
37 return new Dart2JsCompilation.library(libraries, libraryRoot, | |
38 packageRoot, opts); | |
39 } | |
40 | |
41 /** | |
42 * Returns the mirror system for this compilation. | |
43 */ | |
44 final MirrorSystem mirrors; | |
45 | |
46 /** | |
47 * Returns a future for the compiled JavaScript code. | |
48 */ | |
49 Future<String> compileToJavaScript(); | |
50 } | |
51 | |
52 /** | |
53 * The main interface for the whole mirror system. | 15 * The main interface for the whole mirror system. |
54 */ | 16 */ |
55 abstract class MirrorSystem { | 17 abstract class MirrorSystem { |
56 /** | 18 /** |
57 * Returns an unmodifiable map of all libraries in this mirror system. | 19 * Returns an unmodifiable map of all libraries in this mirror system. |
58 */ | 20 */ |
59 Map<String, LibraryMirror> get libraries; | 21 Map<String, LibraryMirror> get libraries; |
60 | 22 |
61 /** | 23 /** |
62 * A mirror on the [:dynamic:] type. | 24 * A mirror on the [:dynamic:] type. |
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 /** | 691 /** |
730 * Returns the URI where the source originated. | 692 * Returns the URI where the source originated. |
731 */ | 693 */ |
732 Uri get sourceUri; | 694 Uri get sourceUri; |
733 | 695 |
734 /** | 696 /** |
735 * Returns the text of this source. | 697 * Returns the text of this source. |
736 */ | 698 */ |
737 String get sourceText; | 699 String get sourceText; |
738 } | 700 } |
OLD | NEW |