fix(query): correct last_child_step_index in cases where a new step
wasn't created.
This fixes an OOB access to `self.steps` when a last child anchor
immediately follows a predicate.
(cherry picked from commit b1d2b7cfb8)
This commit is contained in:
parent
97131b4a73
commit
69723ca40e
2 changed files with 15 additions and 1 deletions
|
|
@ -5621,3 +5621,14 @@ const foo = [
|
|||
assert_eq!(matches.len(), 1);
|
||||
assert_eq!(matches[0].1, captures);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_query_with_predicate_causing_oob_access() {
|
||||
let language = get_language("rust");
|
||||
|
||||
let query = "(call_expression
|
||||
function: (scoped_identifier
|
||||
path: (scoped_identifier (identifier) @_regex (#any-of? @_regex \"Regex\" \"RegexBuilder\") .))
|
||||
(#set! injection.language \"regex\"))";
|
||||
Query::new(&language, query).unwrap();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue