2011-01-18 23:47:58 -05:00
|
|
|
/**
|
|
|
|
* Handles building members (properties, methods)
|
|
|
|
*
|
|
|
|
* Copyright (C) 2010 Mike Gerwitz
|
|
|
|
*
|
|
|
|
* This file is part of ease.js.
|
|
|
|
*
|
|
|
|
* ease.js is free software: you can redistribute it and/or modify it under the
|
|
|
|
* terms of the GNU Lesser General Public License as published by the Free
|
|
|
|
* Software Foundation, either version 3 of the License, or (at your option)
|
|
|
|
* any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
|
|
|
* for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* @author Mike Gerwitz
|
|
|
|
* @package core
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Copies a property to the appropriate member prototype, depending on
|
|
|
|
* visibility, and assigns necessary metadata from keywords
|
|
|
|
*
|
|
|
|
* @param {{public: Object, protected: Object, private: Object}} members
|
|
|
|
*
|
|
|
|
* @param {Object} meta metadata container
|
|
|
|
* @param {string} name property name
|
|
|
|
* @param {*} value property value
|
|
|
|
*
|
|
|
|
* @param {Object.<string,boolean>} keywords parsed keywords
|
|
|
|
*
|
|
|
|
* @return {undefined}
|
|
|
|
*/
|
|
|
|
exports.buildProp = function( members, meta, name, value, keywords )
|
|
|
|
{
|
2011-01-20 21:51:35 -05:00
|
|
|
if ( keywords[ 'private' ] )
|
2011-01-20 21:46:49 -05:00
|
|
|
{
|
2011-01-20 21:51:35 -05:00
|
|
|
members[ 'private' ][ name ] = value;
|
2011-01-20 21:46:49 -05:00
|
|
|
}
|
2011-01-20 21:51:35 -05:00
|
|
|
else if ( keywords[ 'protected' ] )
|
2011-01-20 21:48:09 -05:00
|
|
|
{
|
2011-01-20 21:51:35 -05:00
|
|
|
members[ 'protected' ][ name ] = value;
|
2011-01-20 21:48:09 -05:00
|
|
|
}
|
2011-01-20 21:50:52 -05:00
|
|
|
else
|
|
|
|
{
|
|
|
|
// public keyword is the default, so explicitly specifying it is only
|
|
|
|
// for clarity
|
|
|
|
members[ 'public' ][ name ] = value;
|
|
|
|
}
|
2011-01-18 23:47:58 -05:00
|
|
|
};
|
|
|
|
|