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

Side by Side Diff: pkg/compiler/lib/compiler.dart

Issue 2482923002: Use `Function` as function type syntax.
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/common.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 8
9 import 'package:package_config/packages.dart'; 9 import 'package:package_config/packages.dart';
10 10
(...skipping 11 matching lines...) Expand all
22 * The source can be represented either as a [:List<int>:] of UTF-8 bytes or as 22 * The source can be represented either as a [:List<int>:] of UTF-8 bytes or as
23 * a [String]. 23 * a [String].
24 * 24 *
25 * The following text is non-normative: 25 * The following text is non-normative:
26 * 26 *
27 * It is recommended to return a UTF-8 encoded list of bytes because the scanner 27 * It is recommended to return a UTF-8 encoded list of bytes because the scanner
28 * is more efficient in this case. In either case, the data structure is 28 * is more efficient in this case. In either case, the data structure is
29 * expected to hold a zero element at the last position. If this is not the 29 * expected to hold a zero element at the last position. If this is not the
30 * case, the entire data structure is copied before scanning. 30 * case, the entire data structure is copied before scanning.
31 */ 31 */
32 typedef Future/*<String | List<int>>*/ CompilerInputProvider(Uri uri); 32 typedef CompilerInputProvider = Future/*<String | List<int>>*/ Function(Uri);
33 33
34 /// Deprecated, please use [CompilerInputProvider] instead. 34 /// Deprecated, please use [CompilerInputProvider] instead.
35 typedef Future<String> ReadStringFromUri(Uri uri); 35 typedef ReadStringFromUri = Future<String> Function(Uri);
36 36
37 /** 37 /**
38 * Returns an [EventSink] that will serve as compiler output for the given 38 * Returns an [EventSink] that will serve as compiler output for the given
39 * component. 39 * component.
40 * 40 *
41 * Components are identified by [name] and [extension]. By convention, 41 * Components are identified by [name] and [extension]. By convention,
42 * the empty string [:"":] will represent the main script 42 * the empty string [:"":] will represent the main script
43 * (corresponding to the script parameter of [compile]) even if the 43 * (corresponding to the script parameter of [compile]) even if the
44 * main script is a library. For libraries that are compiled 44 * main script is a library. For libraries that are compiled
45 * separately, the library name is used. 45 * separately, the library name is used.
46 * 46 *
47 * At least the following extensions can be expected: 47 * At least the following extensions can be expected:
48 * 48 *
49 * * "js" for JavaScript output. 49 * * "js" for JavaScript output.
50 * * "js.map" for source maps. 50 * * "js.map" for source maps.
51 * * "dart" for Dart output. 51 * * "dart" for Dart output.
52 * * "dart.map" for source maps. 52 * * "dart.map" for source maps.
53 * 53 *
54 * As more features are added to the compiler, new names and 54 * As more features are added to the compiler, new names and
55 * extensions may be introduced. 55 * extensions may be introduced.
56 */ 56 */
57 typedef EventSink<String> CompilerOutputProvider(String name, String extension); 57 typedef CompilerOutputProvider = EventSink<String> Function(String name, String extension);
58 58
59 /** 59 /**
60 * Invoked by the compiler to report diagnostics. If [uri] is 60 * Invoked by the compiler to report diagnostics. If [uri] is
61 * [:null:], so are [begin] and [end]. No other arguments may be 61 * [:null:], so are [begin] and [end]. No other arguments may be
62 * [:null:]. If [uri] is not [:null:], neither are [begin] and 62 * [:null:]. If [uri] is not [:null:], neither are [begin] and
63 * [end]. [uri] indicates the compilation unit from where the 63 * [end]. [uri] indicates the compilation unit from where the
64 * diagnostic originates. [begin] and [end] are zero-based character 64 * diagnostic originates. [begin] and [end] are zero-based character
65 * offsets from the beginning of the compilation unit. [message] is the 65 * offsets from the beginning of the compilation unit. [message] is the
66 * diagnostic message, and [kind] indicates indicates what kind of 66 * diagnostic message, and [kind] indicates indicates what kind of
67 * diagnostic it is. 67 * diagnostic it is.
68 */ 68 */
69 typedef void DiagnosticHandler( 69 typedef DiagnosticHandler =
70 Uri uri, int begin, int end, String message, Diagnostic kind); 70 void Function(Uri, int begin, int end, String message, Diagnostic kind);
71 71
72 /** 72 /**
73 * Provides a package lookup mechanism in the case that no package root or 73 * Provides a package lookup mechanism in the case that no package root or
74 * package resolution configuration file are explicitly specified. 74 * package resolution configuration file are explicitly specified.
75 */ 75 */
76 typedef Future<Packages> PackagesDiscoveryProvider(Uri uri); 76 typedef PackagesDiscoveryProvider = Future<Packages> Function(Uri);
77 77
78 /// Information resulting from the compilation. 78 /// Information resulting from the compilation.
79 class CompilationResult { 79 class CompilationResult {
80 /// `true` if the compilation succeeded, that is, compilation didn't fail due 80 /// `true` if the compilation succeeded, that is, compilation didn't fail due
81 /// to compile-time errors and/or internal errors. 81 /// to compile-time errors and/or internal errors.
82 final bool isSuccess; 82 final bool isSuccess;
83 83
84 /// The compiler object used for the compilation. 84 /// The compiler object used for the compilation.
85 /// 85 ///
86 /// Note: The type of [compiler] is implementation dependent and may vary. 86 /// Note: The type of [compiler] is implementation dependent and may vary.
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 final String name; 200 final String name;
201 201
202 /** 202 /**
203 * This constructor is not private to support user-defined 203 * This constructor is not private to support user-defined
204 * diagnostic kinds. 204 * diagnostic kinds.
205 */ 205 */
206 const Diagnostic(this.ordinal, this.name); 206 const Diagnostic(this.ordinal, this.name);
207 207
208 String toString() => name; 208 String toString() => name;
209 } 209 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698