@@ -46,7 +46,7 @@ Traits.prototype = {
4646 _applyTo : function ( subject , options ) {
4747 var type = this . _configName ,
4848 o = { } ,
49- key , tp , excluded , aliases , alias , t ;
49+ key , tp , excluded , aliases , t ;
5050
5151 if ( this . _isApplicable ( options ) ) {
5252 o [ type ] = options ;
@@ -59,23 +59,24 @@ Traits.prototype = {
5959 tp = t . prototype || t ;
6060
6161 for ( key in tp ) {
62-
6362 this . _raiseErrorIfItIsState ( key , tp ) ;
63+ this . _applyIfNotExcluded ( key , excluded , aliases , subject , tp ) ;
64+ }
65+ } ,
6466
65- if ( excluded . indexOf ( key ) === - 1 ) {
66- alias = aliases [ key ] || key ;
67+ _applyIfNotExcluded : function ( key , excluded , aliases , subject , tp ) {
68+ var alias ;
69+ if ( excluded . indexOf ( key ) === - 1 ) {
70+ alias = aliases [ key ] || key ;
6771
68- this . _raiseErrorIfConflict ( alias , subject , tp ) ;
72+ this . _raiseErrorIfConflict ( alias , subject , tp ) ;
6973
70- if ( ! subject [ alias ] || subject [ alias ] === Requires . requiredMethod ) {
71- subject [ alias ] = tp [ key ] ;
72- }
74+ if ( ! subject [ alias ] || subject [ alias ] === Requires . requiredMethod ) {
75+ subject [ alias ] = tp [ key ] ;
7376 }
7477 }
7578 } ,
7679
77-
78-
7980 _raiseErrorIfItIsState : function ( key , traitProto ) {
8081 if ( typeof traitProto [ key ] !== 'function' ) {
8182 throw new Error ( 'Trait MUST NOT contain any state. Found: ' + key + ' as state while processing trait' ) ;
0 commit comments