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

Side by Side Diff: pkg/front_end/lib/src/fasta/loader.dart

Issue 2917863003: Various infrastructure changes. (Closed)
Patch Set: Created 3 years, 6 months 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
OLDNEW
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 Future; 7 import 'dart:async' show Future;
8 8
9 import 'dart:collection' show Queue; 9 import 'dart:collection' show Queue;
10 10
11 import 'builder/builder.dart' show Builder, LibraryBuilder; 11 import 'builder/builder.dart' show Builder, LibraryBuilder;
12 12
13 import 'errors.dart' show InputError, firstSourceUri; 13 import 'errors.dart' show InputError, firstSourceUri;
14 14
15 import 'target_implementation.dart' show TargetImplementation; 15 import 'target_implementation.dart' show TargetImplementation;
16 16
17 import 'ticker.dart' show Ticker; 17 import 'ticker.dart' show Ticker;
18 18
19 abstract class Loader<L> { 19 abstract class Loader<L> {
20 final Map<Uri, LibraryBuilder> builders = <Uri, LibraryBuilder>{}; 20 final Map<Uri, LibraryBuilder> builders = <Uri, LibraryBuilder>{};
21 21
22 final Queue<LibraryBuilder> unparsedLibraries = new Queue<LibraryBuilder>(); 22 final Queue<LibraryBuilder> unparsedLibraries = new Queue<LibraryBuilder>();
23 23
24 final List<L> libraries = <L>[]; 24 final List<L> libraries = <L>[];
25 25
26 final TargetImplementation target; 26 final TargetImplementation target;
27 27
28 final List<InputError> errors = <InputError>[];
29
28 LibraryBuilder coreLibrary; 30 LibraryBuilder coreLibrary;
29 31
30 LibraryBuilder first; 32 LibraryBuilder first;
31 33
32 int byteCount = 0; 34 int byteCount = 0;
33 35
34 Uri currentUriForCrashReporting; 36 Uri currentUriForCrashReporting;
35 37
36 Loader(this.target); 38 Loader(this.target);
37 39
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 ${format(ms / libraryCount, 3, 12)} ms/compilation unit."""); 133 ${format(ms / libraryCount, 3, 12)} ms/compilation unit.""");
132 }); 134 });
133 } 135 }
134 136
135 Future<Null> buildOutline(covariant LibraryBuilder library); 137 Future<Null> buildOutline(covariant LibraryBuilder library);
136 138
137 /// Builds all the method bodies found in the given [library]. 139 /// Builds all the method bodies found in the given [library].
138 Future<Null> buildBody(covariant LibraryBuilder library); 140 Future<Null> buildBody(covariant LibraryBuilder library);
139 141
140 List<InputError> collectCompileTimeErrors() { 142 List<InputError> collectCompileTimeErrors() {
141 List<InputError> errors = <InputError>[]; 143 List<InputError> errors = <InputError>[]..addAll(this.errors);
142 for (LibraryBuilder library in builders.values) { 144 for (LibraryBuilder library in builders.values) {
143 if (library.loader == this) { 145 if (library.loader == this) {
144 errors.addAll(library.compileTimeErrors); 146 errors.addAll(library.compileTimeErrors);
145 } 147 }
146 } 148 }
147 return errors; 149 return errors;
148 } 150 }
149 151
152 Builder getAbstractClassInstantiationError() {
153 return target.getAbstractClassInstantiationError(this);
154 }
155
150 Builder getCompileTimeError() => target.getCompileTimeError(this); 156 Builder getCompileTimeError() => target.getCompileTimeError(this);
151 157
158 Builder getDuplicatedFieldInitializerError() {
159 return target.getDuplicatedFieldInitializerError(this);
160 }
161
162 Builder getFallThroughError() => target.getFallThroughError(this);
163
152 Builder getNativeAnnotation() => target.getNativeAnnotation(this); 164 Builder getNativeAnnotation() => target.getNativeAnnotation(this);
153 165
154 Builder getAbstractClassInstantiationError() { 166 Builder getNoSuchMethodError() => target.getNoSuchMethodError(this);
155 return target.getAbstractClassInstantiationError(this);
156 }
157 } 167 }
158 168
159 String format(double d, int fractionDigits, int width) { 169 String format(double d, int fractionDigits, int width) {
160 return d.toStringAsFixed(fractionDigits).padLeft(width); 170 return d.toStringAsFixed(fractionDigits).padLeft(width);
161 } 171 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698