diff --git a/lib/Trait.js b/lib/Trait.js index 0304a6b..57f338e 100644 --- a/lib/Trait.js +++ b/lib/Trait.js @@ -740,8 +740,18 @@ function mixMethods( src, dest, vis, iname, inparent ) continue; } - var keywords = src[ f ].___$$keywords$$, - vis = keywords['protected'] ? 'protected' : 'public'; + var keywords = src[ f ].___$$keywords$$; + + // TODO: This is a kluge to handle ES3 fallbacks, which will cause + // protected members to appear on the public prototype. A more + // elegant solution is to automatically add the public keyword when + // the class is built, so we can just check if keywords[vis] exists. + if ( ( vis === 'public' ) && keywords[ 'protected' ] ) + { + continue; + } + + vis = keywords[ 'protected' ] ? 'protected' : 'public'; // if abstract, then we are expected to provide the implementation; // otherwise, we proxy to the trait's implementation