From 8c7ad787c80e097dbc9f5a13379a9f5ec4f1f53b Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Tue, 25 Jan 2011 00:24:50 -0500 Subject: [PATCH] Abstract methods list is no longer public --- lib/class.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/class.js b/lib/class.js index ff9d7bd..f1ba4e9 100644 --- a/lib/class.js +++ b/lib/class.js @@ -217,7 +217,8 @@ var extend = ( function( extending ) prototype, prototype, prototype ), - abstract_methods = util.clone( base.abstractMethods ) + abstract_methods = + util.clone( getMeta( base.__cid ).abstractMethods ) || { __length: 0 } ; @@ -303,7 +304,8 @@ var extend = ( function( extending ) util.freeze( new_class ); // create internal metadata for the new class - createMeta( new_class, base.prototype.__cid ); + var meta = createMeta( new_class, base.prototype.__cid ); + meta.abstractMethods = abstract_methods; // we're done with the extension process extending = false; @@ -512,11 +514,6 @@ function attachAbstract( func, methods ) { return is_abstract; }); - - // attach the list of abstract methods to the class (make the copy of the - // methods to ensure that they won't be gc'd or later modified and screw up - // the value) - util.defineSecureProp( func, 'abstractMethods', methods ); } @@ -627,6 +624,8 @@ function createMeta( func, parent_id ) implemented: [], }; } + + return class_meta[ id ]; } @@ -642,6 +641,6 @@ function createMeta( func, parent_id ) */ function getMeta( id ) { - return class_meta[ id ]; + return class_meta[ id ] || {}; }