Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 329803 - Function literal with attributes assigned using "this." is not inferred as a type like regular functions are
Summary: Function literal with attributes assigned using "this." is not inferred as a ...
Status: RESOLVED FIXED
Alias: None
Product: JSDT
Classification: WebTools
Component: General (show other bugs)
Version: 3.2.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2.3   Edit
Assignee: Chris Jaun CLA
QA Contact: Nitin Dahyabhai CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-09 10:04 EST by Chris Jaun CLA
Modified: 2010-11-09 11:24 EST (History)
0 users

See Also:
thatnitind: review+


Attachments
patch (2.44 KB, patch)
2010-11-09 10:08 EST, Chris Jaun CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Jaun CLA 2010-11-09 10:04:43 EST
I have a function in a JS file:

var mortCal = function (homeCost, downPayment, interestRate, term) {
    this.homeCost = homeCost;
    this.downPayment = downPayment;
    this.interestRate = interestRate;
    this.term = term;
};


I try to do:
var mc = new mort*

I attempt content assist where the * is. I would expect to see my inferred type mortCal as a proposal, but I do not.

If I change the function to the following then it works correctly:
function mortCal(homeCost, downPayment, interestRate, term) {
    this.homeCost = homeCost;
    this.downPayment = downPayment;
    this.interestRate = interestRate;
    this.term = term;
};
Comment 1 Chris Jaun CLA 2010-11-09 10:08:08 EST
Created attachment 182719 [details]
patch
Comment 2 Chris Jaun CLA 2010-11-09 10:09:25 EST
Patch stores a potential function name in the AbstractMethodDeclaration object if one can be determined during the inference step.

If it is determined that the function has no selector and one is needed then the potential name is returned if one exists.
Comment 3 Chris Jaun CLA 2010-11-09 11:24:49 EST
Checked into 3.2.3 and HEAD.