From 6a6fd990f3517bd2b7e518f3d794802b84f299df Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sat, 10 Feb 2018 14:12:21 +0300 Subject: [PATCH] more string action refactroing... Signed-off-by: Alex A. Naanou --- actions.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/actions.js b/actions.js index d81d97e..5eacd9d 100755 --- a/actions.js +++ b/actions.js @@ -490,7 +490,9 @@ parseStringAction.resolveArgs = function(context, action_args, call_args){ return args } parseStringAction.callAction = function(context, action, ...args){ - var action = this(action) + action = typeof(action) == typeof('str') ? + this(action) + : action return context[action.action] .apply(context, this.resolveArgs(context, action.arguments, args)) } @@ -917,11 +919,13 @@ function Alias(alias, doc, ldoc, attrs, target){ var that = this var in_args = [].slice.call(arguments) - // parse the target... + // XXX handle errors... + this.parseStringAction.callAction(this, parsed || target, in_args) + + /*/ parse the target... // XXX should we cache here??? var action = parsed || this.parseStringAction(target) - // XXX use that.parseStringAction.call(this, target, in_args) if(this[action.action] instanceof Function){ // handle args... var args = that.parseStringAction.resolveArgs(that, action.arguments, in_args) @@ -932,6 +936,7 @@ function Alias(alias, doc, ldoc, attrs, target){ // error... console.error(`${alias}: alias to unknown action: ${action.action}`) + //*/ } func.toString = function(){ return meth.alias.code || meth.alias }