Skip to content

Break out OutputText and RuleTextParts#177

Merged
elliotgoodrich merged 1 commit intomainfrom
more-breaking-stuff-up
Nov 10, 2025
Merged

Break out OutputText and RuleTextParts#177
elliotgoodrich merged 1 commit intomainfrom
more-breaking-stuff-up

Conversation

@elliotgoodrich
Copy link
Copy Markdown
Owner

Continue breaking up BuildContext into smaller, more-encapsulated, and documented classes so that future work in trimutil.cpp is easier.

As part of this we rename Rule to RuleVariables and RuleCommand to Rule to reflect better what these classes represent.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the BuildContext class in trimutil.cpp to improve code organization and encapsulation. The main changes involve extracting functionality into smaller, well-documented classes and renaming existing classes to better reflect their purpose.

  • Extracted OutputText class to manage the final output text of the ninja file trimming
  • Extracted RuleTextParts class to manage the parts of a ninja rule within OutputText
  • Renamed Rule to RuleVariables to better represent that it holds rule variables
  • Renamed RuleCommand to Rule to better represent a complete ninja rule

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/trimutil.cpp Introduced new OutputText, RuleTextParts, and Rule classes; updated BuildContext to use these new classes; migrated all usage of old types to new types
src/rulevariables.h Updated header guard and renamed Rule class to RuleVariables
src/rulevariables.cpp Updated include path and renamed all Rule method implementations to RuleVariables
src/edgescope.h Updated include path from rule.h to rulevariables.h and updated type references
CMakeLists.txt Updated source file reference from src/rule.cpp to src/rulevariables.cpp
src/all.natvis Updated debugger visualization for OutputText::Index type

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

src/trimutil.cpp Outdated
* @param start The index of the start of the rule, up to the start of the
* rule name
* @param name The index of the name of the rule
* @param end The index of the rest of the rule after the name, including all
Copy link

Copilot AI Nov 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation parameter name @param end does not match the actual parameter name rest. The documentation should use @param rest instead of @param end.

Suggested change
* @param end The index of the rest of the rule after the name, including all
* @param rest The index of the rest of the rule after the name, including all

Copilot uses AI. Check for mistakes.
Continue breaking up `BuildContext` into smaller, more-encapsulated, and
documented classes so that future work in `trimutil.cpp` is easier.

As part of this we rename `Rule` to `RuleVariables` and `RuleCommand` to
`Rule` to reflect better what these classes represent.
@elliotgoodrich elliotgoodrich merged commit 48b9ed8 into main Nov 10, 2025
12 checks passed
@elliotgoodrich elliotgoodrich deleted the more-breaking-stuff-up branch November 10, 2025 20:26
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