Exemple #1
0
    void ClassClosure::set_prototype(Atom value)
    {
        // ISSUE can value be null/undefined?

        if (AvmCore::isNullOrUndefined(value))
        {
            setPrototypePtr(NULL);
        }
        else
        {
            if (!AvmCore::isObject(value))
            {
                toplevel()->throwTypeError(kPrototypeTypeError);
            }

            // allow any prototype object.  if the object has methods or slots, so be it
            setPrototypePtr(AvmCore::atomToScriptObject(value));
        }
    }
Exemple #2
0
    ObjectClass::ObjectClass(VTable* cvtable)
        : ClassClosure(cvtable)
    {
        toplevel()->objectClass = this;

        // patch Object's instance vtable scope, since we created it earlier for
        // bootstrapping
        //ivtable()->scope = cvtable->scope;

        AvmAssert(traits()->getSizeOfInstance() == sizeof(ObjectClass));
        // it is correct call construct() when this.prototype == null
        setPrototypePtr(construct());
    }