Interface now uses propParse and member builders
parent
cd7b2563e5
commit
70f5d09c34
|
@ -23,6 +23,7 @@
|
|||
*/
|
||||
|
||||
var util = require( './util' ),
|
||||
member_builder = require( './member_builder' ),
|
||||
Class = require( './class' );
|
||||
|
||||
|
||||
|
@ -55,23 +56,40 @@ var extend = ( function( extending )
|
|||
var args = Array.prototype.slice.call( arguments ),
|
||||
props = args.pop() || {},
|
||||
base = args.pop() || Interface,
|
||||
prototype = new base();
|
||||
prototype = new base(),
|
||||
|
||||
members = member_builder.initMembers(
|
||||
prototype, prototype, prototype
|
||||
)
|
||||
;
|
||||
|
||||
// sanity check
|
||||
inheritCheck( prototype );
|
||||
|
||||
var new_interface = createInterface();
|
||||
|
||||
util.propCopy( props, prototype, {
|
||||
each: function( name, value )
|
||||
{
|
||||
if ( util.isAbstractMethod( value ) === false )
|
||||
util.propParse( props, {
|
||||
property: function()
|
||||
{
|
||||
throw TypeError(
|
||||
"Only abstract methods are permitted within Interface " +
|
||||
"definitons"
|
||||
"Properties are not permitted within Interface " +
|
||||
"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
|
||||
);
|
||||
},
|
||||
} );
|
||||
|
||||
|
|
Loading…
Reference in New Issue