Skip to content

Refactor parser state management to remove static vectors - #1

Open
jnorthrup wants to merge 1 commit into
mainfrom
refactor-parser-state-vectors-9732352551333987108
Open

jnorthrup wants to merge 1 commit into
mainfrom
refactor-parser-state-vectors-9732352551333987108

Conversation

@jnorthrup

Copy link
Copy Markdown
Owner

Addressed the TODO: static ? comments in source/parse.h by refactoring how the parser tracks current expression and statement contexts.

  • Removed static inline std::vector<expression_node*> current_expressions from expression_node.
  • Removed static inline std::vector<expression_statement_node*> current_expression_statements from expression_statement_node.
  • Added current_expressions and current_expression_statements as instance members of the parser class.
  • Updated expression_node and binary_expression_node constructors to take an optional parent pointer (e.g., expression_statement_node const* parent or expression_node const* parent).
  • Updated parser methods (expression, expression_statement, binary_expression, and postfix_expression) to manage the new member stacks and pass the appropriate parent pointers to AST node constructors.

Verified the changes by building the project and running regression tests.


PR created automatically by Jules for task 9732352551333987108 started by @jnorthrup

Replaces static inline vectors in expression_node and expression_statement_node
with instance member stacks in the parser class. Updates AST node constructors
to accept parent pointers, which are now explicitly passed during parsing.
This removes global state from the parser, improving reentrancy and
architectural soundness.
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

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.

1 participant