Rust: ensure error and token locations are valid

The locations are "clipped" to the ranges of the parent node of a token,
and the root node of the parse tree for errors.
This commit is contained in:
Arthur Baars
2024-10-07 18:32:20 +02:00
parent 58d2c71c20
commit 8372a2e562
4 changed files with 193 additions and 168 deletions

View File

@@ -522,7 +522,7 @@ impl Translator<'_> {{
writeln!(buf, " self.emit_location(label, &node);")?;
writeln!(
buf,
" self.emit_tokens(label.into(), node.syntax().children_with_tokens());"
" self.emit_tokens(&node, label.into(), node.syntax().children_with_tokens());"
)?;
writeln!(buf, " label")?;