Traits* PoolObject::resolveParameterizedType(const Toplevel* toplevel, Traits* base, Traits* param_traits ) const { Traits* r = NULL; if( base == core->traits.vector_itraits) { // Only vector is parameterizable for now... if(!param_traits) // Vector.<*> r = core->traits.vectorobj_itraits; else if( param_traits == core->traits.int_itraits) r = core->traits.vectorint_itraits; else if (param_traits == core->traits.uint_itraits) r = core->traits.vectoruint_itraits; else if (param_traits == core->traits.number_itraits) r = core->traits.vectordouble_itraits; else { Stringp fullname = core->internString( core->concatStrings(core->newString("Vector.<"), core->concatStrings(param_traits->formatClassName(), core->newString(">")))->atom()); Multiname newname; newname.setName(fullname); newname.setNamespace(base->ns); r = getTraits(newname, toplevel); if( !r ) { r = core->traits.vectorobj_itraits->newParameterizedITraits(fullname, base->ns); core->traits.vector_itraits->pool->domain->addNamedTrait(fullname, base->ns, r); } } } return r; }
MethodEnv* ProxyObject::getMethod(Stringp name)const { //Atom atom=this->getAtomProperty(name->atom()); //if(AvmCore::isNullOrUndefined(atom)) return NULL; //return AvmCore::atomToScriptObject(atom); Multiname m; m.setName(name); m.setNamespace(m_pNamespace); Binding b = avmplus::getBinding(toplevel(), vtable, &m); if(AvmCore::bindingKind(b)!=BKIND_METHOD) return NULL; return vtable->methods[AvmCore::bindingToMethodId(b)]; }
void PoolObject::parseMultiname(const byte *pos, Multiname& m) const { // the multiname has already been validated so we don't do // any checking here, we just fill in the Multiname object // with the information we have parsed. int index; CPoolKind kind = (CPoolKind) *(pos++); switch (kind) { case CONSTANT_Qname: case CONSTANT_QnameA: { // U16 namespace_index // U16 name_index // parse a multiname with one namespace (aka qname) index = AvmCore::readU30(pos); if (!index) m.setAnyNamespace(); else m.setNamespace(getNamespace(index)); index = AvmCore::readU30(pos); if (!index) m.setAnyName(); else m.setName(getString(index)); m.setQName(); m.setAttr(kind==CONSTANT_QnameA); break; } case CONSTANT_RTQname: case CONSTANT_RTQnameA: { // U16 name_index // parse a multiname with just a name; ns fetched at runtime index = AvmCore::readU30(pos); if (!index) m.setAnyName(); else m.setName(getString(index)); m.setQName(); m.setRtns(); m.setAttr(kind==CONSTANT_RTQnameA); break; } case CONSTANT_RTQnameL: case CONSTANT_RTQnameLA: { m.setQName(); m.setRtns(); m.setRtname(); m.setAttr(kind==CONSTANT_RTQnameLA); break; } case CONSTANT_Multiname: case CONSTANT_MultinameA: { index = AvmCore::readU30(pos); if (!index) m.setAnyName(); else m.setName(getString(index)); index = AvmCore::readU30(pos); AvmAssert(index != 0); m.setNsset(getNamespaceSet(index)); m.setAttr(kind==CONSTANT_MultinameA); break; } case CONSTANT_MultinameL: case CONSTANT_MultinameLA: { m.setRtname(); index = AvmCore::readU30(pos); AvmAssert(index != 0); m.setNsset(getNamespaceSet(index)); m.setAttr(kind==CONSTANT_MultinameLA); break; } case CONSTANT_TypeName: { index = AvmCore::readU30(pos); Atom a = cpool_mn[index]; parseMultiname(atomToPos(a), m); index = AvmCore::readU30(pos); AvmAssert(index==1); m.setTypeParameter(AvmCore::readU30(pos)); break; } default: AvmAssert(false); } return; }