Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RealAnvilModuleDescriptor.allFiles only returns files with type declarations #955

Closed
RBusarow opened this issue Apr 11, 2024 · 0 comments · Fixed by #956
Closed

RealAnvilModuleDescriptor.allFiles only returns files with type declarations #955

RBusarow opened this issue Apr 11, 2024 · 0 comments · Fixed by #956
Assignees
Labels
bug Something isn't working

Comments

@RBusarow
Copy link
Member

Originally reported here by @gabrielittner: https://github.com/square/anvil/pull/946/files#r1554957479

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.

@RBusarow RBusarow added the bug Something isn't working label Apr 11, 2024
@RBusarow RBusarow self-assigned this Apr 11, 2024
RBusarow added a commit that referenced this issue Apr 11, 2024
RBusarow added a commit that referenced this issue Apr 11, 2024
RBusarow added a commit that referenced this issue Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant