Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(457)

Unified Diff: pkg/front_end/lib/src/fasta/kernel/verifier.dart

Issue 2721623002: Let parser handle factory modifiers. (Closed)
Patch Set: Handle factory modifiers correctly in dart2js. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 7a0c16c0c2d5e8b26a66616bdfc8f90423f91386..c943f9e1ff438473553f8247dbafd46a5ca1d3da 100644
--- a/pkg/front_end/lib/src/fasta/kernel/verifier.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/verifier.dart
@@ -5,25 +5,49 @@
library fasta.verifier;
import 'package:kernel/ast.dart' show
+ Class,
ExpressionStatement,
- Program;
+ Field,
+ Library,
+ Procedure,
+ Program,
+ TreeNode;
import 'package:kernel/verifier.dart' show
+ VerificationError,
VerifyingVisitor;
+import '../errors.dart' show
+ printUnexpected;
+
import 'redirecting_factory_body.dart' show
RedirectingFactoryBody;
void verifyProgram(Program program, {bool isOutline: false}) {
- program.accept(new FastaVerifyingVisitor(isOutline));
+ FastaVerifyingVisitor verifier = new FastaVerifyingVisitor(isOutline);
+ program.accept(verifier);
+ if (verifier.errors.isNotEmpty) {
+ throw verifier.errors.first;
+ }
}
class FastaVerifyingVisitor extends VerifyingVisitor {
+ final List<VerificationError> errors = <VerificationError>[];
+
+ String fileUri;
+
FastaVerifyingVisitor(bool isOutline) {
this.isOutline = isOutline;
}
@override
+ problem(TreeNode node, String details) {
Johnni Winther 2017/02/28 13:36:39 No use of this yet?
ahe 2017/02/28 13:46:25 It's used a lot in the superclass. Too much, I thi
+ VerificationError error = new VerificationError(context, node, details);
+ printUnexpected(Uri.parse(fileUri), node.fileOffset, "$error");
+ errors.add(error);
+ }
+
+ @override
visitExpressionStatement(ExpressionStatement node) {
// Bypass verification of the [StaticGet] in [RedirectingFactoryBody] as
// this is a static get without a getter.
@@ -31,4 +55,24 @@ class FastaVerifyingVisitor extends VerifyingVisitor {
super.visitExpressionStatement(node);
}
}
+
+ visitLibrary(Library node) {
+ fileUri = node.fileUri;
+ super.visitLibrary(node);
+ }
+
+ visitClass(Class node) {
+ fileUri = node.fileUri;
+ super.visitClass(node);
+ }
+
+ visitField(Field node) {
+ fileUri = node.fileUri;
+ super.visitField(node);
+ }
+
+ visitProcedure(Procedure node) {
+ fileUri = node.fileUri;
+ super.visitProcedure(node);
+ }
}
« no previous file with comments | « pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart ('k') | pkg/front_end/lib/src/fasta/parser/parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698