@@ -118,13 +118,13 @@ function interpolate_literal(node::SyntaxNode, val)
118118 SyntaxNode (node. source, node. raw, node. position, node. parent, true , val)
119119end
120120
121- function _show_syntax_node (io, current_filename, node, indent)
121+ function _show_syntax_node (io, current_filename, node:: SyntaxNode , indent)
122122 fname = node. source. filename
123123 line, col = source_location (node. source, node. position)
124124 posstr = " $(lpad (line, 4 )) :$(rpad (col,3 )) │$(lpad (node. position,6 )) :$(rpad (node. position+ span (node)- 1 ,6 )) │"
125- nodestr = haschildren ( node) ? " [ $( untokenize ( head (node))) ] " :
126- node. val isa Symbol ? string ( node. val) :
127- repr (node . val)
125+ val = node. val
126+ nodestr = haschildren ( node) ? " [ $( untokenize ( head ( node))) ] " :
127+ isa (val, Symbol) ? string (val) : repr (val)
128128 treestr = string (indent, nodestr)
129129 # Add filename if it's changed from the previous node
130130 if fname != current_filename[]
@@ -141,12 +141,13 @@ function _show_syntax_node(io, current_filename, node, indent)
141141 end
142142end
143143
144- function _show_syntax_node_sexpr (io, node)
144+ function _show_syntax_node_sexpr (io, node:: SyntaxNode )
145145 if ! haschildren (node)
146146 if is_error (node)
147147 print (io, " (" , untokenize (head (node)), " )" )
148148 else
149- print (io, node. val isa Symbol ? string (node. val) : repr (node. val))
149+ val = node. val
150+ print (io, val isa Symbol ? string (val) : repr (val))
150151 end
151152 else
152153 print (io, " (" , untokenize (head (node)))
@@ -256,4 +257,3 @@ function highlight(code::String, node, path::Int...; color=(40,40,70))
256257 _printstyled (stdout , code[p: q- 1 ]; bgcolor= color)
257258 print (stdout , code[q: end ])
258259end
259-
0 commit comments