| 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 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 'deprecated_problems.dart' | 13 import 'deprecated_problems.dart' show firstSourceUri; |
| 14 show firstSourceUri, deprecated_printUnexpected; | |
| 15 | 14 |
| 16 import 'messages.dart' | 15 import 'messages.dart' |
| 17 show LocatedMessage, Message, messagePlatformPrivateLibraryAccess; | 16 show LocatedMessage, Message, messagePlatformPrivateLibraryAccess; |
| 18 | 17 |
| 18 import 'severity.dart' show Severity; |
| 19 |
| 19 import 'target_implementation.dart' show TargetImplementation; | 20 import 'target_implementation.dart' show TargetImplementation; |
| 20 | 21 |
| 21 import 'ticker.dart' show Ticker; | 22 import 'ticker.dart' show Ticker; |
| 22 | 23 |
| 23 abstract class Loader<L> { | 24 abstract class Loader<L> { |
| 24 final Map<Uri, LibraryBuilder> builders = <Uri, LibraryBuilder>{}; | 25 final Map<Uri, LibraryBuilder> builders = <Uri, LibraryBuilder>{}; |
| 25 | 26 |
| 26 final Queue<LibraryBuilder> unparsedLibraries = new Queue<LibraryBuilder>(); | 27 final Queue<LibraryBuilder> unparsedLibraries = new Queue<LibraryBuilder>(); |
| 27 | 28 |
| 28 final List<L> libraries = <L>[]; | 29 final List<L> libraries = <L>[]; |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 /// Register [message] as a compile-time error. | 168 /// Register [message] as a compile-time error. |
| 168 /// | 169 /// |
| 169 /// If [silent] is true, no error is printed as it is assumed the error has | 170 /// If [silent] is true, no error is printed as it is assumed the error has |
| 170 /// been previously reported. | 171 /// been previously reported. |
| 171 /// | 172 /// |
| 172 /// If [wasHandled] is true, this error is added to [handledErrors], | 173 /// If [wasHandled] is true, this error is added to [handledErrors], |
| 173 /// otherwise it is added to [unhandledErrors]. | 174 /// otherwise it is added to [unhandledErrors]. |
| 174 void addCompileTimeError(Message message, int charOffset, Uri fileUri, | 175 void addCompileTimeError(Message message, int charOffset, Uri fileUri, |
| 175 {bool silent: false, bool wasHandled: false}) { | 176 {bool silent: false, bool wasHandled: false}) { |
| 176 if (!silent) { | 177 if (!silent) { |
| 177 deprecated_printUnexpected(fileUri, charOffset, message.message); | 178 target.context |
| 179 .report(message.withLocation(fileUri, charOffset), Severity.error); |
| 178 } | 180 } |
| 179 (wasHandled ? handledErrors : unhandledErrors) | 181 (wasHandled ? handledErrors : unhandledErrors) |
| 180 .add(message.withLocation(fileUri, charOffset)); | 182 .add(message.withLocation(fileUri, charOffset)); |
| 181 } | 183 } |
| 182 | 184 |
| 183 Builder getAbstractClassInstantiationError() { | 185 Builder getAbstractClassInstantiationError() { |
| 184 return target.getAbstractClassInstantiationError(this); | 186 return target.getAbstractClassInstantiationError(this); |
| 185 } | 187 } |
| 186 | 188 |
| 187 Builder getCompileTimeError() => target.getCompileTimeError(this); | 189 Builder getCompileTimeError() => target.getCompileTimeError(this); |
| 188 | 190 |
| 189 Builder getDuplicatedFieldInitializerError() { | 191 Builder getDuplicatedFieldInitializerError() { |
| 190 return target.getDuplicatedFieldInitializerError(this); | 192 return target.getDuplicatedFieldInitializerError(this); |
| 191 } | 193 } |
| 192 | 194 |
| 193 Builder getNativeAnnotation() => target.getNativeAnnotation(this); | 195 Builder getNativeAnnotation() => target.getNativeAnnotation(this); |
| 194 } | 196 } |
| 195 | 197 |
| 196 String format(double d, int fractionDigits, int width) { | 198 String format(double d, int fractionDigits, int width) { |
| 197 return d.toStringAsFixed(fractionDigits).padLeft(width); | 199 return d.toStringAsFixed(fractionDigits).padLeft(width); |
| 198 } | 200 } |
| OLD | NEW |