mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 21:20:11 +01:00
I'm finding the current autoupdate difficult to reason about. What I'm trying to do here is use the class to make it easier to add helper functions. For example, I merge the vector+cursor for stdout/stderr into an object, passed to helpers together instead of as two parameters. ShouldAddCheckLine can check against output_file_number_ without passing that through a couple levels of function calls. In turn, ShouldAddCheckLine is shared with the end-of-file logic instead of that having its own comparison from what AddCheckLines does. Also, I'm trying to get the pre-AUTOUPDATE edits in their own loop, distinct from the main code. The class means AddRemappedNonCheckLine is a helper function to share code, instead of a lambda (which I was thinking would just confuse the flow further). I'm also changing the input non_check_lines to a single vector to match stdout/stderr. Because of the AUTOUPDATE + SPLIT lines, we're guaranteed to have at least one line per file. I realized file_offset_in_new_lines is redundant with output_line_number so code now uses the latter (because it's older -- I think one's as good as the other, otherwise). Note, this change deliberately does not affect output. I'm only trying to make it easier to read for the next changes, using the lack of change in results as a good indicator that this is getting it right.