Closed Bug 468096 Opened 16 years ago Closed 16 years ago

Javscript: Parsing of function declarations doesn't follow spec

Categories

(Core :: JavaScript Engine, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: divinegod, Unassigned)

References

()

Details

User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2a1pre) Gecko/20081205 Minefield/3.2a1pre Build Identifier: As discussed here: http://nedbatchelder.com/blog/200812/internet_explorer_mystery_1376.html The javascript is not parsed correctly. Example: function really() { alert("Original"); } if (0) { alert("No"); function really() { alert("Yes, really"); } } really(); should alert "Yes, really" as that is the latest definition of the function, even though it inside a conditional block. I hope this is a good explanation. Reproducible: Always
ECMA-262 Edition does not specify functions in sub-statements, only at top level in another function or a program (see the normative grammar). Therefore this bug is invalid as summarized. Moreover, we have extended ES3 (as allowed by its chapter 16) for ~ten years to support "function statements" whose bindings depend on control flow. So this again is invalid. There's a bug to dup against, if someone finds it feel free to change resolution accordingly. /be
Status: UNCONFIRMED → RESOLVED
Closed: 16 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.