mirror of
https://github.com/flynx/actions.js.git
synced 2025-10-28 09:50:10 +00:00
more string action refactroing...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
b30681fad8
commit
6a6fd990f3
11
actions.js
11
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 }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user