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

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

Issue 2656303004: Add a temporary analyzer error to work around #28515 (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
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 ffef5db56d9e8e3af77f73dad77cd3321a68c279..bcd5803d40d131df1a8d05879956c074c33c96b9 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -857,6 +857,14 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
[node.identifier]);
}
}
+
+ // TODO(paulberry): remove this once dartbug.com/28515 is fixed.
+ if (node.typeParameters != null) {
+ _errorReporter.reportErrorForNode(
+ CompileTimeErrorCode.GENERIC_FUNCTION_TYPED_PARAM_UNSUPPORTED,
+ node);
+ }
+
return super.visitFunctionTypedFormalParameter(node);
} finally {
_isInFunctionTypedFormalParameter = old;
@@ -2573,6 +2581,40 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
+ * Verifies that the class is not named `Function` and that it doesn't
+ * extends/implements/mixes in `Function`.
+ */
+ void _checkForBadFunctionUse(ClassDeclaration node) {
+ ExtendsClause extendsClause = node.extendsClause;
+ ImplementsClause implementsClause = node.implementsClause;
+ WithClause withClause = node.withClause;
+
+ if (node.name.name == "Function") {
+ _errorReporter.reportErrorForNode(
+ HintCode.DEPRECATED_FUNCTION_CLASS_DECLARATION, node.name);
+ }
+
+ if (extendsClause != null) {
+ InterfaceType superclassType = _enclosingClass.supertype;
+ ClassElement superclassElement = superclassType?.element;
+ if (superclassElement != null && superclassElement.name == "Function") {
+ _errorReporter.reportErrorForNode(
+ HintCode.DEPRECATED_EXTENDS_FUNCTION, extendsClause.superclass);
+ }
+ }
+
+ if (withClause != null) {
+ for (TypeName type in withClause.mixinTypes) {
+ Element mixinElement = type.name.staticElement;
+ if (mixinElement != null && mixinElement.name == "Function") {
+ _errorReporter.reportErrorForNode(
+ HintCode.DEPRECATED_MIXIN_FUNCTION, type);
+ }
+ }
+ }
+ }
+
+ /**
* Verify that the given [identifier] is not a keyword, and generates the
* given [errorCode] on the identifier if it is a keyword.
*
@@ -2943,40 +2985,6 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
/**
- * Verifies that the class is not named `Function` and that it doesn't
- * extends/implements/mixes in `Function`.
- */
- void _checkForBadFunctionUse(ClassDeclaration node) {
- ExtendsClause extendsClause = node.extendsClause;
- ImplementsClause implementsClause = node.implementsClause;
- WithClause withClause = node.withClause;
-
- if (node.name.name == "Function") {
- _errorReporter.reportErrorForNode(
- HintCode.DEPRECATED_FUNCTION_CLASS_DECLARATION, node.name);
- }
-
- if (extendsClause != null) {
- InterfaceType superclassType = _enclosingClass.supertype;
- ClassElement superclassElement = superclassType?.element;
- if (superclassElement != null && superclassElement.name == "Function") {
- _errorReporter.reportErrorForNode(
- HintCode.DEPRECATED_EXTENDS_FUNCTION, extendsClause.superclass);
- }
- }
-
- if (withClause != null) {
- for (TypeName type in withClause.mixinTypes) {
- Element mixinElement = type.name.staticElement;
- if (mixinElement != null && mixinElement.name == "Function") {
- _errorReporter.reportErrorForNode(
- HintCode.DEPRECATED_MIXIN_FUNCTION, type);
- }
- }
- }
- }
-
- /**
* Verify that the enclosing class does not have an instance member with the
* same name as the given static [method] declaration.
*

Powered by Google App Engine
This is Rietveld 408576698