OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 fasta.loader; | 5 library fasta.loader; |
6 | 6 |
7 import 'dart:async' show | 7 import 'dart:async' show |
8 Future; | 8 Future; |
9 | 9 |
10 import 'dart:collection' show | 10 import 'dart:collection' show |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 // TODO(ahe): Share this message with [buildBodies]. Also make it easy to | 123 // TODO(ahe): Share this message with [buildBodies]. Also make it easy to |
124 // tell the difference between outlines read from a dill file or source | 124 // tell the difference between outlines read from a dill file or source |
125 // files. Currently, [libraryCount] is wrong for dill files. | 125 // files. Currently, [libraryCount] is wrong for dill files. |
126 print(""" | 126 print(""" |
127 $sinceStart: $message ($byteCount bytes) in ${format(ms, 3, 0)}ms, that is, | 127 $sinceStart: $message ($byteCount bytes) in ${format(ms, 3, 0)}ms, that is, |
128 ${format(byteCount / ms, 3, 12)} bytes/ms, and | 128 ${format(byteCount / ms, 3, 12)} bytes/ms, and |
129 ${format(ms / libraryCount, 3, 12)} ms/compilation unit."""); | 129 ${format(ms / libraryCount, 3, 12)} ms/compilation unit."""); |
130 }); | 130 }); |
131 } | 131 } |
132 | 132 |
133 Future<Null> buildOutline(LibraryBuilder library); | 133 Future<Null> buildOutline(covariant LibraryBuilder library); |
134 | 134 |
135 /// Builds all the method bodies found in the given [library]. | 135 /// Builds all the method bodies found in the given [library]. |
136 /// | 136 /// |
137 /// [astKind] determines whether or not analyzer ASTs are used as an | 137 /// [astKind] determines whether or not analyzer ASTs are used as an |
138 /// intermediate data structure. | 138 /// intermediate data structure. |
139 Future<Null> buildBody(LibraryBuilder library, AstKind astKind); | 139 Future<Null> buildBody(covariant LibraryBuilder library, AstKind astKind); |
140 | 140 |
141 List<InputError> collectCompileTimeErrors() { | 141 List<InputError> collectCompileTimeErrors() { |
142 List<InputError> errors = <InputError>[]; | 142 List<InputError> errors = <InputError>[]; |
143 for (LibraryBuilder library in builders.values) { | 143 for (LibraryBuilder library in builders.values) { |
144 if (library.loader == this) { | 144 if (library.loader == this) { |
145 errors.addAll(library.compileTimeErrors); | 145 errors.addAll(library.compileTimeErrors); |
146 } | 146 } |
147 } | 147 } |
148 return errors; | 148 return errors; |
149 } | 149 } |
150 } | 150 } |
151 | 151 |
152 String format(double d, int fractionDigits, int width) { | 152 String format(double d, int fractionDigits, int width) { |
153 return d.toStringAsFixed(fractionDigits).padLeft(width); | 153 return d.toStringAsFixed(fractionDigits).padLeft(width); |
154 } | 154 } |
OLD | NEW |