1
0
Fork 0

Interface methods are now copied to the class prototype (basic implementation - no deep copy for interface subtypes yet)

closure/master
Mike Gerwitz 2010-12-29 23:34:12 -05:00
parent 459d5e967b
commit d5d6082bfb
2 changed files with 10 additions and 0 deletions

View File

@ -56,6 +56,9 @@ exports.implements = function()
for ( var i = 0; i < len; i++ ) for ( var i = 0; i < len; i++ )
{ {
arg = arguments[ i ]; arg = arguments[ i ];
// copy all interface methods to the class (does not yet deep copy)
util.propCopy( arg.prototype, dest.prototype );
dest.implemented.push( arg ); dest.implemented.push( arg );
} }

View File

@ -63,3 +63,10 @@ assert.ok(
"Class contains list of implemented interfaces" "Class contains list of implemented interfaces"
); );
assert.ok(
( ( Foo.prototype.foo instanceof Function )
&& ( Foo.prototype.foo2 instanceof Function )
),
"Abstract methods are copied into the new class prototype"
);