| 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 14 matching lines...) Expand all Loading... |
| 25 import 'package:kernel/ast.dart' show | 25 import 'package:kernel/ast.dart' show |
| 26 Program; | 26 Program; |
| 27 | 27 |
| 28 import 'package:kernel/class_hierarchy.dart' show | 28 import 'package:kernel/class_hierarchy.dart' show |
| 29 ClassHierarchy; | 29 ClassHierarchy; |
| 30 | 30 |
| 31 import 'package:kernel/core_types.dart' show | 31 import 'package:kernel/core_types.dart' show |
| 32 CoreTypes; | 32 CoreTypes; |
| 33 | 33 |
| 34 import '../errors.dart' show | 34 import '../errors.dart' show |
| 35 InputError, | 35 inputError, |
| 36 inputError; | 36 printUnexpected; |
| 37 | 37 |
| 38 import '../messages.dart' show | 38 import '../messages.dart' show |
| 39 warning; | 39 warning; |
| 40 | 40 |
| 41 import '../export.dart' show | 41 import '../export.dart' show |
| 42 Export; | 42 Export; |
| 43 | 43 |
| 44 import '../analyzer/element_store.dart' show | 44 import '../analyzer/element_store.dart' show |
| 45 ElementStore; | 45 ElementStore; |
| 46 | 46 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 List<int> bytes = await readBytesFromFile(uri); | 91 List<int> bytes = await readBytesFromFile(uri); |
| 92 byteCount += bytes.length - 1; | 92 byteCount += bytes.length - 1; |
| 93 ScannerResult result = scan(bytes); | 93 ScannerResult result = scan(bytes); |
| 94 Token token = result.tokens; | 94 Token token = result.tokens; |
| 95 if (!suppressLexicalErrors) { | 95 if (!suppressLexicalErrors) { |
| 96 target.addLineStarts(library.fileUri, result.lineStarts); | 96 target.addLineStarts(library.fileUri, result.lineStarts); |
| 97 } | 97 } |
| 98 while (token is ErrorToken) { | 98 while (token is ErrorToken) { |
| 99 if (!suppressLexicalErrors) { | 99 if (!suppressLexicalErrors) { |
| 100 ErrorToken error = token; | 100 ErrorToken error = token; |
| 101 print(new InputError(uri, token.charOffset, error.assertionMessage) | 101 printUnexpected(uri, token.charOffset, error.assertionMessage); |
| 102 .format()); | |
| 103 } | 102 } |
| 104 token = token.next; | 103 token = token.next; |
| 105 } | 104 } |
| 106 return token; | 105 return token; |
| 107 } on FileSystemException catch (e) { | 106 } on FileSystemException catch (e) { |
| 108 String message = e.message; | 107 String message = e.message; |
| 109 String osMessage = e.osError?.message; | 108 String osMessage = e.osError?.message; |
| 110 if (osMessage != null && osMessage.isNotEmpty) { | 109 if (osMessage != null && osMessage.isNotEmpty) { |
| 111 message = osMessage; | 110 message = osMessage; |
| 112 } | 111 } |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 ticker.logMs("Built analyzer element model."); | 363 ticker.logMs("Built analyzer element model."); |
| 365 } | 364 } |
| 366 | 365 |
| 367 void computeHierarchy(Program program) { | 366 void computeHierarchy(Program program) { |
| 368 hierarchy = new ClassHierarchy(program); | 367 hierarchy = new ClassHierarchy(program); |
| 369 ticker.logMs("Computed class hierarchy"); | 368 ticker.logMs("Computed class hierarchy"); |
| 370 coreTypes = new CoreTypes(program); | 369 coreTypes = new CoreTypes(program); |
| 371 ticker.logMs("Computed core types"); | 370 ticker.logMs("Computed core types"); |
| 372 } | 371 } |
| 373 } | 372 } |
| OLD | NEW |