Repository: flex-asjs Updated Branches: refs/heads/develop c66025843 -> cea869d48
handle ++ Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/c8e33f10 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/c8e33f10 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/c8e33f10 Branch: refs/heads/develop Commit: c8e33f100255713a8ac521172714151c9b07bb06 Parents: c660258 Author: Alex Harui <aha...@apache.org> Authored: Fri Nov 14 08:00:31 2014 -0800 Committer: Alex Harui <aha...@apache.org> Committed: Fri Nov 14 22:29:51 2014 -0800 ---------------------------------------------------------------------- .../src/org/apache/flex/utils/Language.js | 60 ++++++++++++++++++++ 1 file changed, 60 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c8e33f10/frameworks/js/FlexJS/src/org/apache/flex/utils/Language.js ---------------------------------------------------------------------- diff --git a/frameworks/js/FlexJS/src/org/apache/flex/utils/Language.js b/frameworks/js/FlexJS/src/org/apache/flex/utils/Language.js index 099a0a4..d8f3c40 100644 --- a/frameworks/js/FlexJS/src/org/apache/flex/utils/Language.js +++ b/frameworks/js/FlexJS/src/org/apache/flex/utils/Language.js @@ -183,3 +183,63 @@ org.apache.flex.utils.Language.trace = function(opt_value) { org.apache.flex.utils.Language.uint = function(value) { return value >>> 0; }; + + +/** + * preincrement handles --foo + * + * @expose + * @param {Object} obj The object with the getter/setter. + * @param {string} prop The name of a property. + * @return {number} + */ +org.apache.flex.utils.Language.preincrement = function(obj, prop) { + var value = obj["get_" + prop]() + 1; + obj["set_" + prop](value); + return value; +}; + + +/** + * predecrement handles ++foo + * + * @expose + * @param {Object} obj The object with the getter/setter. + * @param {string} prop The name of a property. + * @return {number} + */ +org.apache.flex.utils.Language.predecrement = function(obj, prop) { + var value = obj["get_" + prop]() - 1; + obj["set_" + prop](value); + return value; +}; + + +/** + * postincrement handles foo++ + * + * @expose + * @param {Object} obj The object with the getter/setter. + * @param {string} prop The name of a property. + * @return {number} + */ +org.apache.flex.utils.Language.postincrement = function(obj, prop) { + var value = obj["get_" + prop](); + obj["set_" + prop](value + 1); + return value; +}; + + +/** + * postdecrement handles foo++ + * + * @expose + * @param {Object} obj The object with the getter/setter. + * @param {string} prop The name of a property. + * @return {number} + */ +org.apache.flex.utils.Language.postdecrement = function(obj, prop) { + var value = obj["get_" + prop](); + obj["set_" + prop](value + 1); + return value; +};