| 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 c5e8549d1e2ea764295e5bb8a5606c046c38d861..3043a795c9fe276218e4b94b49f55ed702f78b3d 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
|
| @@ -49,6 +49,7 @@ import com.google.dart.engine.ast.FormalParameterList;
|
| import com.google.dart.engine.ast.FunctionBody;
|
| import com.google.dart.engine.ast.FunctionDeclaration;
|
| import com.google.dart.engine.ast.FunctionExpression;
|
| +import com.google.dart.engine.ast.FunctionExpressionInvocation;
|
| import com.google.dart.engine.ast.FunctionTypeAlias;
|
| import com.google.dart.engine.ast.FunctionTypedFormalParameter;
|
| import com.google.dart.engine.ast.Identifier;
|
| @@ -640,6 +641,18 @@ public class ErrorVerifier extends RecursiveASTVisitor<Void> {
|
| }
|
|
|
| @Override
|
| + public Void visitFunctionExpressionInvocation(FunctionExpressionInvocation node) {
|
| + Expression functionExpression = node.getFunction();
|
| + Type expressionType = functionExpression.getStaticType();
|
| + if (!isFunctionType(expressionType)) {
|
| + errorReporter.reportError(
|
| + StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION,
|
| + functionExpression);
|
| + }
|
| + return super.visitFunctionExpressionInvocation(node);
|
| + }
|
| +
|
| + @Override
|
| public Void visitFunctionTypeAlias(FunctionTypeAlias node) {
|
| checkForBuiltInIdentifierAsName(
|
| node.getName(),
|
| @@ -4960,6 +4973,23 @@ public class ErrorVerifier extends RecursiveASTVisitor<Void> {
|
| }
|
| }
|
|
|
| + private boolean isFunctionType(Type type) {
|
| + if (type.isDynamic() || type == BottomTypeImpl.getInstance()) {
|
| + return true;
|
| + } else if (type instanceof InterfaceType) {
|
| + if (type == typeProvider.getFunctionType()) {
|
| + return true;
|
| + }
|
| + MethodElement callMethod = ((InterfaceType) type).lookUpMethod(
|
| + ElementResolver.CALL_METHOD_NAME,
|
| + currentLibrary);
|
| + return callMethod != null;
|
| + } else if (type instanceof FunctionType || type.isDartCoreFunction()) {
|
| + return true;
|
| + }
|
| + return false;
|
| + }
|
| +
|
| /**
|
| * @return {@code true} if the given {@link ASTNode} is the part of constant constructor
|
| * invocation.
|
|
|