Rework AST access API: reduce heap allocation

This commit is contained in:
Max Brunsfeld 2015-07-31 15:47:48 -07:00
parent feb46302f3
commit 54e40b8146
16 changed files with 288 additions and 273 deletions

View file

@ -26,7 +26,7 @@ describe("Document", [&]() {
it("parses the document", [&]() {
ts_document_set_input_string(doc, "{ \"key\": [1, 2] }");
AssertThat(ts_node_string(ts_document_root_node(doc)), Equals(
AssertThat(ts_node_string(ts_document_root_node(doc), doc), Equals(
"(DOCUMENT (object (string) (array (number) (number))))"));
});
});
@ -35,7 +35,7 @@ describe("Document", [&]() {
it("does not try to parse the document", [&]() {
ts_document_set_input_string(doc, "{ \"key\": [1, 2] }");
AssertThat(ts_document_root_node(doc), Equals<TSNode *>(nullptr));
AssertThat(ts_document_root_node(doc).data, Equals<void *>(nullptr));
});
});
});
@ -45,7 +45,7 @@ describe("Document", [&]() {
it("does not try to parse the document", [&]() {
ts_document_set_language(doc, ts_language_json());
AssertThat(ts_document_root_node(doc), Equals<TSNode *>(nullptr));
AssertThat(ts_document_root_node(doc).data, Equals<void *>(nullptr));
});
});
@ -57,7 +57,7 @@ describe("Document", [&]() {
it("parses the document", [&]() {
ts_document_set_language(doc, ts_language_json());
AssertThat(ts_node_string(ts_document_root_node(doc)), Equals(
AssertThat(ts_node_string(ts_document_root_node(doc), doc), Equals(
"(DOCUMENT (object (string) (array (number) (number))))"));
});
});