diff options
Diffstat (limited to 'starts/meaning-vm/habit-starts/learning-parts.cpp')
-rw-r--r-- | starts/meaning-vm/habit-starts/learning-parts.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/starts/meaning-vm/habit-starts/learning-parts.cpp b/starts/meaning-vm/habit-starts/learning-parts.cpp index ee55b04..365653b 100644 --- a/starts/meaning-vm/habit-starts/learning-parts.cpp +++ b/starts/meaning-vm/habit-starts/learning-parts.cpp @@ -1185,3 +1185,34 @@ static int __init = ([]()->int{ return 0; })(); +diff --git a/starts/meaning-vm/habit-starts/learning-parts.cpp b/starts/meaning-vm/habit-starts/learning-parts.cpp +index ee55b04..09c7b64 100644 +@@ -1127,10 +94,13 @@ static int __init = ([]()->int{ + + if (!happened.linked(whenever-list)) { return; } + +- (until-each-list-item-context-in-list)(action-whenever-happened, ctx, happened.get(whenever-list)); ++ ref stub = a(event); ++ stub.set(event, ev); ++ ++ (until-each-list-item-context-in-list)(action-whenever-happened, stub, happened.get(whenever-list)); + }); + +- ahabit(action-whenever-happened, ((list-item, li), (happened-context, hapctx)), ++ ahabit(action-whenever-happened, ((list-item, li), (event, h)), + { + // here: when we trigger a behavior, we want information associated with producing the trigger, + // as well as the event that triggered. that's two contexts. +@@ -1142,8 +112,11 @@ static int __init = ([]()->int{ + // take one context, which is the one prepared + // in the list, then we inject our context + // into that, inside a "happened" property. ++ ref actctx = i.get(action-context); ++ ++ actctx.set(happened, h); + +- i.get(action)(hapctx, i.get(action-context)); ++ i.get(action).fun<ref>()(i.get(actctx)); + }); + + ahabit(whenever-habit, ((happens, ev), (action, act), (action-context, actctx)), |