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 7d4ed01d9b6dfaba797cc7014addba7da276d4a8..17c984c390ccd6891e7e25d6890e2f2192dc9341 100644 |
--- a/pkg/front_end/lib/src/fasta/kernel/verifier.dart |
+++ b/pkg/front_end/lib/src/fasta/kernel/verifier.dart |
@@ -4,9 +4,6 @@ |
library fasta.verifier; |
-import 'package:front_end/src/fasta/type_inference/type_schema.dart' |
- show TypeSchemaVisitor, UnknownType; |
- |
import 'package:kernel/ast.dart' |
show |
InvalidExpression, |
@@ -20,23 +17,28 @@ import 'package:kernel/ast.dart' |
Program, |
TreeNode; |
-import 'package:kernel/verifier.dart' show VerificationError, VerifyingVisitor; |
+import 'package:kernel/verifier.dart' show VerifyingVisitor; |
+ |
+import '../compiler_context.dart' show CompilerContext; |
+ |
+import '../fasta_codes.dart' |
+ show LocatedMessage, templateInternalVerificationError; |
-import '../deprecated_problems.dart' show deprecated_printUnexpected; |
+import '../severity.dart' show Severity; |
-import '../fasta_codes.dart'; |
+import '../type_inference/type_schema.dart' show TypeSchemaVisitor, UnknownType; |
import 'redirecting_factory_body.dart' show RedirectingFactoryBody; |
List<LocatedMessage> verifyProgram(Program program, {bool isOutline: false}) { |
FastaVerifyingVisitor verifier = new FastaVerifyingVisitor(isOutline); |
program.accept(verifier); |
- return verifier.errors.map(convertError).toList(); |
+ return verifier.errors; |
} |
class FastaVerifyingVisitor extends VerifyingVisitor |
implements TypeSchemaVisitor { |
- final List<VerificationError> errors = <VerificationError>[]; |
+ final List<LocatedMessage> errors = <LocatedMessage>[]; |
String fileUri; |
@@ -46,11 +48,13 @@ class FastaVerifyingVisitor extends VerifyingVisitor |
@override |
problem(TreeNode node, String details, {TreeNode context}) { |
- context ??= this.context; |
- VerificationError error = new VerificationError(context, node, details); |
- deprecated_printUnexpected( |
- Uri.parse(fileUri), node?.fileOffset ?? -1, "$error"); |
- errors.add(error); |
+ node ??= (context ?? this.context); |
+ int offset = node?.fileOffset ?? -1; |
+ LocatedMessage message = templateInternalVerificationError |
+ .withArguments(details) |
+ .withLocation(Uri.parse(fileUri), offset); |
+ CompilerContext.current.report(message, Severity.error); |
+ errors.add(message); |
} |
@override |
@@ -107,13 +111,3 @@ 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 templateInternalVerificationError |
- .withArguments(error.details) |
- .withLocation(uri, offset); |
-} |