- bool hasSourceURLInfo = !sourceURL.isNull() && !sourceURL.isEmpty();
- bool hasLineInfo = line > -1;
- String traceLine;
- JSObject* stackFrameCallee = callee.get();
-
- switch (codeType) {
- case StackFrameEvalCode:
- if (hasSourceURLInfo) {
- traceLine = hasLineInfo ? String::format("eval code@%s:%d", sourceURL.ascii().data(), line)
- : String::format("eval code@%s", sourceURL.ascii().data());
- } else
- traceLine = String::format("eval code");
- break;
- case StackFrameNativeCode: {
- if (callee) {
- UString functionName = getCalculatedDisplayName(callFrame, stackFrameCallee);
- traceLine = String::format("%s@[native code]", functionName.ascii().data());
- } else
- traceLine = "[native code]";
- break;
- }
- case StackFrameFunctionCode: {
- UString functionName = getCalculatedDisplayName(callFrame, stackFrameCallee);
- if (hasSourceURLInfo) {
- traceLine = hasLineInfo ? String::format("%s@%s:%d", functionName.ascii().data(), sourceURL.ascii().data(), line)
- : String::format("%s@%s", functionName.ascii().data(), sourceURL.ascii().data());
- } else
- traceLine = String::format("%s\n", functionName.ascii().data());
- break;
- }
- case StackFrameGlobalCode:
- if (hasSourceURLInfo) {
- traceLine = hasLineInfo ? String::format("global code@%s:%d", sourceURL.ascii().data(), line)
- : String::format("global code@%s", sourceURL.ascii().data());
- } else
- traceLine = String::format("global code");
-
- }
- return traceLine.impl();