Interface methods are now copied to the class prototype (basic implementation - no deep copy for interface subtypes yet)
parent
459d5e967b
commit
d5d6082bfb
|
@ -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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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"
|
||||||
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue