Chromium Code Reviews| 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 |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 36 Loader(this.target); | 36 Loader(this.target); |
| 37 | 37 |
| 38 Ticker get ticker => target.ticker; | 38 Ticker get ticker => target.ticker; |
| 39 | 39 |
| 40 /// Look up a library builder by the name [uri], or if such doesn't | 40 /// Look up a library builder by the name [uri], or if such doesn't |
| 41 /// exist, create one. The canonical URI of the library is [uri], and its | 41 /// exist, create one. The canonical URI of the library is [uri], and its |
| 42 /// actual location is [fileUri]. | 42 /// actual location is [fileUri]. |
| 43 /// | 43 /// |
| 44 /// Canonical URIs have schemes like "dart", or "package", and the actual | 44 /// Canonical URIs have schemes like "dart", or "package", and the actual |
| 45 /// location is often a file URI. | 45 /// location is often a file URI. |
| 46 LibraryBuilder read(Uri uri, [Uri fileUri]) { | 46 LibraryBuilder read(Uri uri, int charOffset, |
| 47 {Uri fileUri, LibraryBuilder accessor}) { | |
|
ahe
2017/05/23 15:04:24
The accessor will be used to ensure that private d
scheglov
2017/05/23 16:14:45
Please document new parameters.
ahe
2017/05/24 10:54:20
Done.
| |
| 47 firstSourceUri ??= uri; | 48 firstSourceUri ??= uri; |
| 48 LibraryBuilder builder = builders.putIfAbsent(uri, () { | 49 LibraryBuilder builder = builders.putIfAbsent(uri, () { |
| 49 if (fileUri == null) { | 50 if (fileUri == null) { |
| 50 switch (uri.scheme) { | 51 switch (uri.scheme) { |
| 51 case "package": | 52 case "package": |
| 52 case "dart": | 53 case "dart": |
| 53 fileUri = target.translateUri(uri); | 54 fileUri = target.translateUri(uri); |
| 54 break; | 55 break; |
| 55 | 56 |
| 56 default: | 57 default: |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 67 if (library.loader == this) { | 68 if (library.loader == this) { |
| 68 unparsedLibraries.addLast(library); | 69 unparsedLibraries.addLast(library); |
| 69 } | 70 } |
| 70 return library; | 71 return library; |
| 71 }); | 72 }); |
| 72 return builder; | 73 return builder; |
| 73 } | 74 } |
| 74 | 75 |
| 75 void ensureCoreLibrary() { | 76 void ensureCoreLibrary() { |
| 76 if (coreLibrary == null) { | 77 if (coreLibrary == null) { |
| 77 read(Uri.parse("dart:core")); | 78 read(Uri.parse("dart:core"), -1); |
| 78 assert(coreLibrary != null); | 79 assert(coreLibrary != null); |
| 79 } | 80 } |
| 80 } | 81 } |
| 81 | 82 |
| 82 Future<Null> buildBodies() async { | 83 Future<Null> buildBodies() async { |
| 83 assert(coreLibrary != null); | 84 assert(coreLibrary != null); |
| 84 for (LibraryBuilder library in builders.values) { | 85 for (LibraryBuilder library in builders.values) { |
| 85 currentUriForCrashReporting = library.uri; | 86 currentUriForCrashReporting = library.uri; |
| 86 await buildBody(library); | 87 await buildBody(library); |
| 87 } | 88 } |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 141 Builder getNativeAnnotation() => target.getNativeAnnotation(this); | 142 Builder getNativeAnnotation() => target.getNativeAnnotation(this); |
| 142 | 143 |
| 143 Builder getAbstractClassInstantiationError() { | 144 Builder getAbstractClassInstantiationError() { |
| 144 return target.getAbstractClassInstantiationError(this); | 145 return target.getAbstractClassInstantiationError(this); |
| 145 } | 146 } |
| 146 } | 147 } |
| 147 | 148 |
| 148 String format(double d, int fractionDigits, int width) { | 149 String format(double d, int fractionDigits, int width) { |
| 149 return d.toStringAsFixed(fractionDigits).padLeft(width); | 150 return d.toStringAsFixed(fractionDigits).padLeft(width); |
| 150 } | 151 } |
| OLD | NEW |