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

Compiling ASTs with references to stdlib causes errors during resolveDescriptors #2310

Open
jeshecdom opened this issue Mar 6, 2025 · 0 comments · May be fixed by #2311
Open

Compiling ASTs with references to stdlib causes errors during resolveDescriptors #2310

jeshecdom opened this issue Mar 6, 2025 · 0 comments · May be fixed by #2311
Assignees

Comments

@jeshecdom
Copy link
Contributor

The error is caused by the second step in precompile, at the first line of the openContext function. When passing the AST through the parsedModules optional argument in openContext, the openContext function drops the sources computed in the first step of precompile (which contain the stdlib declarations):

const modules = parsedModules ?? parseModules(sources, parser);

This causes missing reference errors in resolveDescriptors later.

It seems to me that instead of dropping sources, the function openContext should take the union of sources plus the optional argument parsedModules. Like this:

const parsedSources = parseModules(sources, parser);
const modules = typeof parsedModules === "undefined" ? parsedSources : [...parsedSources, ...parsedModules];
@jeshecdom jeshecdom self-assigned this Mar 6, 2025
@jeshecdom jeshecdom linked a pull request Mar 6, 2025 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant