Merge "Reset contexts before calling LoadHook"

This commit is contained in:
Treehugger Robot 2022-01-06 01:31:00 +00:00 committed by Gerrit Code Review
commit 33132a4fd5

View file

@ -1368,6 +1368,8 @@ func runAndRemoveLoadHooks(ctx *Context, config interface{}, module *moduleInfo,
if v, exists := pendingHooks.Load(module.logicModule); exists {
hooks := v.(*[]LoadHook)
for _, hook := range *hooks {
mctx := &loadHookContext{
baseModuleContext: baseModuleContext{
context: ctx,
@ -1376,8 +1378,6 @@ func runAndRemoveLoadHooks(ctx *Context, config interface{}, module *moduleInfo,
},
scopedModuleFactories: scopedModuleFactories,
}
for _, hook := range *hooks {
hook(mctx)
newModules = append(newModules, mctx.newModules...)
deps = append(deps, mctx.ninjaFileDeps...)