Chromium Code Reviews| 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 346da5a6c23f5e2fcfded2096a5c41cfc90fb89c..830e04a7592b0d1a2c3ceda30d34c66c2d9a6ed6 100644 |
| --- a/pkg/analyzer/lib/src/generated/error_verifier.dart |
| +++ b/pkg/analyzer/lib/src/generated/error_verifier.dart |
| @@ -2574,6 +2574,39 @@ 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; |
| + 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. |
| * |
| @@ -2944,40 +2977,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; |
|
Brian Wilkerson
2017/01/24 22:28:53
This file was sorted, so it's hard to see, but I d
|
| - 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. |
| * |