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.verifier; | 5 library fasta.verifier; |
6 | 6 |
7 import 'package:kernel/ast.dart' | 7 import 'package:kernel/ast.dart' |
8 show | 8 show |
| 9 InvalidExpression, |
| 10 InvalidStatement, |
| 11 InvalidInitializer, |
9 Class, | 12 Class, |
10 ExpressionStatement, | 13 ExpressionStatement, |
11 Field, | 14 Field, |
12 Library, | 15 Library, |
13 Procedure, | 16 Procedure, |
14 Program, | 17 Program, |
15 TreeNode; | 18 TreeNode; |
16 | 19 |
17 import 'package:kernel/verifier.dart' show VerificationError, VerifyingVisitor; | 20 import 'package:kernel/verifier.dart' show VerificationError, VerifyingVisitor; |
18 | 21 |
(...skipping 13 matching lines...) Expand all Loading... |
32 final List<VerificationError> errors = <VerificationError>[]; | 35 final List<VerificationError> errors = <VerificationError>[]; |
33 | 36 |
34 String fileUri; | 37 String fileUri; |
35 | 38 |
36 FastaVerifyingVisitor(bool isOutline) { | 39 FastaVerifyingVisitor(bool isOutline) { |
37 this.isOutline = isOutline; | 40 this.isOutline = isOutline; |
38 } | 41 } |
39 | 42 |
40 @override | 43 @override |
41 problem(TreeNode node, String details) { | 44 problem(TreeNode node, String details) { |
| 45 // TODO(karlklose): Remove this when underlying problem is fixed. |
| 46 if (details.startsWith("Type parameter 'dart.collection::MapView::")) { |
| 47 return; |
| 48 } |
42 VerificationError error = new VerificationError(context, node, details); | 49 VerificationError error = new VerificationError(context, node, details); |
43 printUnexpected(Uri.parse(fileUri), node.fileOffset, "$error"); | 50 printUnexpected(Uri.parse(fileUri), node.fileOffset, "$error"); |
44 errors.add(error); | 51 errors.add(error); |
45 } | 52 } |
46 | 53 |
47 @override | 54 @override |
48 visitExpressionStatement(ExpressionStatement node) { | 55 visitExpressionStatement(ExpressionStatement node) { |
49 // Bypass verification of the [StaticGet] in [RedirectingFactoryBody] as | 56 // Bypass verification of the [StaticGet] in [RedirectingFactoryBody] as |
50 // this is a static get without a getter. | 57 // this is a static get without a getter. |
51 if (node is! RedirectingFactoryBody) { | 58 if (node is! RedirectingFactoryBody) { |
52 super.visitExpressionStatement(node); | 59 super.visitExpressionStatement(node); |
53 } | 60 } |
54 } | 61 } |
55 | 62 |
| 63 @override |
56 visitLibrary(Library node) { | 64 visitLibrary(Library node) { |
57 fileUri = node.fileUri; | 65 fileUri = node.fileUri; |
58 super.visitLibrary(node); | 66 super.visitLibrary(node); |
59 } | 67 } |
60 | 68 |
| 69 @override |
61 visitClass(Class node) { | 70 visitClass(Class node) { |
62 fileUri = node.fileUri; | 71 fileUri = node.fileUri; |
63 super.visitClass(node); | 72 super.visitClass(node); |
64 } | 73 } |
65 | 74 |
| 75 @override |
66 visitField(Field node) { | 76 visitField(Field node) { |
67 fileUri = node.fileUri; | 77 fileUri = node.fileUri; |
68 super.visitField(node); | 78 super.visitField(node); |
69 } | 79 } |
70 | 80 |
| 81 @override |
71 visitProcedure(Procedure node) { | 82 visitProcedure(Procedure node) { |
72 fileUri = node.fileUri; | 83 fileUri = node.fileUri; |
73 super.visitProcedure(node); | 84 super.visitProcedure(node); |
74 } | 85 } |
| 86 |
| 87 @override |
| 88 visitInvalidExpression(InvalidExpression node) { |
| 89 problem(node, "Invalid expression."); |
| 90 } |
| 91 |
| 92 @override |
| 93 visitInvalidStatement(InvalidStatement node) { |
| 94 problem(node, "Invalid statement."); |
| 95 } |
| 96 |
| 97 @override |
| 98 visitInvalidInitializer(InvalidInitializer node) { |
| 99 problem(node, "Invalid initializer."); |
| 100 } |
75 } | 101 } |
OLD | NEW |