Closed Bug 537225 Opened 10 years ago Closed 10 years ago

function returns global var not local function

Categories

(Core :: JavaScript Engine, defect)

x86
Linux
defect
Not set

Tracking

()

RESOLVED DUPLICATE of bug 434912

People

(Reporter: tekai, Unassigned)

Details

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2b5) Gecko/20091204 Firefox/3.6b5
Build Identifier: 3.6b5

If a function declaration is wrapped in a conditional and the conditional is not executed the function name references does not reference the function.

This happens in Firefox 3.6b5, Rhino (1.7R2), JavaScript-C (1.8.0 pre-release 1 2009-02-16).

Opera (10), Internet Explorer (8) reference the function and judging by the spec (Section 10.1.3) they do it correctly.

The behavior however is correct for var statements in conditionals.

Reproducible: Always

Steps to Reproduce:
var c="";
function h(a) {
    if (a) {
        function c() {
            return "this is c";
        }
    }
    return typeof c;
}
h(0);
Actual Results:  
"string"

Expected Results:  
"function"
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 434912
You need to log in before you can comment on or make changes to this bug.