зеркало из https://github.com/mozilla/pjs.git
Fix bug 132217.
This commit is contained in:
Родитель
c51d2ffb58
Коммит
1769c7a05e
|
@ -1399,9 +1399,20 @@ public class Interpreter extends LabelTable {
|
|||
if (id.itsName.length() == 0)
|
||||
return;
|
||||
if ((id.itsFunctionType == FunctionNode.FUNCTION_STATEMENT &&
|
||||
fn.itsClosure == null) ||
|
||||
(id.itsFunctionType == FunctionNode.FUNCTION_EXPRESSION_STATEMENT &&
|
||||
fn.itsClosure != null))
|
||||
fn.itsClosure == null))
|
||||
{
|
||||
try {
|
||||
// ECMA specifies that functions defined in global and
|
||||
// function scope should have DONTDELETE set.
|
||||
((ScriptableObject) scope).defineProperty(fn.itsData.itsName,
|
||||
fn, ScriptableObject.PERMANENT);
|
||||
} catch (ClassCastException e) {
|
||||
ScriptRuntime.setProp(scope, fn.itsData.itsName, fn, scope);
|
||||
}
|
||||
}
|
||||
|
||||
if (id.itsFunctionType == FunctionNode.FUNCTION_EXPRESSION_STATEMENT &&
|
||||
fn.itsClosure != null)
|
||||
{
|
||||
ScriptRuntime.setProp(scope, fn.itsData.itsName, fn, scope);
|
||||
}
|
||||
|
|
|
@ -2004,8 +2004,14 @@ public class ScriptRuntime {
|
|||
{
|
||||
fn.setPrototype(ScriptableObject.getClassPrototype(scope, "Function"));
|
||||
fn.setParentScope(scope);
|
||||
if (doSetName)
|
||||
setName(scope, fn, scope, fnName);
|
||||
if (doSetName) {
|
||||
try {
|
||||
((ScriptableObject) scope).defineProperty(fnName, fn,
|
||||
ScriptableObject.PERMANENT);
|
||||
} catch (ClassCastException e) {
|
||||
setName(scope, fn, scope, fnName);
|
||||
}
|
||||
}
|
||||
return fn;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче