Add Document parse_count() method, for tracking if trees are still valid

This commit is contained in:
Max Brunsfeld 2015-09-10 14:23:42 -07:00
parent 2869458ce9
commit 66ad271c82
4 changed files with 17 additions and 0 deletions

View file

@ -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;
}