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:io' show FileSystemException; | 9 import 'dart:io' show FileSystemException; |
| 10 | 10 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 56 return inputError(library.uri, -1, "Not found: ${library.uri}."); | 56 return inputError(library.uri, -1, "Not found: ${library.uri}."); |
| 57 } | 57 } |
| 58 try { | 58 try { |
| 59 List<int> bytes = sourceBytes[uri]; | 59 List<int> bytes = sourceBytes[uri]; |
| 60 if (bytes == null) { | 60 if (bytes == null) { |
| 61 bytes = sourceBytes[uri] = await readBytesFromFile(uri); | 61 bytes = sourceBytes[uri] = await readBytesFromFile(uri); |
| 62 } | 62 } |
| 63 byteCount += bytes.length - 1; | 63 byteCount += bytes.length - 1; |
| 64 ScannerResult result = scan(bytes); | 64 ScannerResult result = scan(bytes); |
| 65 Token token = result.tokens; | 65 Token token = result.tokens; |
| 66 if (!suppressLexicalErrors) { | 66 target.addLineStarts(library.fileUri, result.lineStarts); |
|
ahe
2017/03/03 09:03:58
Are you sure this is necessary?
| |
| 67 target.addLineStarts(library.fileUri, result.lineStarts); | |
| 68 } | |
| 69 while (token is ErrorToken) { | 67 while (token is ErrorToken) { |
| 70 if (!suppressLexicalErrors) { | 68 if (!suppressLexicalErrors) { |
| 71 ErrorToken error = token; | 69 ErrorToken error = token; |
| 72 printUnexpected(uri, token.charOffset, error.assertionMessage); | 70 printUnexpected(uri, token.charOffset, error.assertionMessage); |
| 73 } | 71 } |
| 74 token = token.next; | 72 token = token.next; |
| 75 } | 73 } |
| 76 return token; | 74 return token; |
| 77 } on FileSystemException catch (e) { | 75 } on FileSystemException catch (e) { |
| 78 String message = e.message; | 76 String message = e.message; |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 337 | 335 |
| 338 void computeHierarchy(Program program) { | 336 void computeHierarchy(Program program) { |
| 339 hierarchy = new ClassHierarchy(program); | 337 hierarchy = new ClassHierarchy(program); |
| 340 ticker.logMs("Computed class hierarchy"); | 338 ticker.logMs("Computed class hierarchy"); |
| 341 coreTypes = new CoreTypes(program); | 339 coreTypes = new CoreTypes(program); |
| 342 ticker.logMs("Computed core types"); | 340 ticker.logMs("Computed core types"); |
| 343 } | 341 } |
| 344 | 342 |
| 345 List<Uri> getDependencies() => sourceBytes.keys.toList(); | 343 List<Uri> getDependencies() => sourceBytes.keys.toList(); |
| 346 } | 344 } |
| OLD | NEW |