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

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

Issue 3006483002: Remove check for scheme in source-loader. (Closed)
Patch Set: Created 3 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 TypeInferenceEngine typeInferenceEngine; 89 TypeInferenceEngine typeInferenceEngine;
90 90
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
100 // underlying file system to decide whether it is supported.
101 if (uri == null || uri.scheme != "file" && uri.scheme != "multi-root") {
Siggi Cherem (dart-lang) 2017/08/23 20:38:33 note that the `fileSystem.entityForUri` call below
ahe 2017/08/24 10:08:53 The following situations are still erroneous at th
Siggi Cherem (dart-lang) 2017/08/24 18:55:19 Done - as you suggested now I'm checking for null
ahe 2017/08/25 08:52:31 That's odd. When I ran the test with this code rem
102 return deprecated_inputError(
103 library.uri, -1, "Not found: ${library.uri}.");
104 }
105 99
106 // Get the library text from the cache, or read from the file system. 100 // Get the library text from the cache, or read from the file system.
107 List<int> bytes = sourceBytes[uri]; 101 List<int> bytes = sourceBytes[uri];
108 if (bytes == null) { 102 if (bytes == null) {
109 try { 103 try {
110 List<int> rawBytes = await fileSystem.entityForUri(uri).readAsBytes(); 104 List<int> rawBytes = await fileSystem.entityForUri(uri).readAsBytes();
111 Uint8List zeroTerminatedBytes = new Uint8List(rawBytes.length + 1); 105 Uint8List zeroTerminatedBytes = new Uint8List(rawBytes.length + 1);
112 zeroTerminatedBytes.setRange(0, rawBytes.length, rawBytes); 106 zeroTerminatedBytes.setRange(0, rawBytes.length, rawBytes);
113 bytes = zeroTerminatedBytes; 107 bytes = zeroTerminatedBytes;
114 sourceBytes[uri] = bytes; 108 sourceBytes[uri] = bytes;
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 Expression throwCompileConstantError(Expression error) { 540 Expression throwCompileConstantError(Expression error) {
547 return target.backendTarget.throwCompileConstantError(coreTypes, error); 541 return target.backendTarget.throwCompileConstantError(coreTypes, error);
548 } 542 }
549 543
550 Expression buildCompileTimeError(Message message, int offset, Uri uri) { 544 Expression buildCompileTimeError(Message message, int offset, Uri uri) {
551 String text = target.context 545 String text = target.context
552 .format(message.withLocation(uri, offset), Severity.error); 546 .format(message.withLocation(uri, offset), Severity.error);
553 return target.backendTarget.buildCompileTimeError(coreTypes, text, offset); 547 return target.backendTarget.buildCompileTimeError(coreTypes, text, offset);
554 } 548 }
555 } 549 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698