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 compiler; | 5 library compiler; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:uri'; | 8 import 'dart:uri'; |
9 import 'implementation/apiimpl.dart'; | 9 import 'implementation/apiimpl.dart'; |
10 | 10 |
11 // Unless explicitly allowed, passing [:null:] for any argument to the | 11 // Unless explicitly allowed, passing [:null:] for any argument to the |
12 // methods of library will result in an Error being thrown. | 12 // methods of library will result in an Error being thrown. |
13 | 13 |
14 /** | 14 /** |
15 * Returns a future that completes to the source corresponding to | 15 * Returns a future that completes to the source corresponding to |
16 * [uri]. If an exception occurs, the future completes with this | 16 * [uri]. If an exception occurs, the future completes with this |
17 * exception. | 17 * exception. |
18 */ | 18 */ |
19 typedef Future<String> CompilerInputProvider(Uri uri); | 19 typedef Future<String> CompilerInputProvider(Uri uri); |
20 | 20 |
21 /// Deprecated, please use [CompilerInputProvider] instead. | 21 /// Deprecated, please use [CompilerInputProvider] instead. |
22 typedef Future<String> ReadStringFromUri(Uri uri); | 22 typedef Future<String> ReadStringFromUri(Uri uri); |
23 | 23 |
24 /** | 24 /** |
25 * Returns a [Sink] that will serve as compiler output for the given | 25 * Returns a [StreamSink] that will serve as compiler output for the given |
26 * component. | 26 * component. |
27 * | 27 * |
28 * Components are identified by [name] and [extension]. By convention, | 28 * Components are identified by [name] and [extension]. By convention, |
29 * the empty string [:"":] will represent the main script | 29 * the empty string [:"":] will represent the main script |
30 * (corresponding to the script parameter of [compile]) even if the | 30 * (corresponding to the script parameter of [compile]) even if the |
31 * main script is a library. For libraries that are compiled | 31 * main script is a library. For libraries that are compiled |
32 * separately, the library name is used. | 32 * separately, the library name is used. |
33 * | 33 * |
34 * At least the following extensions can be expected: | 34 * At least the following extensions can be expected: |
35 * | 35 * |
36 * * "js" for JavaScript output. | 36 * * "js" for JavaScript output. |
37 * * "js.map" for source maps. | 37 * * "js.map" for source maps. |
38 * * "dart" for Dart output. | 38 * * "dart" for Dart output. |
39 * * "dart.map" for source maps. | 39 * * "dart.map" for source maps. |
40 * | 40 * |
41 * As more features are added to the compiler, new names and | 41 * As more features are added to the compiler, new names and |
42 * extensions may be introduced. | 42 * extensions may be introduced. |
43 */ | 43 */ |
44 typedef Sink<String> CompilerOutputProvider(String name, String extension); | 44 typedef StreamSink<String> CompilerOutputProvider(String name, |
| 45 String extension); |
45 | 46 |
46 /** | 47 /** |
47 * Invoked by the compiler to report diagnostics. If [uri] is | 48 * Invoked by the compiler to report diagnostics. If [uri] is |
48 * [:null:], so are [begin] and [end]. No other arguments may be | 49 * [:null:], so are [begin] and [end]. No other arguments may be |
49 * [:null:]. If [uri] is not [:null:], neither are [begin] and | 50 * [:null:]. If [uri] is not [:null:], neither are [begin] and |
50 * [end]. [uri] indicates the compilation unit from where the | 51 * [end]. [uri] indicates the compilation unit from where the |
51 * diagnostic originates. [begin] and [end] are zero-based character | 52 * diagnostic originates. [begin] and [end] are zero-based character |
52 * offsets from the beginning of the compilaton unit. [message] is the | 53 * offsets from the beginning of the compilaton unit. [message] is the |
53 * diagnostic message, and [kind] indicates indicates what kind of | 54 * diagnostic message, and [kind] indicates indicates what kind of |
54 * diagnostic it is. | 55 * diagnostic it is. |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 final String name; | 168 final String name; |
168 | 169 |
169 /** | 170 /** |
170 * This constructor is not private to support user-defined | 171 * This constructor is not private to support user-defined |
171 * diagnostic kinds. | 172 * diagnostic kinds. |
172 */ | 173 */ |
173 const Diagnostic(this.ordinal, this.name); | 174 const Diagnostic(this.ordinal, this.name); |
174 | 175 |
175 String toString() => name; | 176 String toString() => name; |
176 } | 177 } |
OLD | NEW |