| 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:typed_data' show Uint8List; | 9 import 'dart:typed_data' show Uint8List; |
| 10 | 10 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 import '../export.dart' show Export; | 37 import '../export.dart' show Export; |
| 38 | 38 |
| 39 import '../fasta_codes.dart' | 39 import '../fasta_codes.dart' |
| 40 show | 40 show |
| 41 templateCyclicClassHierarchy, | 41 templateCyclicClassHierarchy, |
| 42 templateExtendingEnum, | 42 templateExtendingEnum, |
| 43 templateExtendingRestricted, | 43 templateExtendingRestricted, |
| 44 templateIllegalMixin, | 44 templateIllegalMixin, |
| 45 templateIllegalMixinDueToConstructors, | 45 templateIllegalMixinDueToConstructors, |
| 46 templateIllegalMixinDueToConstructorsCause; | 46 templateIllegalMixinDueToConstructorsCause, |
| 47 templateUnspecified; |
| 47 | 48 |
| 48 import '../kernel/kernel_shadow_ast.dart' show KernelTypeInferenceEngine; | 49 import '../kernel/kernel_shadow_ast.dart' show KernelTypeInferenceEngine; |
| 49 | 50 |
| 50 import '../kernel/kernel_target.dart' show KernelTarget; | 51 import '../kernel/kernel_target.dart' show KernelTarget; |
| 51 | 52 |
| 52 import '../loader.dart' show Loader; | 53 import '../loader.dart' show Loader; |
| 53 | 54 |
| 54 import '../parser/class_member_parser.dart' show ClassMemberParser; | 55 import '../parser/class_member_parser.dart' show ClassMemberParser; |
| 55 | 56 |
| 56 import '../scanner.dart' show ErrorToken, ScannerResult, Token, scan; | 57 import '../scanner.dart' show ErrorToken, ScannerResult, Token, scan; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 byteCount += bytes.length - 1; | 112 byteCount += bytes.length - 1; |
| 112 ScannerResult result = scan(bytes); | 113 ScannerResult result = scan(bytes); |
| 113 Token token = result.tokens; | 114 Token token = result.tokens; |
| 114 if (!suppressLexicalErrors) { | 115 if (!suppressLexicalErrors) { |
| 115 List<int> source = getSource(bytes); | 116 List<int> source = getSource(bytes); |
| 116 target.addSourceInformation(library.fileUri, result.lineStarts, source); | 117 target.addSourceInformation(library.fileUri, result.lineStarts, source); |
| 117 } | 118 } |
| 118 while (token is ErrorToken) { | 119 while (token is ErrorToken) { |
| 119 if (!suppressLexicalErrors) { | 120 if (!suppressLexicalErrors) { |
| 120 ErrorToken error = token; | 121 ErrorToken error = token; |
| 121 library.deprecated_addCompileTimeError( | 122 library.addCompileTimeError( |
| 122 token.charOffset, error.assertionMessage, | 123 templateUnspecified.withArguments(error.assertionMessage), |
| 123 fileUri: uri); | 124 token.charOffset, |
| 125 uri); |
| 124 } | 126 } |
| 125 token = token.next; | 127 token = token.next; |
| 126 } | 128 } |
| 127 return token; | 129 return token; |
| 128 } | 130 } |
| 129 | 131 |
| 130 List<int> getSource(List<int> bytes) { | 132 List<int> getSource(List<int> bytes) { |
| 131 if (excludeSource) return const <int>[]; | 133 if (excludeSource) return const <int>[]; |
| 132 | 134 |
| 133 // bytes is 0-terminated. We don't want that included. | 135 // bytes is 0-terminated. We don't want that included. |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 | 524 |
| 523 Expression throwCompileConstantError(Expression error) { | 525 Expression throwCompileConstantError(Expression error) { |
| 524 return target.backendTarget.throwCompileConstantError(coreTypes, error); | 526 return target.backendTarget.throwCompileConstantError(coreTypes, error); |
| 525 } | 527 } |
| 526 | 528 |
| 527 Expression deprecated_buildCompileTimeError(String message, int offset) { | 529 Expression deprecated_buildCompileTimeError(String message, int offset) { |
| 528 return target.backendTarget | 530 return target.backendTarget |
| 529 .buildCompileTimeError(coreTypes, message, offset); | 531 .buildCompileTimeError(coreTypes, message, offset); |
| 530 } | 532 } |
| 531 } | 533 } |
| OLD | NEW |