| 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:io'); |
| 7 #import('dart:uri'); | 8 #import('dart:uri'); |
| 8 #import('dart2js_mirror.dart'); | 9 #import('dart2js_mirror.dart'); |
| 9 | 10 |
| 10 /** | 11 /** |
| 11 * [Compilation] encapsulates the compilation of a program. | 12 * [Compilation] encapsulates the compilation of a program. |
| 12 */ | 13 */ |
| 13 class Compilation { | 14 class Compilation { |
| 14 /** | 15 /** |
| 15 * Creates a new compilation which has [script] as its entry point. | 16 * Creates a new compilation which has [script] as its entry point. |
| 16 */ | 17 */ |
| 17 factory Compilation(String script, | 18 factory Compilation(Path script, |
| 18 String libraryRoot, | 19 Path libraryRoot, |
| 19 [String packageRoot, | 20 [Path packageRoot, |
| 20 List<String> opts = const <String>[]]) { | 21 List<String> opts = const <String>[]]) { |
| 21 return new Dart2JsCompilation(script, libraryRoot, packageRoot, opts); | 22 return new Dart2JsCompilation(script, libraryRoot, packageRoot, opts); |
| 22 } | 23 } |
| 23 factory Compilation.library(List<String> libraries, | 24 |
| 24 String libraryRoot, | 25 /** |
| 25 [String packageRoot, | 26 * Creates a new compilation which consists of a set of libraries, but which |
| 27 * has no entry point. This compilation cannot generate output but can only |
| 28 * be used for static inspection of the source code. |
| 29 */ |
| 30 factory Compilation.library(List<Path> libraries, |
| 31 Path libraryRoot, |
| 32 [Path packageRoot, |
| 26 List<String> opts = const []]) { | 33 List<String> opts = const []]) { |
| 27 return new Dart2JsCompilation.library(libraries, libraryRoot, | 34 return new Dart2JsCompilation.library(libraries, libraryRoot, |
| 28 packageRoot, opts); | 35 packageRoot, opts); |
| 29 } | 36 } |
| 30 | 37 |
| 31 /** | 38 /** |
| 32 * Returns the mirror system for this compilation. | 39 * Returns the mirror system for this compilation. |
| 33 */ | 40 */ |
| 34 abstract MirrorSystem mirrors(); | 41 abstract MirrorSystem mirrors(); |
| 42 |
| 43 /** |
| 44 * Returns a future for the compiled JavaScript code. |
| 45 */ |
| 46 abstract Future<String> compileToJavaScript(); |
| 35 } | 47 } |
| 36 | 48 |
| 37 /** | 49 /** |
| 38 * The main interface for the whole mirror system. | 50 * The main interface for the whole mirror system. |
| 39 */ | 51 */ |
| 40 interface MirrorSystem { | 52 interface MirrorSystem { |
| 41 /** | 53 /** |
| 42 * Returns an unmodifiable map of all libraries in this mirror system. | 54 * Returns an unmodifiable map of all libraries in this mirror system. |
| 43 */ | 55 */ |
| 44 Map<Object, LibraryMirror> libraries(); | 56 Map<Object, LibraryMirror> libraries(); |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 /** | 454 /** |
| 443 * Returns the URI where the source originated. | 455 * Returns the URI where the source originated. |
| 444 */ | 456 */ |
| 445 Uri uri(); | 457 Uri uri(); |
| 446 | 458 |
| 447 /** | 459 /** |
| 448 * Returns the text of this source. | 460 * Returns the text of this source. |
| 449 */ | 461 */ |
| 450 String text(); | 462 String text(); |
| 451 } | 463 } |
| OLD | NEW |