Added better script interpreter logging.

This commit is contained in:
Jeff Hutchinson 2018-04-14 10:59:09 -04:00
parent 188fba2049
commit babe32ae7b

View file

@ -2132,12 +2132,27 @@ OPCodeReturn CodeInterpreter::op_callfunc(U32 &ip)
{ {
if (!mExec.noCalls && !(routingId == MethodOnComponent)) if (!mExec.noCalls && !(routingId == MethodOnComponent))
{ {
Con::warnf(ConsoleLogEntry::General, "%s: Unknown command %s.", mCodeBlock->getFileLine(ip - 6), fnName); if (callType == FuncCallExprNode::MethodCall)
if (callType == FuncCallExprNode::MethodCall && gEvalState.thisObject != NULL)
{ {
Con::warnf(ConsoleLogEntry::General, " Object %s(%d) %s", if (gEvalState.thisObject != NULL)
gEvalState.thisObject->getName() ? gEvalState.thisObject->getName() : "", {
gEvalState.thisObject->getId(), Con::getNamespaceList(ns)); // Try to use the name instead of the id
StringTableEntry name = gEvalState.thisObject->getName() ? gEvalState.thisObject->getName() : gEvalState.thisObject->getIdString();
Con::warnf(ConsoleLogEntry::General, "%s: Unknown method %s.%s Namespace List: %s", mCodeBlock->getFileLine(ip - 6), name, fnName, Con::getNamespaceList(ns));
}
else
{
// NULL.
Con::warnf(ConsoleLogEntry::General, "%s: Unknown method NULL.%s", mCodeBlock->getFileLine(ip - 6), fnName);
}
}
else if (callType == FuncCallExprNode::ParentCall)
{
Con::warnf(ConsoleLogEntry::General, "%s: Unknown parent call %s.", mCodeBlock->getFileLine(ip - 6), fnName);
}
else
{
Con::warnf(ConsoleLogEntry::General, "%s: Unknown function %s.", mCodeBlock->getFileLine(ip - 6), fnName);
} }
} }
STR.popFrame(); STR.popFrame();
@ -2328,7 +2343,7 @@ OPCodeReturn CodeInterpreter::op_callfunc_pointer(U32 &ip)
{ {
if (!mExec.noCalls) if (!mExec.noCalls)
{ {
Con::warnf(ConsoleLogEntry::General, "%s: Unknown command %s.", mCodeBlock->getFileLine(ip - 6), fnName); Con::warnf(ConsoleLogEntry::General, "%s: Unknown function %s.", mCodeBlock->getFileLine(ip - 6), fnName);
} }
STR.popFrame(); STR.popFrame();
CSTK.popFrame(); CSTK.popFrame();
@ -2521,17 +2536,16 @@ OPCodeReturn CodeInterpreter::op_callfunc_this(U32 &ip)
{ {
if (!mExec.noCalls) if (!mExec.noCalls)
{ {
Con::warnf(ConsoleLogEntry::General, "%s: Unknown command %s.", mCodeBlock->getFileLine(ip - 6), fnName);
if (mThisObject) if (mThisObject)
{ {
Con::warnf(ConsoleLogEntry::General, " Object %s(%d) %s", // Try to use the name instead of the id
mThisObject->getName() ? mThisObject->getName() : "", StringTableEntry name = mThisObject->getName() ? mThisObject->getName() : mThisObject->getIdString();
mThisObject->getId(), Con::getNamespaceList(ns)); Con::warnf(ConsoleLogEntry::General, "%s: Unknown method %s.%s Namespace List: %s", mCodeBlock->getFileLine(ip - 6), name, fnName, Con::getNamespaceList(ns));
} }
else else
{ {
// At least let the scripter know that they access the object. // At least let the scripter know that they access the object.
Con::warnf(ConsoleLogEntry::General, " Object is NULL."); Con::warnf(ConsoleLogEntry::General, "%s: Unknown method NULL.%s", mCodeBlock->getFileLine(ip - 6), fnName);
} }
} }
STR.popFrame(); STR.popFrame();