| 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 'errors.dart' show InputError, firstSourceUri; | 13 import 'errors.dart' show InputError, firstSourceUri, printUnexpected; |
| 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 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 } | 74 } |
| 75 if (uri.scheme == "dart") { | 75 if (uri.scheme == "dart") { |
| 76 target.readPatchFiles(library); | 76 target.readPatchFiles(library); |
| 77 } | 77 } |
| 78 first ??= library; | 78 first ??= library; |
| 79 if (library.loader == this) { | 79 if (library.loader == this) { |
| 80 unparsedLibraries.addLast(library); | 80 unparsedLibraries.addLast(library); |
| 81 } | 81 } |
| 82 return library; | 82 return library; |
| 83 }); | 83 }); |
| 84 // TODO(ahe): Check that [accessor] is allowed to access [builder]. | 84 if (accessor != null && |
| 85 uri.scheme == "dart" && |
| 86 uri.path.startsWith("_") && |
| 87 accessor.uri.scheme != "dart") { |
| 88 const String message = "Can't access platform private library."; |
| 89 printUnexpected(accessor.fileUri, charOffset, message); |
| 90 errors.add(new InputError(accessor.fileUri, charOffset, message)); |
| 91 } |
| 85 return builder; | 92 return builder; |
| 86 } | 93 } |
| 87 | 94 |
| 88 void ensureCoreLibrary() { | 95 void ensureCoreLibrary() { |
| 89 if (coreLibrary == null) { | 96 if (coreLibrary == null) { |
| 90 read(Uri.parse("dart:core"), -1); | 97 read(Uri.parse("dart:core"), -1); |
| 91 assert(coreLibrary != null); | 98 assert(coreLibrary != null); |
| 92 } | 99 } |
| 93 } | 100 } |
| 94 | 101 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 Builder getFallThroughError() => target.getFallThroughError(this); | 169 Builder getFallThroughError() => target.getFallThroughError(this); |
| 163 | 170 |
| 164 Builder getNativeAnnotation() => target.getNativeAnnotation(this); | 171 Builder getNativeAnnotation() => target.getNativeAnnotation(this); |
| 165 | 172 |
| 166 Builder getNoSuchMethodError() => target.getNoSuchMethodError(this); | 173 Builder getNoSuchMethodError() => target.getNoSuchMethodError(this); |
| 167 } | 174 } |
| 168 | 175 |
| 169 String format(double d, int fractionDigits, int width) { | 176 String format(double d, int fractionDigits, int width) { |
| 170 return d.toStringAsFixed(fractionDigits).padLeft(width); | 177 return d.toStringAsFixed(fractionDigits).padLeft(width); |
| 171 } | 178 } |
| OLD | NEW |