本文整理汇总了C++中Toplevel::builtinClasses方法的典型用法代码示例。如果您正苦于以下问题:C++ Toplevel::builtinClasses方法的具体用法?C++ Toplevel::builtinClasses怎么用?C++ Toplevel::builtinClasses使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Toplevel
的用法示例。
在下文中一共展示了Toplevel::builtinClasses方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: newParameterizedVTable
VTable* VTable::newParameterizedVTable(Traits* param_traits, Stringp fullname)
{
Toplevel* toplevel = this->toplevel();
AvmCore* core = toplevel->core();
Namespacep traitsNs = this->traits->ns();
GCRef<builtinClassManifest> builtinClasses = toplevel->builtinClasses();
GCRef<ObjectVectorClass> vectorobj_cls = builtinClasses->get_Vector_objectClass();
GCRef<ScopeChain> vectorobj_cscope = vectorobj_cls->vtable->init->scope();
GCRef<ScopeChain> vectorobj_iscope = vectorobj_cls->ivtable()->init->scope();
VTable* objVecVTable = vectorobj_cls->vtable;
AbcEnv* objVecAbcEnv = vectorobj_cscope->abcEnv();
Toplevel* objVecToplevel = objVecVTable->toplevel();
VTable* objVecIVTable = objVecVTable->ivtable;
// these cases should all be filtered out by the caller;
// we only want to handle Vector<SomeObject> here
AvmAssert(param_traits != NULL &&
param_traits != toplevel->intClass()->vtable->traits->itraits &&
param_traits != toplevel->uintClass()->vtable->traits->itraits &&
param_traits != toplevel->numberClass()->vtable->traits->itraits);
PoolObject* traitsPool = this->traits->pool;
Stringp classname = core->internString(fullname->appendLatin1("$"));
Traits* ctraits = core->domainMgr()->findTraitsInPoolByNameAndNS(traitsPool, classname, traitsNs);
Traits* itraits;
if (!ctraits)
{
// important: base the new ctraits on objVecVTable->traits, *not* this->traits;
// we want the result to be based off ObjectVectorClass, not VectorClass
// (otherwise sizeofInstance would be too small and we'd be crashy)
ctraits = objVecVTable->traits->newParameterizedCTraits(classname, traitsNs);
ctraits->verifyBindings(toplevel);
itraits = traitsPool->resolveParameterizedType(toplevel, this->ivtable->traits, param_traits);
ctraits->itraits = itraits;
}
else
{
itraits = ctraits->itraits;
}
AvmAssert(itraits != NULL);
VTable* class_ivtable = builtinClasses->get_ClassClass()->ivtable();
VTable* cvtab = core->newVTable(ctraits, class_ivtable, objVecToplevel);
ScopeChain* cvtab_cscope = vectorobj_cscope->cloneWithNewVTable(core->GetGC(), cvtab, objVecAbcEnv);
VTable* ivtab = core->newVTable(itraits, objVecIVTable, objVecToplevel);
ScopeChain* ivtab_iscope = vectorobj_iscope->cloneWithNewVTable(core->GetGC(), ivtab, objVecAbcEnv);
cvtab->ivtable = ivtab;
ivtab->init = objVecIVTable->init;
cvtab->resolveSignatures(cvtab_cscope);
ivtab->resolveSignatures(ivtab_iscope);
return cvtab;
}