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

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

Issue 2895983002: Read SDK and patches from a JSON file. (Closed)
Patch Set: Created 3 years, 7 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
(...skipping 25 matching lines...) Expand all
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, {Uri fileUri, bool isPatch: false}) {
47 firstSourceUri ??= uri; 47 firstSourceUri ??= uri;
48 LibraryBuilder builder = builders.putIfAbsent(uri, () { 48 LibraryBuilder builder = builders.putIfAbsent(uri, () {
49 if (fileUri == null) { 49 if (fileUri == null) {
50 switch (uri.scheme) { 50 switch (uri.scheme) {
51 case "package": 51 case "package":
52 case "dart": 52 case "dart":
53 fileUri = target.translateUri(uri); 53 fileUri = target.translateUri(uri);
54 break; 54 break;
55 55
56 default: 56 default:
57 fileUri = uri; 57 fileUri = uri;
58 break; 58 break;
59 } 59 }
60 } 60 }
61 LibraryBuilder library = target.createLibraryBuilder(uri, fileUri); 61 LibraryBuilder library =
62 target.createLibraryBuilder(uri, fileUri, isPatch);
62 if (uri.scheme == "dart" && uri.path == "core") { 63 if (uri.scheme == "dart" && uri.path == "core") {
63 coreLibrary = library; 64 coreLibrary = library;
64 target.loadExtraRequiredLibraries(this); 65 target.loadExtraRequiredLibraries(this);
65 } 66 }
67 if (uri.scheme == "dart") {
68 target.readPatchFiles(library);
69 }
66 first ??= library; 70 first ??= library;
67 if (library.loader == this) { 71 if (library.loader == this) {
68 unparsedLibraries.addLast(library); 72 unparsedLibraries.addLast(library);
69 } 73 }
70 return library; 74 return library;
71 }); 75 });
72 return builder; 76 return builder;
73 } 77 }
74 78
75 void ensureCoreLibrary() { 79 void ensureCoreLibrary() {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 Builder getNativeAnnotation() => target.getNativeAnnotation(this); 145 Builder getNativeAnnotation() => target.getNativeAnnotation(this);
142 146
143 Builder getAbstractClassInstantiationError() { 147 Builder getAbstractClassInstantiationError() {
144 return target.getAbstractClassInstantiationError(this); 148 return target.getAbstractClassInstantiationError(this);
145 } 149 }
146 } 150 }
147 151
148 String format(double d, int fractionDigits, int width) { 152 String format(double d, int fractionDigits, int width) {
149 return d.toStringAsFixed(fractionDigits).padLeft(width); 153 return d.toStringAsFixed(fractionDigits).padLeft(width);
150 } 154 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698