| 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.uri; | 82 Uri uri = library.fileUri ?? library.uri; |
| 83 if (uri.scheme != "file") { | 83 if (uri.scheme != "file") { |
| 84 uri = target.translateUri(uri); | 84 uri = target.translateUri(uri); |
| 85 if (uri == null) { | 85 if (uri == null) { |
| 86 print("Skipping ${library.uri}"); | 86 print("Skipping ${library.uri}"); |
| 87 return null; | 87 return null; |
| 88 } | 88 } |
| 89 library.fileUri = uri; | 89 library.fileUri = uri; |
| 90 } | 90 } |
| 91 try { | 91 try { |
| 92 List<int> bytes = await readBytesFromFile(uri); | 92 List<int> bytes = await readBytesFromFile(uri); |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 ticker.logMs("Built analyzer element model."); | 351 ticker.logMs("Built analyzer element model."); |
| 352 } | 352 } |
| 353 | 353 |
| 354 void computeHierarchy(Program program) { | 354 void computeHierarchy(Program program) { |
| 355 hierarchy = new ClassHierarchy(program); | 355 hierarchy = new ClassHierarchy(program); |
| 356 ticker.logMs("Computed class hierarchy"); | 356 ticker.logMs("Computed class hierarchy"); |
| 357 coreTypes = new CoreTypes(program); | 357 coreTypes = new CoreTypes(program); |
| 358 ticker.logMs("Computed core types"); | 358 ticker.logMs("Computed core types"); |
| 359 } | 359 } |
| 360 } | 360 } |
| OLD | NEW |