| Index: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java
|
| diff --git a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java
|
| index 550d1d689484260e777aef4b7ad233a750cf2b47..e65288de83fc0e0d2b72595b7be800d26ac441eb 100644
|
| --- a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java
|
| +++ b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java
|
| @@ -457,6 +457,7 @@ public class ErrorVerifier extends RecursiveASTVisitor<Void> {
|
| checkForDuplicateDefinitionInheritance();
|
| checkForConflictingGetterAndMethod();
|
| checkImplementsSuperClass(node);
|
| + checkImplementsFunctionWithoutCall(node);
|
| return super.visitClassDeclaration(node);
|
| } finally {
|
| isInNativeClass = false;
|
| @@ -4892,6 +4893,33 @@ public class ErrorVerifier extends RecursiveASTVisitor<Void> {
|
| }
|
|
|
| /**
|
| + * This verifies that if the given class declaration implements the class Function that it has a
|
| + * concrete implementation of the call method.
|
| + *
|
| + * @return {@code true} if and only if an error code is generated on the passed node
|
| + * @see StaticWarningCode#FUNCTION_WITHOUT_CALL
|
| + */
|
| + private boolean checkImplementsFunctionWithoutCall(ClassDeclaration node) {
|
| + if (node.getAbstractKeyword() != null) {
|
| + return false;
|
| + }
|
| + ClassElement classElement = node.getElement();
|
| + if (classElement == null) {
|
| + return false;
|
| + }
|
| + if (!classElement.getType().isSubtypeOf(typeProvider.getFunctionType())) {
|
| + return false;
|
| + }
|
| + ExecutableElement callMethod = inheritanceManager.lookupMember(classElement, "call");
|
| + if (callMethod == null || !(callMethod instanceof MethodElement)
|
| + || ((MethodElement) callMethod).isAbstract()) {
|
| + errorReporter.reportError(StaticWarningCode.FUNCTION_WITHOUT_CALL, node.getName());
|
| + return true;
|
| + }
|
| + return false;
|
| + }
|
| +
|
| + /**
|
| * This verifies that the given class declaration does not have the same class in the 'extends'
|
| * and 'implements' clauses.
|
| *
|
|
|