示例#1
0
Field* BalClass::fieldNamed(const Identifier& identifier, Instance *instance) const
{
    Field* aField = m_fields.get(identifier.ustring().rep());
    if (aField)
        return aField;
    const char *ident = identifier.ascii();
    const BalInstance* inst = static_cast<const BalInstance*>(instance);
    
    BalObject* obj = inst->getObject();
    if( obj->hasProperty( ident ) )
    {
        aField = new BalField(ident); // deleted in the CClass destructor
        {
            JSLock lock(false);
            m_fields.set(identifier.ustring().rep(), aField);
        }
    }
    return aField;
}
示例#2
0
Field* BalClass::fieldNamed(const Identifier& identifier, Instance *instance) const
{
    Field* aField = m_fields.get(identifier.ustring().rep());
    if (aField)
        return aField;
	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->hasProperty( ident ) )
    {
        aField = new BalField(ident);
        m_fields.set(identifier.ustring().rep(), aField);
    }
    return aField;
}