1
0
Fork 0

Interface now uses propParse and member builders

closure/master
Mike Gerwitz 2011-01-24 23:35:45 -05:00
parent cd7b2563e5
commit 70f5d09c34
1 changed files with 26 additions and 8 deletions

View File

@ -23,6 +23,7 @@
*/ */
var util = require( './util' ), var util = require( './util' ),
member_builder = require( './member_builder' ),
Class = require( './class' ); Class = require( './class' );
@ -55,23 +56,40 @@ var extend = ( function( extending )
var args = Array.prototype.slice.call( arguments ), var args = Array.prototype.slice.call( arguments ),
props = args.pop() || {}, props = args.pop() || {},
base = args.pop() || Interface, base = args.pop() || Interface,
prototype = new base(); prototype = new base(),
members = member_builder.initMembers(
prototype, prototype, prototype
)
;
// sanity check // sanity check
inheritCheck( prototype ); inheritCheck( prototype );
var new_interface = createInterface(); var new_interface = createInterface();
util.propCopy( props, prototype, { util.propParse( props, {
each: function( name, value ) property: function()
{
if ( util.isAbstractMethod( value ) === false )
{ {
throw TypeError( throw TypeError(
"Only abstract methods are permitted within Interface " + "Properties are not permitted within Interface " +
"definitons" "definitions"
);
},
method: function( name, value, is_abstract, keywords )
{
if ( !is_abstract )
{
throw TypeError(
"Only abstract methods are permitted within " +
"Interface definitions"
); );
} }
member_builder.buildMethod(
members, null, name, value, keywords
);
}, },
} ); } );