Conversation
Moved `lowering_labels` and `lowering_ordinal` from function-static variables in `source/lex.h` to member variables of the `cppfront` class in `source/to_cpp1.h`. The refactored logic ensures that translation state is properly tracked within the compiler context rather than relying on global static state, improving maintainability and supporting future parallel or multi-file processing within the same process. Call sites in `to_cpp1.h` were updated to use the new member functions. Function-static-dependent free functions were removed from `lex.h`.
|
👋 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
🎯 What:
Refactored the
labelized_positionandunnamed_type_param_namelogic to eliminate the use of function-static variables (ordinalandlabels).💡 Why:
The use of
staticvariables in these functions was marked withTODO: static. Moving this state into thecppfrontcontext object avoids global state, which improves code maintainability and ensures that state is isolated to each translation instance.✅ Verification:
g++ -std=c++20 source/cppfront.cpp -o cppfront.✨ Result:
Improved the health of the codebase by following modern C++ practices of encapsulating state within context objects.
PR created automatically by Jules for task 929319608379097434 started by @jnorthrup