This commit is contained in:
nboyd%atg.com 2002-03-21 01:44:54 +00:00
Родитель c51d2ffb58
Коммит 1769c7a05e
2 изменённых файлов: 22 добавлений и 5 удалений

Просмотреть файл

@ -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;
}