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

Unified Diff: pkg/analyzer/lib/src/generated/error_verifier.dart

Issue 2639883005: Add parser support for covariant parameters (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « pkg/analyzer/lib/src/error/codes.dart ('k') | pkg/analyzer/lib/src/generated/parser.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/error_verifier.dart
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index befeccf958640ff7291ed70d062ba857e77308f3..c68aa1e3353617af79685e16289749774938c305 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -739,6 +739,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
@override
Object visitFormalParameterList(FormalParameterList node) {
_checkDuplicateDefinitionInParameterList(node);
+ _checkUseOfCovariantInParameters(node);
return super.visitFormalParameterList(node);
}
@@ -6170,6 +6171,23 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
}
+ void _checkUseOfCovariantInParameters(FormalParameterList node) {
+ AstNode parent = node.parent;
+ if (parent is MethodDeclaration && !parent.isStatic) {
+ return;
+ }
+ NodeList<FormalParameter> parameters = node.parameters;
+ int length = parameters.length;
+ for (int i = 0; i < length; i++) {
+ FormalParameter parameter = parameters[i];
+ Token keyword = parameter.covariantKeyword;
+ if (keyword != null) {
+ _errorReporter.reportErrorForToken(
+ CompileTimeErrorCode.INVALID_USE_OF_COVARIANT, keyword);
+ }
+ }
+ }
+
DartType _computeReturnTypeForMethod(Expression returnExpression) {
// This method should never be called for generators, since generators are
// never allowed to contain return statements with expressions.
« no previous file with comments | « pkg/analyzer/lib/src/error/codes.dart ('k') | pkg/analyzer/lib/src/generated/parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698