From 5527a57da8dfc03f315f08dad7d9f6236984b1aa Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sun, 24 Dec 2017 06:46:39 +0300 Subject: [PATCH] now action attr searches also look in alias targets... Signed-off-by: Alex A. Naanou --- actions.js | 23 ++++++++++++++++++++++- package.json | 2 +- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/actions.js b/actions.js index cdb201a..0606b47 100755 --- a/actions.js +++ b/actions.js @@ -366,6 +366,17 @@ function(func){ // $N - expanded to and instance of parseStringAction.Argument // ... - expanded to parseStringAction.ALLARGS (singleton) // +// +// Returns: +// { +// action: action, +// arguments: args, +// doc: doc, +// no_default: no_default, +// stop_propagation: false, +// +// code: txt, +// } // // NOTE: identifiers are resolved as attributes of the context... // XXX this is the same as ImageGrid's keyboard.parseActionCall(..), reuse @@ -1014,7 +1025,8 @@ module.MetaActions = { // // Attribute search order (return first matching): // - Local action - // - Local action.function (.func) + // - Local action function (.func) + // - if an alias look in the target... // - repeat for .__proto__ (until top of MRO) // - repeat for '__call__' special action (XXX EXPERIMENTAL) // @@ -1051,6 +1063,15 @@ module.MetaActions = { // attribute of action function... } else if(cur[action].func && cur[action].func[attr] !== undefined){ return cur[action].func[attr] + + // alias -> look in the target action... + } else if(cur[action] instanceof Alias){ + var res = this.getActionAttr( + this.parseStringAction(cur[action].alias).action, + attr) + if(res !== undefined){ + return res + } } } cur = cur.__proto__ diff --git a/package.json b/package.json index 1509890..4f531ab 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ig-actions", - "version": "3.11.0", + "version": "3.12.0", "description": "", "main": "actions.js", "scripts": {