本文整理汇总了C++中Toplevel::functionClass方法的典型用法代码示例。如果您正苦于以下问题:C++ Toplevel::functionClass方法的具体用法?C++ Toplevel::functionClass怎么用?C++ Toplevel::functionClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Toplevel
的用法示例。
在下文中一共展示了Toplevel::functionClass方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
ClassClosure *SamplerScript::getType(Toplevel* ss_toplevel, SamplerObjectType sot, const void *ptr)
{
Toplevel* tl;
switch (sotGetKind(sot))
{
case kSOT_String:
{
// toplevel can be null here if there was no CodeContext active
// when the sample was taken (ie, string was allocated from C++ code).
// in that case, use the TL from the SamplerScript itself... it isn't
// technically the right one to use, but is adequate for our purposes here
// (it will return a stringClass or namespaceClass that will be valid
// for the sampler)
tl = sotGetToplevel(sot);
if (!tl) tl = ss_toplevel;
return tl->stringClass();
}
case kSOT_Namespace:
{
tl = sotGetToplevel(sot);
if (!tl) tl = ss_toplevel;
return tl->namespaceClass();
}
default:
AvmAssert(0);
case kSOT_Object:
break;
}
VTable* vt = sotGetVTable(sot);
tl = vt->toplevel();
AvmCore* core = tl->core();
ClassClosure *type;
ScriptObject* obj = (ScriptObject*)ptr;
if (obj && AvmCore::istype(obj->atom(), core->traits.class_itraits))
{
type = tl->classClass();
}
else if (obj && AvmCore::istype(obj->atom(), core->traits.function_itraits))
{
type = tl->functionClass();
}
else if (obj && obj->traits()->isActivationTraits())
{
type = tl->objectClass;
}
else
{
// fallback answer
type = tl->objectClass;
// note that note all types will have an init method,
// so those types may get reported as "objectClass" rather
// than something more specific. However, it's not clear
// that the Sampler ever really cared about reporting those
// objects well in the first place (eg activation or catch objects),
// so it doesn't seem we're a lot worse off than before.
ScopeChain* sc = NULL;
if (vt->init)
sc = vt->init->scope();
if (sc && sc->getSize() <= 1)
{
if(sc->getSize() == 1)
type = tl->classClass();
}
else if (sc)
{
Atom ccAtom = sc->getScope(sc->getSize()-1);
if(AvmCore::isObject(ccAtom))
{
type = (ClassClosure*) AvmCore::atomToScriptObject(ccAtom);
if(!AvmCore::istype(type->atom(), core->traits.class_itraits))
{
// obj is a ClassClosure
type = tl->classClass();
}
}
}
}
AvmAssert(AvmCore::istype(type->atom(), core->traits.class_itraits));
return type;
}