Merge pull request #992 from Azaezel/alpha41/methodSig

better callback filtering for getMethodSigs
This commit is contained in:
Brian Roberts 2023-03-16 00:39:56 -05:00 committed by GitHub
commit 4489ebbf95
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2662,7 +2662,7 @@ DefineEngineMethod( SimObject, dumpMethods, ArrayObject*, (),,
return dictionary; return dictionary;
} }
DefineEngineMethod(SimObject, getMethodSigs, ArrayObject*, (), , DefineEngineMethod(SimObject, getMethodSigs, ArrayObject*, (bool commands), (false),
"List the methods defined on this object.\n\n" "List the methods defined on this object.\n\n"
"Each description is a newline-separated vector with the following elements:\n" "Each description is a newline-separated vector with the following elements:\n"
"- method prototype string.\n" "- method prototype string.\n"
@ -2682,9 +2682,16 @@ DefineEngineMethod(SimObject, getMethodSigs, ArrayObject*, (), ,
{ {
Namespace::Entry* e = *j; Namespace::Entry* e = *j;
if (e->mType != Namespace::Entry::ScriptCallbackType) if (commands)
continue; {
if ((e->mType < Namespace::Entry::ConsoleFunctionType))
continue;
}
else
{
if ((e->mType > Namespace::Entry::ScriptCallbackType))
continue;
}
StringBuilder str; StringBuilder str;
str.append("function "); str.append("function ");
str.append(ns->getName()); str.append(ns->getName());