1
0
Fork 0

Moved validateMethod() function into MemberBuilder prototype to prepare for overriding with FallbackMemberBuilder

closure/master
Mike Gerwitz 2011-10-14 22:14:29 -04:00
parent c9b5fb32d0
commit 9c9759a2b1
1 changed files with 8 additions and 5 deletions

View File

@ -111,7 +111,7 @@ exports.buildMethod = function(
// ensure that the declaration is valid (keywords make sense, argument // ensure that the declaration is valid (keywords make sense, argument
// length, etc) // length, etc)
validateMethod( keywords, prev_data, prev_keywords, value, name ); this._validateMethod( keywords, prev_data, prev_keywords, value, name );
// we might be overriding an existing method // we might be overriding an existing method
if ( prev ) if ( prev )
@ -161,7 +161,8 @@ exports.buildMethod = function(
* @param {*} value property value * @param {*} value property value
* @param {string} name property name * @param {string} name property name
*/ */
function validateMethod( keywords, prev_data, prev_keywords, value, name ) exports._validateMethod = function(
keywords, prev_data, prev_keywords, value, name )
{ {
var prev = ( prev_data ) ? prev_data.member : null; var prev = ( prev_data ) ? prev_data.member : null;
@ -243,7 +244,7 @@ function validateMethod( keywords, prev_data, prev_keywords, value, name )
} }
// do not permit visibility deescalation // do not permit visibility deescalation
if ( prev_data.visibility < getVisibilityValue( keywords ) ) if ( prev_data.visibility < this._getVisibilityValue( keywords ) )
{ {
throw TypeError( throw TypeError(
"Cannot de-escalate visibility of method '" + name + "'" "Cannot de-escalate visibility of method '" + name + "'"
@ -309,7 +310,9 @@ exports.buildProp = function( members, meta, name, value, keywords, base )
} }
// do not permit visibility de-escalation // do not permit visibility de-escalation
if ( prev && ( prev_data.visibility < getVisibilityValue( keywords ) ) ) if ( prev &&
( prev_data.visibility < this._getVisibilityValue( keywords ) )
)
{ {
throw TypeError( throw TypeError(
"Cannot de-escalate visibility of property '" + name + "'" "Cannot de-escalate visibility of property '" + name + "'"
@ -608,7 +611,7 @@ exports._overrideMethod = function(
* *
* @return {number} visibility level as a numeric value * @return {number} visibility level as a numeric value
*/ */
function getVisibilityValue( keywords ) exports._getVisibilityValue = function( keywords )
{ {
if ( fallback ) if ( fallback )
{ {