Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 73 | 73 |
| 74 TypeInferenceEngine typeInferenceEngine; | 74 TypeInferenceEngine typeInferenceEngine; |
| 75 | 75 |
| 76 Instrumentation instrumentation; | 76 Instrumentation instrumentation; |
| 77 | 77 |
| 78 SourceLoader(this.fileSystem, KernelTarget target) : super(target); | 78 SourceLoader(this.fileSystem, KernelTarget target) : super(target); |
| 79 | 79 |
| 80 Future<Token> tokenize(SourceLibraryBuilder library, | 80 Future<Token> tokenize(SourceLibraryBuilder library, |
| 81 {bool suppressLexicalErrors: false}) async { | 81 {bool suppressLexicalErrors: false}) async { |
| 82 Uri uri = library.fileUri; | 82 Uri uri = library.fileUri; |
| 83 if (uri == null || uri.scheme != "file") { | 83 String scheme = uri?.scheme; |
| 84 if (uri == null || (scheme != "file" && scheme != "multi-root")) { | |
|
Siggi Cherem (dart-lang)
2017/07/01 04:09:57
I'm not super happy with this part of the change,
Paul Berry
2017/07/04 15:32:17
Agreed, I'm not thrilled with this either. A part
Siggi Cherem (dart-lang)
2017/07/05 22:48:30
I like your suggestion. In dart2js we also have a
| |
| 84 return inputError(library.uri, -1, "Not found: ${library.uri}."); | 85 return inputError(library.uri, -1, "Not found: ${library.uri}."); |
| 85 } | 86 } |
| 86 | 87 |
| 87 // Get the library text from the cache, or read from the file system. | 88 // Get the library text from the cache, or read from the file system. |
| 88 List<int> bytes = sourceBytes[uri]; | 89 List<int> bytes = sourceBytes[uri]; |
| 89 if (bytes == null) { | 90 if (bytes == null) { |
| 90 try { | 91 try { |
| 91 List<int> rawBytes = await fileSystem.entityForUri(uri).readAsBytes(); | 92 List<int> rawBytes = await fileSystem.entityForUri(uri).readAsBytes(); |
| 92 Uint8List zeroTerminatedBytes = new Uint8List(rawBytes.length + 1); | 93 Uint8List zeroTerminatedBytes = new Uint8List(rawBytes.length + 1); |
| 93 zeroTerminatedBytes.setRange(0, rawBytes.length, rawBytes); | 94 zeroTerminatedBytes.setRange(0, rawBytes.length, rawBytes); |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 512 | 513 |
| 513 Expression throwCompileConstantError(Expression error) { | 514 Expression throwCompileConstantError(Expression error) { |
| 514 return target.backendTarget.throwCompileConstantError(coreTypes, error); | 515 return target.backendTarget.throwCompileConstantError(coreTypes, error); |
| 515 } | 516 } |
| 516 | 517 |
| 517 Expression buildCompileTimeError(String message, int offset) { | 518 Expression buildCompileTimeError(String message, int offset) { |
| 518 return target.backendTarget | 519 return target.backendTarget |
| 519 .buildCompileTimeError(coreTypes, message, offset); | 520 .buildCompileTimeError(coreTypes, message, offset); |
| 520 } | 521 } |
| 521 } | 522 } |
| OLD | NEW |