Chromium Code Reviews| Index: pkg/front_end/lib/src/fasta/kernel/verifier.dart |
| diff --git a/pkg/front_end/lib/src/fasta/kernel/verifier.dart b/pkg/front_end/lib/src/fasta/kernel/verifier.dart |
| index c98e6bc03d7f476857f514e92e19fc0e82f17588..6ba4a583c231480360730dd99791be7485c13253 100644 |
| --- a/pkg/front_end/lib/src/fasta/kernel/verifier.dart |
| +++ b/pkg/front_end/lib/src/fasta/kernel/verifier.dart |
| @@ -24,13 +24,14 @@ import 'package:kernel/verifier.dart' show VerificationError, VerifyingVisitor; |
| import '../deprecated_problems.dart' show deprecated_printUnexpected; |
| +import '../fasta_codes.dart'; |
| + |
| import 'redirecting_factory_body.dart' show RedirectingFactoryBody; |
| -List<VerificationError> verifyProgram(Program program, |
| - {bool isOutline: false}) { |
| +List<LocatedMessage> verifyProgram(Program program, {bool isOutline: false}) { |
|
Paul Berry
2017/07/11 16:00:59
I don't think it makes sense to use LocatedMessage
Siggi Cherem (dart-lang)
2017/07/12 00:29:46
I see your point and it is similar to the other er
Siggi Cherem (dart-lang)
2017/07/12 21:54:59
Just to close the loop here - we started using "In
|
| FastaVerifyingVisitor verifier = new FastaVerifyingVisitor(isOutline); |
| program.accept(verifier); |
| - return verifier.errors; |
| + return verifier.errors.map(convertError).toList(); |
| } |
| class FastaVerifyingVisitor extends VerifyingVisitor |
| @@ -106,3 +107,13 @@ class FastaVerifyingVisitor extends VerifyingVisitor |
| problem(null, "Unexpected appearance of the unknown type."); |
| } |
| } |
| + |
| +LocatedMessage convertError(VerificationError error) { |
| + var node = error.node ?? error.context; |
| + int offset = node?.fileOffset ?? -1; |
| + var file = node?.location?.file; |
| + Uri uri = file == null ? null : Uri.parse(file); |
| + return templateVerificationError |
| + .withArguments(error.details) |
| + .withLocation(uri, offset); |
| +} |