Add Document parse_count() method, for tracking if trees are still valid
This commit is contained in:
parent
2869458ce9
commit
66ad271c82
4 changed files with 17 additions and 0 deletions
|
|
@ -26,6 +26,7 @@ static void ts_document__reparse(TSDocument *document, TSInputEdit *edit) {
|
|||
ts_tree_release(document->tree);
|
||||
document->tree = tree;
|
||||
ts_tree_retain(tree);
|
||||
document->parse_count++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -74,3 +75,7 @@ TSNode ts_document_root_node(const TSDocument *document) {
|
|||
result = ts_node_named_child(result, 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
size_t ts_document_parse_count(const TSDocument *document) {
|
||||
return document->parse_count;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue