From 1b482f07856b2275ef54b3d12d685ac51256d23e Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 7 Nov 2018 15:11:21 -0800 Subject: [PATCH] Reorder TSTreeCursor fields so it has the same structure as internal TreeCursor --- include/tree_sitter/runtime.h | 4 ++-- src/runtime/tree.c | 4 ++-- src/runtime/tree_cursor.c | 2 +- src/runtime/tree_cursor.h | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/tree_sitter/runtime.h b/include/tree_sitter/runtime.h index 6461a202..3ff70820 100644 --- a/include/tree_sitter/runtime.h +++ b/include/tree_sitter/runtime.h @@ -72,9 +72,9 @@ typedef struct { } TSNode; typedef struct { - uint32_t context[2]; - const void *id; const void *tree; + const void *id; + uint32_t context[2]; } TSTreeCursor; TSParser *ts_parser_new(); diff --git a/src/runtime/tree.c b/src/runtime/tree.c index 75680e91..919dbcef 100644 --- a/src/runtime/tree.c +++ b/src/runtime/tree.c @@ -81,8 +81,8 @@ void ts_tree_edit(TSTree *self, const TSInputEdit *edit) { TSRange *ts_tree_get_changed_ranges(const TSTree *self, const TSTree *other, uint32_t *count) { TSRange *result; - TreeCursor cursor1 = {array_new(), NULL}; - TreeCursor cursor2 = {array_new(), NULL}; + TreeCursor cursor1 = {NULL, array_new()}; + TreeCursor cursor2 = {NULL, array_new()}; TSNode root = ts_tree_root_node(self); ts_tree_cursor_init(&cursor1, root); ts_tree_cursor_init(&cursor2, root); diff --git a/src/runtime/tree_cursor.c b/src/runtime/tree_cursor.c index b3c765d4..ac7a015d 100644 --- a/src/runtime/tree_cursor.c +++ b/src/runtime/tree_cursor.c @@ -66,7 +66,7 @@ static inline bool ts_tree_cursor_child_iterator_next(ChildIterator *self, // TSTreeCursor - lifecycle TSTreeCursor ts_tree_cursor_new(TSNode node) { - TSTreeCursor self = {{0, 0}, NULL, NULL}; + TSTreeCursor self = {NULL, NULL, {0, 0}}; ts_tree_cursor_init((TreeCursor *)&self, node); return self; } diff --git a/src/runtime/tree_cursor.h b/src/runtime/tree_cursor.h index 0df79d5e..84300b21 100644 --- a/src/runtime/tree_cursor.h +++ b/src/runtime/tree_cursor.h @@ -11,8 +11,8 @@ typedef struct { } TreeCursorEntry; typedef struct { - Array(TreeCursorEntry) stack; const TSTree *tree; + Array(TreeCursorEntry) stack; } TreeCursor; void ts_tree_cursor_init(TreeCursor *, TSNode);