Don't mutate shared lookahead nodes when setting the extra flag
This commit is contained in:
parent
71059f1d66
commit
3c3d95345f
3 changed files with 10 additions and 0 deletions
|
|
@ -221,6 +221,9 @@ static bool ts_parser__shift(TSParser *self, int head,
|
|||
|
||||
static bool ts_parser__shift_extra(TSParser *self, int head, TSStateId state,
|
||||
TSTree *lookahead) {
|
||||
TSSymbolMetadata metadata = self->language->symbol_metadata[lookahead->symbol];
|
||||
if (!metadata.extra && ts_stack_head_count(self->stack) > 1)
|
||||
lookahead = ts_tree_make_copy(lookahead);
|
||||
ts_tree_set_extra(lookahead);
|
||||
return ts_parser__shift(self, head, state, lookahead);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue