From 5ec3769cb4c9acfda64f80d7c14abce939e8b4c5 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 17 May 2018 14:24:32 -0700 Subject: [PATCH] Make ts_tree_cursor_current_node take the cursor as const --- include/tree_sitter/runtime.h | 2 +- src/runtime/tree_cursor.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/tree_sitter/runtime.h b/include/tree_sitter/runtime.h index 6a6767e9..e0badebd 100644 --- a/include/tree_sitter/runtime.h +++ b/include/tree_sitter/runtime.h @@ -129,7 +129,7 @@ bool ts_tree_cursor_goto_first_child(TSTreeCursor *); int64_t ts_tree_cursor_goto_first_child_for_byte(TSTreeCursor *, uint32_t); bool ts_tree_cursor_goto_next_sibling(TSTreeCursor *); bool ts_tree_cursor_goto_parent(TSTreeCursor *); -TSNode ts_tree_cursor_current_node(TSTreeCursor *); +TSNode ts_tree_cursor_current_node(const TSTreeCursor *); uint32_t ts_language_symbol_count(const TSLanguage *); const char *ts_language_symbol_name(const TSLanguage *, TSSymbol); diff --git a/src/runtime/tree_cursor.c b/src/runtime/tree_cursor.c index d7695634..092e31f9 100644 --- a/src/runtime/tree_cursor.c +++ b/src/runtime/tree_cursor.c @@ -170,8 +170,8 @@ bool ts_tree_cursor_goto_parent(TSTreeCursor *_self) { return false; } -TSNode ts_tree_cursor_current_node(TSTreeCursor *_self) { - TreeCursor *self = (TreeCursor *)_self; +TSNode ts_tree_cursor_current_node(const TSTreeCursor *_self) { + const TreeCursor *self = (const TreeCursor *)_self; TreeCursorEntry *last_entry = array_back(&self->stack); TSSymbol alias_symbol = 0; if (self->stack.size > 1) {