From 5fa6d395785129c65e271f8b321846f239e9b4e4 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 9 May 2018 14:14:56 -0700 Subject: [PATCH] Fix alias handling in ts_tree_string Co-Authored-By: Rick Winfrey --- src/runtime/tree.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/runtime/tree.c b/src/runtime/tree.c index fcb534dd..0174d3d8 100644 --- a/src/runtime/tree.c +++ b/src/runtime/tree.c @@ -609,15 +609,12 @@ static size_t ts_tree__write_to_string(const Tree *self, char *string, size_t li 0, false ); } else { + TSSymbol alias_symbol = alias_sequence ? alias_sequence[structural_child_index] : 0; cursor += ts_tree__write_to_string( child, *writer, limit, language, false, include_all, - alias_sequence - ? alias_sequence[structural_child_index] - : 0, - alias_sequence - ? ts_language_symbol_metadata(language, alias_sequence[structural_child_index]).named - : false + alias_symbol, + alias_symbol ? ts_language_symbol_metadata(language, alias_symbol).named : false ); structural_child_index++; }