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

Split line_no and node_id before new_insn_body #9898

Merged
merged 1 commit into from
Feb 9, 2024

Conversation

kddnewton
Copy link
Contributor

Before this commit, there were many places where we had to generate dummy line nodes to hold both the line number and the node id that would then immediately get pulled out from the created node. Now we pass them explicitly so that we don't have to generate these nodes.

This makes a clearer line between the parser and compiler, and also makes it easier to generate instructions when we don't have a specific node to tie them to. As such, it removes almost every single place where we needed to previously generate dummy nodes.

This also makes it easier for the prism compiler, because now we can pass in line number and node id instead of trying to generate dummy nodes for every instruction that we compile.

@ko1 would this be okay? This would really help out the prism compiler, and I think it's good for compile.c (you can see it simplifies a lot of the callsites without having to generate dummy line nodes).

@ko1
Copy link
Contributor

ko1 commented Feb 9, 2024

I have no objection. (I'm not a author of node_id related code though)

@kddnewton kddnewton force-pushed the split-line-node branch 4 times, most recently from 4f7ddb5 to 66640ac Compare February 9, 2024 16:24
Before this commit, there were many places where we had to generate
dummy line nodes to hold both the line number and the node id that
would then immediately get pulled out from the created node. Now
we pass them explicitly so that we don't have to generate these
nodes.

This makes a clearer line between the parser and compiler, and also
makes it easier to generate instructions when we don't have a
specific node to tie them to. As such, it removes almost every
single place where we needed to previously generate dummy nodes.

This also makes it easier for the prism compiler, because now we
can pass in line number and node id instead of trying to generate
dummy nodes for every instruction that we compile.
@kddnewton kddnewton enabled auto-merge (rebase) February 9, 2024 21:55
@kddnewton kddnewton merged commit f7467e7 into ruby:master Feb 9, 2024
96 of 97 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants