archives

« Bugzilla Issues Index

#1390 — Wrong [[Scope]] for eval'ed function declarations


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()")
}
})()
---