| 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 | 7 import 'dart:async' show |
| 8 Future; | 8 Future; |
| 9 | 9 |
| 10 import 'dart:io' show | 10 import 'dart:io' show |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 CoreTypes coreTypes; | 72 CoreTypes coreTypes; |
| 73 | 73 |
| 74 // Used when building analyzer ASTs. | 74 // Used when building analyzer ASTs. |
| 75 ElementStore elementStore; | 75 ElementStore elementStore; |
| 76 | 76 |
| 77 SourceLoader(TargetImplementation target) | 77 SourceLoader(TargetImplementation target) |
| 78 : super(target); | 78 : 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 ?? library.uri; | 82 Uri uri = library.fileUri; |
| 83 if (uri.scheme != "file") { | 83 if (uri == null || uri.scheme != "file") { |
| 84 uri = target.translateUri(uri); | 84 return inputError(library.uri, -1, "Not found: ${library.uri}."); |
| 85 if (uri == null) { | |
| 86 print("Skipping ${library.uri}"); | |
| 87 return null; | |
| 88 } | |
| 89 library.fileUri = uri; | |
| 90 } | 85 } |
| 91 try { | 86 try { |
| 92 List<int> bytes = await readBytesFromFile(uri); | 87 List<int> bytes = await readBytesFromFile(uri); |
| 93 byteCount += bytes.length - 1; | 88 byteCount += bytes.length - 1; |
| 94 Token token = scan(bytes).tokens; | 89 Token token = scan(bytes).tokens; |
| 95 while (token is ErrorToken) { | 90 while (token is ErrorToken) { |
| 96 if (!suppressLexicalErrors) { | 91 if (!suppressLexicalErrors) { |
| 97 ErrorToken error = token; | 92 ErrorToken error = token; |
| 98 String message = new InputError( | 93 String message = new InputError( |
| 99 uri, token.charOffset, error.assertionMessage).format(); | 94 uri, token.charOffset, error.assertionMessage).format(); |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 ticker.logMs("Built analyzer element model."); | 346 ticker.logMs("Built analyzer element model."); |
| 352 } | 347 } |
| 353 | 348 |
| 354 void computeHierarchy(Program program) { | 349 void computeHierarchy(Program program) { |
| 355 hierarchy = new ClassHierarchy(program); | 350 hierarchy = new ClassHierarchy(program); |
| 356 ticker.logMs("Computed class hierarchy"); | 351 ticker.logMs("Computed class hierarchy"); |
| 357 coreTypes = new CoreTypes(program); | 352 coreTypes = new CoreTypes(program); |
| 358 ticker.logMs("Computed core types"); | 353 ticker.logMs("Computed core types"); |
| 359 } | 354 } |
| 360 } | 355 } |
| OLD | NEW |