Previously generateAndCache (which was called generateCode before) was called once with files (like 258 of the removed code var newFiles = nonPrivateCodeGenerators.generateCode(files)). Always using anvilModule.allFiles.toList() can break custom code generators that use topLevelFunctionReferences or topLevelPropertyReferences because it won't contain any KtFile that doesn't contain a KtClassOrObject. So a KtFile that only contains top level functions and/or properties will not be passed to code generators anymore and because of that topLevel*References won't include functions/properties from those files.
Originally reported here by @gabrielittner: https://github.com/square/anvil/pull/946/files#r1554957479