This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 244570

Summary: Variable marked as unused in constructor and no property hint created.
Product: javascript Reporter: xracoonx
Component: EditorAssignee: Petr Pisl <ppisl>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: P3    
Version: 7.4   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description xracoonx 2014-05-18 07:37:23 UTC
In the code below the variable 'hasWheels' is marked as being 'unused' in the constructor scope and no hint to the property is produced (e.g. when typing 'redCar.' outside of it).

function Car(color) {
    var hasWheels = true;
    this.color = color;
    this.hasWheels = hasWheels;
}

var redCar = new Car('red');
console.log(redCar.hasWheels);
Comment 1 Vladimir Riha 2014-05-19 07:19:36 UTC
reproducible in 8.0 and trunk
Comment 2 xracoonx 2014-05-19 20:24:18 UTC
By the way, this code which I think is equivalent works fine:

function Car(color) {
    var hasWheels = true;
    return {
        color: color,
        hasWheels: hasWheels
    };
}

var redCar = new Car('red');
console.log(redCar.hasWheels);
Comment 3 xracoonx 2014-05-19 21:01:06 UTC
However, it seems not to create any hints...
Comment 4 Vladimir Riha 2014-07-01 12:31:25 UTC

*** This bug has been marked as a duplicate of bug 223118 ***