DebuggerCallFrame.cpp [plain text]
#include "config.h"
#include "DebuggerCallFrame.h"
#include "JSFunction.h"
#include "CodeBlock.h"
#include "Interpreter.h"
#include "Parser.h"
namespace JSC {
const UString* DebuggerCallFrame::functionName() const
{
if (!m_callFrame->codeBlock())
return 0;
JSFunction* function = static_cast<JSFunction*>(m_callFrame->callee());
if (!function)
return 0;
return &function->name(&m_callFrame->globalData());
}
UString DebuggerCallFrame::calculatedFunctionName() const
{
if (!m_callFrame->codeBlock())
return 0;
JSFunction* function = static_cast<JSFunction*>(m_callFrame->callee());
if (!function)
return 0;
return function->calculatedDisplayName(&m_callFrame->globalData());
}
DebuggerCallFrame::Type DebuggerCallFrame::type() const
{
if (m_callFrame->callee())
return FunctionType;
return ProgramType;
}
JSObject* DebuggerCallFrame::thisObject() const
{
if (!m_callFrame->codeBlock())
return 0;
return asObject(m_callFrame->thisValue());
}
JSValue DebuggerCallFrame::evaluate(const UString& script, JSValue& exception) const
{
if (!m_callFrame->codeBlock())
return JSValue();
int errLine;
UString errMsg;
SourceCode source = makeSource(script);
RefPtr<EvalNode> evalNode = m_callFrame->scopeChain()->globalData->parser->parse<EvalNode>(m_callFrame, m_callFrame->dynamicGlobalObject()->debugger(), source, &errLine, &errMsg);
if (!evalNode)
return Error::create(m_callFrame, SyntaxError, errMsg, errLine, source.provider()->asID(), source.provider()->url());
return m_callFrame->scopeChain()->globalData->interpreter->execute(evalNode.get(), m_callFrame, thisObject(), m_callFrame->scopeChain(), &exception);
}
}