Example #1
0
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;
}
Example #2
0
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;
}
Example #3
0
void BalField::setValueToInstance(ExecState* exec, const Instance* inst, JSValue* aValue) const
{
    const BalInstance* instance = static_cast<const BalInstance*>(inst);
    BalObject* obj = instance->getObject();
    BalValuePrivate *priv = new BalValuePrivate(exec, aValue);
    BalValue *val = new BalValue(priv);
    obj->setProperty(m_ident, val);
    delete val;
}
Example #4
0
JSValue* BalField::valueFromInstance(ExecState* exec, const Instance* inst) const
{
    const BalInstance* instance = static_cast<const BalInstance*>(inst);
    BalObject* obj = instance->getObject();
    BalValue* val = obj->getProperty(m_ident, exec);    // 3/25/10 CSidhall - Added exec so that a bal string can be set in JS.
    JSValue *v;
    if(val->m_obj != NULL)
        v = val->d->balObject(val->m_obj, exec);
    else
        v = val->d->getValue();
    delete val;
    return v;
}
Example #5
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;
}
Example #6
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;
}