Deleted unnecessary trait abstract method in favor of auto-abstract flag
This method was added before this flag existed.perfodd
parent
cc43f4b339
commit
0713a9f3d0
|
@ -672,7 +672,7 @@ function validateAbstract( ctor, cname, abstract_methods, auto )
|
||||||
{
|
{
|
||||||
if ( ctor.___$$abstract$$ )
|
if ( ctor.___$$abstract$$ )
|
||||||
{
|
{
|
||||||
if ( abstract_methods.__length === 0 )
|
if ( !auto && ( abstract_methods.__length === 0 ) )
|
||||||
{
|
{
|
||||||
throw TypeError(
|
throw TypeError(
|
||||||
"Class " + ( cname || "(anonymous)" ) + " was declared as " +
|
"Class " + ( cname || "(anonymous)" ) + " was declared as " +
|
||||||
|
|
13
lib/Trait.js
13
lib/Trait.js
|
@ -90,11 +90,6 @@ Trait.extend = function( dfn )
|
||||||
// object will be used to define the hidden abstract class)
|
// object will be used to define the hidden abstract class)
|
||||||
var name = dfn.__name || '(Trait)';
|
var name = dfn.__name || '(Trait)';
|
||||||
|
|
||||||
// we need at least one abstract member in order to declare a class as
|
|
||||||
// abstract (in this case, our trait class), so let's create a dummy one
|
|
||||||
// just in case DFN does not contain any abstract members itself
|
|
||||||
dfn[ 'abstract protected ___$$trait$$' ] = [];
|
|
||||||
|
|
||||||
// augment the parser to handle our own oddities
|
// augment the parser to handle our own oddities
|
||||||
dfn.___$$parser$$ = {
|
dfn.___$$parser$$ = {
|
||||||
each: _parseMember,
|
each: _parseMember,
|
||||||
|
@ -102,6 +97,10 @@ Trait.extend = function( dfn )
|
||||||
getset: _parseGetSet,
|
getset: _parseGetSet,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// automatically mark ourselves as abstract if an abstract method is
|
||||||
|
// provided
|
||||||
|
dfn.___$$auto$abstract$$ = true;
|
||||||
|
|
||||||
// give the abstract trait class a distinctive name for debugging
|
// give the abstract trait class a distinctive name for debugging
|
||||||
dfn.__name = '#AbstractTrait#';
|
dfn.__name = '#AbstractTrait#';
|
||||||
|
|
||||||
|
@ -289,8 +288,6 @@ function createConcrete( acls )
|
||||||
// a constructor that accepts the protected member object of the
|
// a constructor that accepts the protected member object of the
|
||||||
// containing class
|
// containing class
|
||||||
var dfn = {
|
var dfn = {
|
||||||
'protected ___$$trait$$': function() {},
|
|
||||||
|
|
||||||
// protected member object (we define this as protected so that the
|
// protected member object (we define this as protected so that the
|
||||||
// parent ACLS has access to it (!), which is not prohibited since
|
// parent ACLS has access to it (!), which is not prohibited since
|
||||||
// JS does not provide a strict typing mechanism...this is a kluge)
|
// JS does not provide a strict typing mechanism...this is a kluge)
|
||||||
|
@ -506,7 +503,7 @@ function mixMethods( src, dest, vis, iname )
|
||||||
// TODO: this is a kluge; we'll use proper reflection eventually,
|
// TODO: this is a kluge; we'll use proper reflection eventually,
|
||||||
// but for now, this is how we determine if this is an actual method
|
// but for now, this is how we determine if this is an actual method
|
||||||
// vs. something that just happens to be on the visibility object
|
// vs. something that just happens to be on the visibility object
|
||||||
if ( !( src[ f ].___$$keywords$$ ) || f === '___$$trait$$' )
|
if ( !( src[ f ].___$$keywords$$ ) )
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue