Skip to content

transpile: Add AST node parent information#1655

Open
Rua wants to merge 9 commits intoimmunant:masterfrom
Rua:parents
Open

transpile: Add AST node parent information#1655
Rua wants to merge 9 commits intoimmunant:masterfrom
Rua:parents

Conversation

@Rua
Copy link
Contributor

@Rua Rua commented Mar 11, 2026

This collects information about the parent nodes of each AST node (except types). It's not currently used for anything, but could potentially be used to solve #1321, by allowing conversion functions across the transpiler to easily find the types of their parent nodes.

@Rua Rua changed the title transpile: Add node parent information transpile: Add AST node parent information Mar 11, 2026
@Rua Rua force-pushed the parents branch 5 times, most recently from 1769d54 to 89964e1 Compare March 18, 2026 13:23
@ahomescu
Copy link
Contributor

ahomescu commented Mar 20, 2026

I don't think we should merge a massive change that isn't used for anything. Edit: unless we also want #1679, in which case this is a prerequisite and not an independent change.

@Rua
Copy link
Contributor Author

Rua commented Mar 21, 2026

There are also other things that this makes possible, not all of which have been considered yet necessarily. One thing that comes to mind is being able to completely replace ExprContext, so that all context information is available globally and no longer relies on passing things down the call stack. That may be a requirement for making a fix for #1321, since macro translation is done outside the call stack and thus doesn't currently know what context each of its expansions exists in.

EDIT: To illustrate, the ctx being passed here is almost certainly wrong, because it's the context of the current expansion site, and not of the MacroObject itself, nor of all expansion sites:

self.convert_decl(ctx, *macro_id)?;

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 this pull request may close these issues.

2 participants