Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 333387

Summary: Parser log message when invoking a constructor returned from a function call (occurs in Sencha Touch)
Product: [WebTools] JSDT Reporter: Paul Beusterien <paul.beusterien>
Component: GeneralAssignee: Chris Jaun <cmjaun>
Status: RESOLVED FIXED QA Contact: Nitin Dahyabhai <thatnitind>
Severity: normal    
Priority: P3 CC: cmjaun
Version: 3.2.3Flags: thatnitind: review+
Target Milestone: 3.2.4   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Attachments:
Description Flags
One-line Fix for 333387 cmjaun: iplog+

Description Paul Beusterien CLA 2011-01-02 14:54:51 EST
Opening any of the Sencha Touch core .js files (sencha-touch*.js) causes multiple console messages and occasional Eclipse crashes.  The console messages are:

IMPLEMENT resolveForAllocation for class org.eclipse.wst.jsdt.internal.compiler.ast.MessageSend

The following one-line test case is at least one of the problems:

x = new (z());
Comment 1 Paul Beusterien CLA 2011-01-23 19:07:12 EST
Here's more of a real program to illustrate the bug:

    function xxx() {
    	return function myConstructor(v) { this.val = v; };
    }

    function testNew() {
         var rectangleConstructor = xxx();
         var r = new rectangleConstructor(99);
         alert ("value is " + r.val );

         var r2 = new (xxx())(99);  // should be same behavior as above
         alert ("value is " + r2.val );
    };
Comment 2 Paul Beusterien CLA 2011-01-24 12:41:27 EST
Created attachment 187449 [details]
One-line Fix for 333387

I've attached a patch with a fix.

It's not clear to me what the purpose of the switch statement in the resolveForAllocation method in Expression.java is.  Why isn't it the same as the resolveForAllocation method in FunctionExpression.java.

In any case, the switch expression should include IASTNode.FUNCTION_CALL
Comment 3 Chris Jaun CLA 2011-02-07 16:44:31 EST
Patch looks good...should be able to get this in 3.2.4.
Comment 4 Chris Jaun CLA 2011-03-23 13:36:35 EDT
Checked into 3.2.4 and HEAD.