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.
Summary: | Function argument marked as unsed if used in the same line with local variable that overwrites it | ||
---|---|---|---|
Product: | javascript | Reporter: | Eccenux |
Component: | Editor | Assignee: | Petr Pisl <ppisl> |
Status: | NEW --- | ||
Severity: | normal | ||
Priority: | P3 | ||
Version: | 7.4 | ||
Hardware: | PC | ||
OS: | Windows 7 | ||
Issue Type: | DEFECT | Exception Reporter: |
Description
Eccenux
2014-02-04 11:59:24 UTC
From editor point of view, there is not easy to recognized, whether was used the variable or the parameter with the same name. Unfortunately the offset of the variable declaration is not important. Simple example: function foobar3() { console.log(force); var force = "hello"; console.log(force); } The local variable already exist, in the first call console.log(force), but has value "undefined", because the runtime "creates" all local variables in a function before executing the first line of the function. If we do this: function foobar3(force) { console.log(force); var force = "hello"; console.log(force); } it means that in the runtime the first call console.log(force) logs the local variable (not the parameter), but the variable is initialized with the value of parameter with the same name. |