On Tue, Mar 31, 2009 at 4:29 PM, Louis Santillan <[email protected]> wrote:
>   ChildClass._superConstructor_ = ParentClass;
>   ChildClass._superClass_ = ParentClass.prototype;

i wasn't able to get that to work:

subclass.js:24: TypeError: Cannot call method 'call' of undefined
  this._superConstructor_.call( this );


but this change works for me:

  ChildClass.prototype._superConstructor_ = ParentClass;
  ChildClass.prototype._superClass_ = ParentClass.prototype;

note the insertion of ".prototype".

> Object._extends_( MySubType, MyType );

Then i hacked it a bit...

Since MySubType already subclasses Object, we can change:

Object.prototype._extends_ = function( ChildClass, ParentClass )
{
    if( 1 == arguments.length )
    {
        return this._extends_(this,ChildClass);
    }
... same as before ...
}

And:

> Object._extends_( MySubType, MyType );

becomes:

MySubType._extends_(MyType);

otherwise _extends_ might as well be a non-member function.

Thanks for that tip! This will be useful!

-- 
----- stephan beal
http://wanderinghorse.net/home/stephan/

--~--~---------~--~----~------------~-------~--~----~
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to