From 82ac5445c961d2026b185af80ec94c18d0ba19ab Mon Sep 17 00:00:00 2001 From: Sujin Kim Date: Fri, 21 Dec 2012 19:00:06 +0900 Subject: [PATCH] [Title] JSDT : Added MethodBinding for named functionExpression. [Desc.] If named function was assigned to a variable, a MethodBinding are created with the name. but anonymous methodBinding was created in current version. Fixed it. [Issue] REDMINE-7828 Change-Id: Ifa708a75445425d79274ffa318b2ce0c3a1338b2 --- .../jsdt/internal/compiler/ast/FunctionExpression.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/compiler/ast/FunctionExpression.java b/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/compiler/ast/FunctionExpression.java index 66ddc9b..333f61c 100644 --- a/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/compiler/ast/FunctionExpression.java +++ b/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/compiler/ast/FunctionExpression.java @@ -51,11 +51,17 @@ public class FunctionExpression extends Expression implements IFunctionExpressio public TypeBinding resolveType(BlockScope scope) { constant = Constant.NotAConstant; - this.methodDeclaration.scope=new MethodScope(scope,this.methodDeclaration,false); - this.methodDeclaration.binding=this.methodDeclaration.scope.createMethod(this.methodDeclaration, null, scope.enclosingCompilationUnit(), false, false); - methodDeclaration.bindArguments(); - this.methodDeclaration.binding.createFunctionTypeBinding(scope); - this.methodDeclaration.resolve(scope); + MethodDeclaration method = this.methodDeclaration; + if (method.selector != null) { + method.resolve(scope); + } else { + method.scope = new MethodScope(scope,method, false); + method.binding = method.scope.createMethod(method, null, scope.enclosingCompilationUnit(), false, false); + method.bindArguments(); + method.binding.createFunctionTypeBinding(scope); + method.resolve(scope); + + } return this.methodDeclaration.binding.functionTypeBinding; } -- 2.7.4