fix(extraction): blank C designated-initializer macro args before parsing - #1755
Merged
Merged
Conversation
…sing
tree-sitter-c has no rule for `.field = value` as a call argument. A
statement-level `MACRO(a, b, .x = …, .y = { … },);` recovers by extending
the enclosing function_definition to EOF — later functions vanish or nest
as outer::inner (#1729). blankCDesignatedMacroArgs empties such argument
lists to spaces (newlines kept) at the head of preParseCSource, before the
kernel route point, so both wasm and kernel C arms see the same bytes.
Tests cover the issue fixture (trailing-comma designated args) and a
120-field scale guard. Refs #1729.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
function_definitionto EOF — later functions drop or nest asouter::inner.blankCDesignatedMacroArgsat the head ofpreParseCSourceempties those arg lists to spaces (newlines kept). Runs before the kernel route point, so both wasm and kernel C arms need no separate change.f→EOF /gmissing /hasf::h→ correct extents). Added that fixture as the primary e2e test plus a 120-field scale guard.Out of scope
#ifgroup to its first branch before parsing #1736 (damaged#ifgroups / remaining nested phantoms) is related but a different shape; left alone.Test plan
f/g/hextents and top-level QNsvitestcases: blank unit + issue fixture e2e + 120-field guard