Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 333387 - Parser log message when invoking a constructor returned from a function call (occurs in Sencha Touch)
Summary: Parser log message when invoking a constructor returned from a function call ...
Status: RESOLVED FIXED
Alias: None
Product: JSDT
Classification: WebTools
Component: General (show other bugs)
Version: 3.2.3   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal with 1 vote (vote)
Target Milestone: 3.2.4   Edit
Assignee: Chris Jaun CLA
QA Contact: Nitin Dahyabhai CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-02 14:54 EST by Paul Beusterien CLA
Modified: 2011-03-23 13:36 EDT (History)
1 user (show)

See Also:
thatnitind: review+


Attachments
One-line Fix for 333387 (760 bytes, patch)
2011-01-24 12:41 EST, Paul Beusterien CLA
cmjaun: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.