OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:typed_data'; | 6 import 'dart:typed_data'; |
7 | 7 |
8 import 'package:front_end/file_system.dart'; | 8 import 'package:front_end/file_system.dart'; |
9 import 'package:front_end/src/fasta/parser/top_level_parser.dart'; | 9 import 'package:front_end/src/fasta/parser/top_level_parser.dart'; |
10 import 'package:front_end/src/fasta/scanner.dart'; | 10 import 'package:front_end/src/fasta/scanner.dart'; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 // 1) The absolute file URI. | 116 // 1) The absolute file URI. |
117 // 2) The absolute non-file URI, e.g. `package:foo/foo.dart`. | 117 // 2) The absolute non-file URI, e.g. `package:foo/foo.dart`. |
118 Uri absoluteUri; | 118 Uri absoluteUri; |
119 try { | 119 try { |
120 absoluteUri = fileUri.resolve(relativeUri); | 120 absoluteUri = fileUri.resolve(relativeUri); |
121 } on FormatException { | 121 } on FormatException { |
122 return; | 122 return; |
123 } | 123 } |
124 | 124 |
125 // Resolve the absolute URI into the absolute file URI. | 125 // Resolve the absolute URI into the absolute file URI. |
126 Uri resolvedUri = _fsState.uriTranslator.translate(absoluteUri); | 126 Uri resolvedUri; |
127 if (resolvedUri == null) return; | 127 if (absoluteUri.isScheme('file')) { |
| 128 resolvedUri = absoluteUri; |
| 129 } else { |
| 130 resolvedUri = _fsState.uriTranslator.translate(absoluteUri); |
| 131 if (resolvedUri == null) return; |
| 132 } |
128 | 133 |
129 FileState file = await _fsState.getFile(resolvedUri); | 134 FileState file = await _fsState.getFile(resolvedUri); |
130 files.add(file); | 135 files.add(file); |
131 } | 136 } |
132 | 137 |
133 /// Scan the content of the file. | 138 /// Scan the content of the file. |
134 ScannerResult _scan() { | 139 ScannerResult _scan() { |
135 var zeroTerminatedBytes = new Uint8List(_content.length + 1); | 140 var zeroTerminatedBytes = new Uint8List(_content.length + 1); |
136 zeroTerminatedBytes.setRange(0, _content.length, _content); | 141 zeroTerminatedBytes.setRange(0, _content.length, _content); |
137 return scan(zeroTerminatedBytes); | 142 return scan(zeroTerminatedBytes); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 Future<String> readAsString() async => _shouldNotBeQueried(); | 219 Future<String> readAsString() async => _shouldNotBeQueried(); |
215 | 220 |
216 /// _FileSystemViewEntry is used by the incremental kernel generator to | 221 /// _FileSystemViewEntry is used by the incremental kernel generator to |
217 /// provide Fasta with a consistent, race condition free view of the files | 222 /// provide Fasta with a consistent, race condition free view of the files |
218 /// constituting the project. It should only need to be used for reading | 223 /// constituting the project. It should only need to be used for reading |
219 /// file contents. | 224 /// file contents. |
220 dynamic _shouldNotBeQueried() { | 225 dynamic _shouldNotBeQueried() { |
221 throw new StateError('The method should not be invoked.'); | 226 throw new StateError('The method should not be invoked.'); |
222 } | 227 } |
223 } | 228 } |
OLD | NEW |