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

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: Merged with 1333f97b9a0e3805f991578ef83b0ec4553ecf33 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
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 /// 46 ///
47 /// The [accessor] is the library that's trying to import, export, or include 47 /// The [accessor] is the library that's trying to import, export, or include
48 /// as part [uri], and [charOffset] is the location of the corresponding 48 /// as part [uri], and [charOffset] is the location of the corresponding
49 /// directive. If [accessor] isn't allowed to access [uri], it's a 49 /// directive. If [accessor] isn't allowed to access [uri], it's a
50 /// compile-time error. 50 /// compile-time error.
51 LibraryBuilder read(Uri uri, int charOffset, 51 LibraryBuilder read(Uri uri, int charOffset,
52 {Uri fileUri, LibraryBuilder accessor}) { 52 {Uri fileUri, LibraryBuilder accessor, bool isPatch: false}) {
53 firstSourceUri ??= uri; 53 firstSourceUri ??= uri;
54 LibraryBuilder builder = builders.putIfAbsent(uri, () { 54 LibraryBuilder builder = builders.putIfAbsent(uri, () {
55 if (fileUri == null) { 55 if (fileUri == null) {
56 switch (uri.scheme) { 56 switch (uri.scheme) {
57 case "package": 57 case "package":
58 case "dart": 58 case "dart":
59 fileUri = target.translateUri(uri); 59 fileUri = target.translateUri(uri);
60 break; 60 break;
61 61
62 default: 62 default:
63 fileUri = uri; 63 fileUri = uri;
64 break; 64 break;
65 } 65 }
66 } 66 }
67 LibraryBuilder library = target.createLibraryBuilder(uri, fileUri); 67 LibraryBuilder library =
68 target.createLibraryBuilder(uri, fileUri, isPatch);
68 if (uri.scheme == "dart" && uri.path == "core") { 69 if (uri.scheme == "dart" && uri.path == "core") {
69 coreLibrary = library; 70 coreLibrary = library;
70 target.loadExtraRequiredLibraries(this); 71 target.loadExtraRequiredLibraries(this);
71 } 72 }
73 if (uri.scheme == "dart") {
74 target.readPatchFiles(library);
75 }
72 first ??= library; 76 first ??= library;
73 if (library.loader == this) { 77 if (library.loader == this) {
74 unparsedLibraries.addLast(library); 78 unparsedLibraries.addLast(library);
75 } 79 }
76 return library; 80 return library;
77 }); 81 });
78 // TODO(ahe): Check that [accessor] is allowed to access [builder]. 82 // TODO(ahe): Check that [accessor] is allowed to access [builder].
79 return builder; 83 return builder;
80 } 84 }
81 85
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 Builder getNativeAnnotation() => target.getNativeAnnotation(this); 152 Builder getNativeAnnotation() => target.getNativeAnnotation(this);
149 153
150 Builder getAbstractClassInstantiationError() { 154 Builder getAbstractClassInstantiationError() {
151 return target.getAbstractClassInstantiationError(this); 155 return target.getAbstractClassInstantiationError(this);
152 } 156 }
153 } 157 }
154 158
155 String format(double d, int fractionDigits, int width) { 159 String format(double d, int fractionDigits, int width) {
156 return d.toStringAsFixed(fractionDigits).padLeft(width); 160 return d.toStringAsFixed(fractionDigits).padLeft(width);
157 } 161 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/kernel/kernel_target.dart ('k') | pkg/front_end/lib/src/fasta/source/diet_listener.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698