[Title] JSDT : Added MethodBinding for named functionExpression.
authorSujin Kim <sujin921.kim@samsung.com>
Fri, 21 Dec 2012 10:00:06 +0000 (19:00 +0900)
committerhyukmin kwon <hyukmin0530.kwon@samsung.com>
Fri, 28 Dec 2012 09:21:16 +0000 (18:21 +0900)
[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

org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/compiler/ast/FunctionExpression.java

index 66ddc9b..333f61c 100644 (file)
@@ -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;
        }