From ab53f86ed0a6d2306c642bda61c9fba14d34d266 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sat, 25 Jul 2026 01:43:58 +0300 Subject: [PATCH] playing with root vs parent ns... Signed-off-by: Alex A. Naanou --- v3/pwiki/parser.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/v3/pwiki/parser.js b/v3/pwiki/parser.js index 5754e58..ffb8f9c 100644 --- a/v3/pwiki/parser.js +++ b/v3/pwiki/parser.js @@ -656,9 +656,10 @@ module.BaseParser = { // time it only should care about what was promised // before it neglecting what came after. var res = that.callMacro(page, name, args, body, { - // global state... + // global/parent state... __proto__: state, - state, + root: state.root ?? state, + parent: state, // local state... waitAll: state.waitAll, waitNested: state.waitNested, @@ -895,7 +896,10 @@ module.BaseParser = { return Promise.awaitOrRun( // XXX LOCAL_STATE //...(state.unresolved ?? []), - state.wait, + state.hasOwnProperty('wait') ? + state.wait + // XXX + : null, function(){ //delete state.unresolved // re-resolve... @@ -1197,7 +1201,8 @@ module.parser = { return '' } //* XXX LOCAL_STATE - var vars = state.state.vars ??= {} + var vars = state.parent.vars ??= {} + //var vars = state.root.vars ??= {} /*/ var vars = state.vars ??= {} //*/ @@ -1346,7 +1351,8 @@ module.parser = { var name = args.name //* XXX LOCAL_STATE - var slots = state.state.slots ??= {} + var slots = state.parent.slots ??= {} + //var slots = state.root.slots ??= {} /*/ var slots = state.slots ??= {} //*/ @@ -1709,7 +1715,8 @@ module.parser = { var that = this //* XXX LOCAL_STATE - var macros = state.state.macros ??= {} + var macros = state.parent.macros ??= {} + //var macros = state.root.macros ??= {} /*/ var macros = state.macros ??= {} //*/