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

No clear way to create a new global import #226

Open
PinkCherryBlossom opened this issue Feb 24, 2022 · 1 comment
Open

No clear way to create a new global import #226

PinkCherryBlossom opened this issue Feb 24, 2022 · 1 comment
Labels
question Further information is requested

Comments

@PinkCherryBlossom
Copy link

Summary

The only way I can see to add the global part of a global import is ModuleGlobals::add_import. This requires an ImportId for the import part of the global import. The only way I can see to get that is by using ModuleImports::add, but that requires an ImportKind enum, which for the global variant requires... a GlobalId, which we need to call ModuleGlobals::add_import to get... and we're back where we started.

Additional Details

Perhaps one potential way to do this would be to call ModuleGlobals::add_local with dummy values to reserve a GlobalId, then mutate that later? But that feels like quite an ugly workaround.

Am I missing some easy way of doing this? If not, should there perhaps be a utility function that can allocate to both arenas at once so this is possible?

@PinkCherryBlossom PinkCherryBlossom added the question Further information is requested label Feb 24, 2022
@PinkCherryBlossom
Copy link
Author

I'm running in to the same issue with imported functions, which makes me think I'm definitely doing something wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant