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

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

Issue 2880453005: Build up and pass MemoryFileSystem to fasta frontend. (Closed)
Patch Set: Merge branch 'master' of github.com:dart-lang/sdk into build-memory-fs 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; 5 library fasta;
6 6
7 import 'dart:async' show Future; 7 import 'dart:async' show Future;
8 8
9 import 'dart:convert' show JSON; 9 import 'dart:convert' show JSON;
10 10
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 Uri uri = c.options.output; 157 Uri uri = c.options.output;
158 await kernelTarget.writeProgram(uri, 158 await kernelTarget.writeProgram(uri,
159 dumpIr: c.options.dumpIr, verify: c.options.verify); 159 dumpIr: c.options.dumpIr, verify: c.options.verify);
160 return uri; 160 return uri;
161 } 161 }
162 } 162 }
163 163
164 Future<CompilationResult> parseScript( 164 Future<CompilationResult> parseScript(
165 Uri fileName, Uri packages, Uri patchedSdk, 165 Uri fileName, Uri packages, Uri patchedSdk,
166 {bool verbose: false, bool strongMode: false}) async { 166 {bool verbose: false, bool strongMode: false}) async {
167 return parseScriptInFileSystem(
168 fileName, PhysicalFileSystem.instance, packages, patchedSdk,
169 verbose: verbose, strongMode: strongMode);
170 }
171
172 Future<CompilationResult> parseScriptInFileSystem(
173 Uri fileName, FileSystem fileSystem, Uri packages, Uri patchedSdk,
174 {bool verbose: false, bool strongMode: false}) async {
167 try { 175 try {
168 if (!await new File.fromUri(fileName).exists()) { 176 if (!await fileSystem.entityForUri(fileName).exists()) {
169 return new CompilationResult.error( 177 return new CompilationResult.error(
170 formatUnexpected(fileName, -1, "No such file.")); 178 formatUnexpected(fileName, -1, "No such file."));
171 } 179 }
172 if (!await new Directory.fromUri(patchedSdk).exists()) { 180 if (!await new Directory.fromUri(patchedSdk).exists()) {
173 return new CompilationResult.error( 181 return new CompilationResult.error(
174 formatUnexpected(patchedSdk, -1, "Patched sdk directory not found.")); 182 formatUnexpected(patchedSdk, -1, "Patched sdk directory not found."));
175 } 183 }
176 184
177 Program program; 185 Program program;
178 try { 186 try {
179 TranslateUri uriTranslator = 187 TranslateUri uriTranslator =
180 await TranslateUri.parse(PhysicalFileSystem.instance, null, packages); 188 await TranslateUri.parse(fileSystem, null, packages);
181 final Ticker ticker = new Ticker(isVerbose: verbose); 189 final Ticker ticker = new Ticker(isVerbose: verbose);
182 final DillTarget dillTarget = new DillTarget(ticker, uriTranslator); 190 final DillTarget dillTarget = new DillTarget(ticker, uriTranslator);
183 _appendDillForUri(dillTarget, patchedSdk.resolve('platform.dill')); 191 _appendDillForUri(dillTarget, patchedSdk.resolve('platform.dill'));
184 final KernelTarget kernelTarget = new KernelTarget( 192 final KernelTarget kernelTarget =
185 PhysicalFileSystem.instance, dillTarget, uriTranslator, strongMode); 193 new KernelTarget(fileSystem, dillTarget, uriTranslator, strongMode);
186 kernelTarget.read(fileName); 194 kernelTarget.read(fileName);
187 await dillTarget.writeOutline(null); 195 await dillTarget.writeOutline(null);
188 program = await kernelTarget.writeOutline(null); 196 program = await kernelTarget.writeOutline(null);
189 program = await kernelTarget.writeProgram(null); 197 program = await kernelTarget.writeProgram(null);
190 if (kernelTarget.errors.isNotEmpty) { 198 if (kernelTarget.errors.isNotEmpty) {
191 return new CompilationResult.errors(kernelTarget.errors 199 return new CompilationResult.errors(kernelTarget.errors
192 .map((err) => err.toString()) 200 .map((err) => err.toString())
193 .toList(growable: false)); 201 .toList(growable: false));
194 } 202 }
195 } on InputError catch (e) { 203 } on InputError catch (e) {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 final BytesBuilder builder = new BytesBuilder(); 284 final BytesBuilder builder = new BytesBuilder();
277 285
278 void add(List<int> data) { 286 void add(List<int> data) {
279 builder.add(data); 287 builder.add(data);
280 } 288 }
281 289
282 void close() { 290 void close() {
283 // Nothing to do. 291 // Nothing to do.
284 } 292 }
285 } 293 }
OLDNEW
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/vm.dart » ('j') | utils/kernel-service/kernel-service.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698