Added virtual members to class metadata
There does not seem to be tests for any of the metadata at present; they are implicitly tested through various implementations that make use of them. This will also be the case here ("will"---in coming commits), but needs to change. The upcoming reflection implementation would be an excellent time to do so.perfodd
parent
a0a5c61631
commit
3c7cd0e57a
|
@ -308,6 +308,10 @@ exports.prototype.build = function extend( _, __ )
|
||||||
abstract_methods =
|
abstract_methods =
|
||||||
util.clone( exports.getMeta( base ).abstractMethods )
|
util.clone( exports.getMeta( base ).abstractMethods )
|
||||||
|| { __length: 0 }
|
|| { __length: 0 }
|
||||||
|
|
||||||
|
virtual_members =
|
||||||
|
util.clone( exports.getMeta( base ).virtualMembers )
|
||||||
|
|| {}
|
||||||
;
|
;
|
||||||
|
|
||||||
// prevent extending final classes
|
// prevent extending final classes
|
||||||
|
@ -350,6 +354,7 @@ exports.prototype.build = function extend( _, __ )
|
||||||
all: members,
|
all: members,
|
||||||
'abstract': abstract_methods,
|
'abstract': abstract_methods,
|
||||||
'static': static_members,
|
'static': static_members,
|
||||||
|
'virtual': virtual_members,
|
||||||
},
|
},
|
||||||
function( inst )
|
function( inst )
|
||||||
{
|
{
|
||||||
|
@ -409,6 +414,7 @@ exports.prototype.build = function extend( _, __ )
|
||||||
// create internal metadata for the new class
|
// create internal metadata for the new class
|
||||||
var meta = createMeta( new_class, base );
|
var meta = createMeta( new_class, base );
|
||||||
meta.abstractMethods = abstract_methods;
|
meta.abstractMethods = abstract_methods;
|
||||||
|
meta.virtualMembers = virtual_members;
|
||||||
meta.name = cname;
|
meta.name = cname;
|
||||||
|
|
||||||
attachAbstract( new_class, abstract_methods );
|
attachAbstract( new_class, abstract_methods );
|
||||||
|
@ -449,9 +455,12 @@ exports.prototype.buildMembers = function buildMembers(
|
||||||
var hasOwn = Array.prototype.hasOwnProperty,
|
var hasOwn = Array.prototype.hasOwnProperty,
|
||||||
defs = {},
|
defs = {},
|
||||||
|
|
||||||
|
// TODO: there does not seem to be tests for these guys; perhaps
|
||||||
|
// this can be rectified with the reflection implementation
|
||||||
members = memberdest.all,
|
members = memberdest.all,
|
||||||
abstract_methods = memberdest['abstract'],
|
abstract_methods = memberdest['abstract'],
|
||||||
static_members = memberdest['static'],
|
static_members = memberdest['static'],
|
||||||
|
virtual_members = memberdest['virtual'],
|
||||||
|
|
||||||
smethods = static_members.methods,
|
smethods = static_members.methods,
|
||||||
sprops = static_members.props,
|
sprops = static_members.props,
|
||||||
|
@ -562,6 +571,11 @@ exports.prototype.buildMembers = function buildMembers(
|
||||||
delete abstract_methods[ name ];
|
delete abstract_methods[ name ];
|
||||||
abstract_methods.__length--;
|
abstract_methods.__length--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( keywords['virtual'] )
|
||||||
|
{
|
||||||
|
virtual_members[ name ] = true;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue