Exemplo n.º 1
0
void JSFunction::addNameScopeIfNeeded(VM& vm)
{
    FunctionExecutable* executable = jsCast<FunctionExecutable*>(m_executable.get());
    if (!functionNameIsInScope(executable->name(), executable->functionMode()))
        return;
    if (!functionNameScopeIsDynamic(executable->usesEval(), executable->isStrictMode()))
        return;
    m_scope.set(vm, this, JSNameScope::create(vm, m_scope->globalObject(), executable->name(), this, ReadOnly | DontDelete, m_scope.get()));
}
Exemplo n.º 2
0
JSCell* DFG_OPERATION operationNewFunctionExpression(ExecState* exec, JSCell* functionExecutableAsCell)
{
    ASSERT(functionExecutableAsCell->inherits(&FunctionExecutable::s_info));
    FunctionExecutable* functionExecutable =
        static_cast<FunctionExecutable*>(functionExecutableAsCell);
    JSFunction *function = functionExecutable->make(exec, exec->scopeChain());
    if (!functionExecutable->name().isNull()) {
        JSStaticScopeObject* functionScopeObject =
            JSStaticScopeObject::create(
                exec, functionExecutable->name(), function, ReadOnly | DontDelete);
        function->setScope(exec->globalData(), function->scope()->push(functionScopeObject));
    }
    return function;
}