MethodList BalClass::methodsNamed(const Identifier& identifier, Instance* instance) const { MethodList methodList; Method* method = m_methods.get(identifier.ustring().rep()); if (method) { methodList.append(method); return methodList; } const UChar* ident16 = identifier.ustring().data(); char ident[256]; sprintf(ident,"%S",ident16); ident[identifier.ustring().size()] = '\0'; const BalInstance* inst = static_cast<const BalInstance*>(instance); BalObject* obj = inst->getObject(); if( obj->hasMethod( ident ) ) { BalMethod *aMethod= new BalMethod(obj, 0, ident, 0); m_methods.set(identifier.ustring().rep(), aMethod); methodList.append(aMethod); } return methodList; }
MethodList BalClass::methodsNamed(const Identifier& identifier, Instance* instance) const { MethodList methodList; Method* method = m_methods.get(identifier.ustring().rep()); if (method) { methodList.append(method); return methodList; } const char *ident = identifier.ascii(); const BalInstance* inst = static_cast<const BalInstance*>(instance); BalObject* obj = inst->getObject(); if( obj->hasMethod( ident ) ) { Method* aMethod = new BalMethod(ident); // deleted in the CClass destructor { JSLock lock(false); m_methods.set(identifier.ustring().rep(), aMethod); } methodList.append(aMethod); } return methodList; }