Skip to content

Commit ae15566

Browse files
authored
Merge pull request tree-sitter#2219 from ahlinc/fix-query-step-init
lib: make query step init depend from MAX_STEP_CAPTURE_COUNT declaration
2 parents c4871a2 + 4f4b86a commit ae15566

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/src/query.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -801,11 +801,10 @@ static QueryStep query_step__new(
801801
uint16_t depth,
802802
bool is_immediate
803803
) {
804-
return (QueryStep) {
804+
QueryStep step = {
805805
.symbol = symbol,
806806
.depth = depth,
807807
.field = 0,
808-
.capture_ids = {NONE, NONE, NONE},
809808
.alternative_index = NONE,
810809
.negated_field_list_id = 0,
811810
.contains_captures = false,
@@ -817,6 +816,10 @@ static QueryStep query_step__new(
817816
.is_immediate = is_immediate,
818817
.alternative_is_immediate = false,
819818
};
819+
for (unsigned i = 0; i < MAX_STEP_CAPTURE_COUNT; i++) {
820+
step.capture_ids[i] = NONE;
821+
}
822+
return step;
820823
}
821824

822825
static void query_step__add_capture(QueryStep *self, uint16_t capture_id) {

0 commit comments

Comments
 (0)