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

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

Issue 2997413002: Support --use-kernel in memory_compiler (Closed)
Patch Set: Created 3 years, 3 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.source_loader; 5 library fasta.source_loader;
6 6
7 import 'dart:async' show Future; 7 import 'dart:async' show Future;
8 8
9 import 'dart:typed_data' show Uint8List; 9 import 'dart:typed_data' show Uint8List;
10 10
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 Instrumentation instrumentation; 91 Instrumentation instrumentation;
92 92
93 SourceLoader(this.fileSystem, this.includeComments, KernelTarget target) 93 SourceLoader(this.fileSystem, this.includeComments, KernelTarget target)
94 : super(target); 94 : super(target);
95 95
96 Future<Token> tokenize(SourceLibraryBuilder library, 96 Future<Token> tokenize(SourceLibraryBuilder library,
97 {bool suppressLexicalErrors: false}) async { 97 {bool suppressLexicalErrors: false}) async {
98 Uri uri = library.fileUri; 98 Uri uri = library.fileUri;
99 // TODO(sigmund): source-loader shouldn't check schemes, but defer to the 99 // TODO(sigmund): source-loader shouldn't check schemes, but defer to the
100 // underlying file system to decide whether it is supported. 100 // underlying file system to decide whether it is supported.
101 if (uri == null || uri.scheme != "file" && uri.scheme != "multi-root") { 101 if (uri == null ||
102 uri.scheme != "file" &&
103 uri.scheme != "multi-root" &&
104 uri.scheme != "memory") {
Siggi Cherem (dart-lang) 2017/08/23 20:45:18 If you don't mind, let's revert the change on this
Johnni Winther 2017/08/24 06:47:54 I thought this might provoke you to fix the issue
102 return deprecated_inputError( 105 return deprecated_inputError(
103 library.uri, -1, "Not found: ${library.uri}."); 106 library.uri, -1, "Not found: ${library.uri}.");
104 } 107 }
105 108
106 // Get the library text from the cache, or read from the file system. 109 // Get the library text from the cache, or read from the file system.
107 List<int> bytes = sourceBytes[uri]; 110 List<int> bytes = sourceBytes[uri];
108 if (bytes == null) { 111 if (bytes == null) {
109 try { 112 try {
110 List<int> rawBytes = await fileSystem.entityForUri(uri).readAsBytes(); 113 List<int> rawBytes = await fileSystem.entityForUri(uri).readAsBytes();
111 Uint8List zeroTerminatedBytes = new Uint8List(rawBytes.length + 1); 114 Uint8List zeroTerminatedBytes = new Uint8List(rawBytes.length + 1);
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 Expression throwCompileConstantError(Expression error) { 536 Expression throwCompileConstantError(Expression error) {
534 return target.backendTarget.throwCompileConstantError(coreTypes, error); 537 return target.backendTarget.throwCompileConstantError(coreTypes, error);
535 } 538 }
536 539
537 Expression buildCompileTimeError(Message message, int offset, Uri uri) { 540 Expression buildCompileTimeError(Message message, int offset, Uri uri) {
538 String text = target.context 541 String text = target.context
539 .format(message.withLocation(uri, offset), Severity.error); 542 .format(message.withLocation(uri, offset), Severity.error);
540 return target.backendTarget.buildCompileTimeError(coreTypes, text, offset); 543 return target.backendTarget.buildCompileTimeError(coreTypes, text, offset);
541 } 544 }
542 } 545 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698