| Index: pkg/front_end/lib/src/fasta/source/source_loader.dart
|
| diff --git a/pkg/front_end/lib/src/fasta/source/source_loader.dart b/pkg/front_end/lib/src/fasta/source/source_loader.dart
|
| index 76d3f612181ea3ae3d533d89b2f86d34de124d3c..fc70b06c27d4703dcb2850fbd67a94be706a8f20 100644
|
| --- a/pkg/front_end/lib/src/fasta/source/source_loader.dart
|
| +++ b/pkg/front_end/lib/src/fasta/source/source_loader.dart
|
| @@ -6,8 +6,6 @@ library fasta.source_loader;
|
|
|
| import 'dart:async' show Future;
|
|
|
| -import 'dart:io' show FileSystemException;
|
| -
|
| import 'dart:typed_data' show Uint8List;
|
|
|
| import 'package:kernel/ast.dart' show Program;
|
| @@ -30,7 +28,7 @@ import '../parser/class_member_parser.dart' show ClassMemberParser;
|
|
|
| import '../scanner.dart' show ErrorToken, ScannerResult, Token, scan;
|
|
|
| -import '../scanner/io.dart' show readBytesFromFile;
|
| +import '../io.dart' show readBytesFromFile;
|
|
|
| import '../target_implementation.dart' show TargetImplementation;
|
|
|
| @@ -60,35 +58,26 @@ class SourceLoader<L> extends Loader<L> {
|
| if (uri == null || uri.scheme != "file") {
|
| return inputError(library.uri, -1, "Not found: ${library.uri}.");
|
| }
|
| - try {
|
| - List<int> bytes = sourceBytes[uri];
|
| - if (bytes == null) {
|
| - bytes = sourceBytes[uri] = await readBytesFromFile(uri);
|
| - }
|
| - byteCount += bytes.length - 1;
|
| - ScannerResult result = scan(bytes);
|
| - Token token = result.tokens;
|
| + List<int> bytes = sourceBytes[uri];
|
| + if (bytes == null) {
|
| + bytes = sourceBytes[uri] = await readBytesFromFile(uri);
|
| + }
|
| + byteCount += bytes.length - 1;
|
| + ScannerResult result = scan(bytes);
|
| + Token token = result.tokens;
|
| + if (!suppressLexicalErrors) {
|
| + List<int> source = getSource(bytes);
|
| + target.addSourceInformation(library.fileUri, result.lineStarts, source);
|
| + }
|
| + while (token is ErrorToken) {
|
| if (!suppressLexicalErrors) {
|
| - List<int> source = getSource(bytes);
|
| - target.addSourceInformation(library.fileUri, result.lineStarts, source);
|
| - }
|
| - while (token is ErrorToken) {
|
| - if (!suppressLexicalErrors) {
|
| - ErrorToken error = token;
|
| - library.addCompileTimeError(token.charOffset, error.assertionMessage,
|
| - fileUri: uri);
|
| - }
|
| - token = token.next;
|
| - }
|
| - return token;
|
| - } on FileSystemException catch (e) {
|
| - String message = e.message;
|
| - String osMessage = e.osError?.message;
|
| - if (osMessage != null && osMessage.isNotEmpty) {
|
| - message = osMessage;
|
| + ErrorToken error = token;
|
| + library.addCompileTimeError(token.charOffset, error.assertionMessage,
|
| + fileUri: uri);
|
| }
|
| - return inputError(uri, -1, message);
|
| + token = token.next;
|
| }
|
| + return token;
|
| }
|
|
|
| List<int> getSource(List<int> bytes) {
|
|
|