« Bugzilla Issues Index
#1390 — Wrong [[Scope]] for eval'ed function declarations
- bug_id:
1390
- creation_ts:
2013-03-22 10:39:00 -0700
- short_desc:
Wrong [[Scope]] for eval'ed function declarations
- delta_ts:
2013-03-22 10:39:56 -0700
- product:
ECMA-262, Editions 5 and 5.1
- component:
technical content
- version:
Edition 5.1
- rep_platform:
All
- op_sys:
All
- bug_status:
CONFIRMED
- priority:
Normal
- bug_severity:
enhancement
- everconfirmed:
true
- reporter:
André Bargull
- assigned_to:
Allen Wirfs-Brock
- commentid:
3546
- comment_count:
0
- who:
André Bargull
- bug_when:
2013-03-22 10:39:56 -0700
The following test cases should both yield "inner" per ES3. ES5 changed this to "outer", because FunctionDeclarations always receive the VariableEnvironment of the current execution context instead of the LexicalEnvironment.
---
(function(){
var x = 'outer';
try {
throw 'inner'
} catch(x) {
return eval("function f(){ return x } f()")
}
})()
(function(){
var x = 'outer';
with({x:'inner'}) {
return eval("function f(){ return x } f()")
}
})()
---