Skip to content

Commit e8dcfc7

Browse files
committed
Consistency, comments
1 parent e85aae7 commit e8dcfc7

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/compat.jl

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const JS = JuliaSyntax
22

3-
function _insert_tree_node(graph::SyntaxGraph, k::JuliaSyntax.Kind,
3+
function _insert_tree_node(graph::SyntaxGraph, k::JS.Kind,
44
src::SourceAttrType, flags::UInt16=0x0000)
55
id = newnode!(graph)
66
sethead!(graph, id, k)
@@ -29,7 +29,7 @@ function expr_to_syntaxtree(@nospecialize(e), lnn::Union{LineNumberNode, Nothing
2929
# Provenance sinkhole for all nodes until we hit a linenode
3030
dummy_src = SourceRef(
3131
SourceFile("No source for expression $e"),
32-
1, JuliaSyntax.GreenNode(K"None", 0))
32+
1, JS.GreenNode(K"None", 0))
3333
_insert_tree_node(graph, K"None", dummy_src)
3434
else
3535
lnn
@@ -115,8 +115,8 @@ end
115115

116116
# Get kind by string if exists. TODO relies on internals
117117
function find_kind(s::String)
118-
out = get(JuliaSyntax._kind_str_to_int, s, nothing)
119-
return isnothing(out) ? nothing : JuliaSyntax.Kind(out)
118+
out = get(JS._kind_str_to_int, s, nothing)
119+
return isnothing(out) ? nothing : JS.Kind(out)
120120
end
121121

122122
function is_dotted_operator(s::AbstractString)
@@ -167,7 +167,7 @@ function _insert_convert_expr(@nospecialize(e), graph::SyntaxGraph, src::SourceA
167167
return (st_id, src)
168168
elseif !(e isa Expr)
169169
if !(e isa Union{Number, Bool, Char, GlobalRef, Nothing})
170-
@info "what is this" e typeof(e)
170+
@info "unknown leaf type in expr, guessing value:" e typeof(e)
171171
end
172172
# TODO: st_k of Float. others?
173173
st_k = e isa Integer ? K"Integer" : find_kind(string(typeof(e)))
@@ -219,7 +219,7 @@ function _insert_convert_expr(@nospecialize(e), graph::SyntaxGraph, src::SourceA
219219
elseif a1 isa Expr && a1.head === :(.) && a1.args[2] isa QuoteNode
220220
child_exprs[1] = Expr(:(.), a1.args[1], Expr(:MacroName, a1.args[2].value))
221221
elseif a1 isa GlobalRef
222-
# syntax-introduced macrocalls
222+
# TODO syntax-introduced macrocalls
223223
if a1.name === Symbol("@cmd")
224224
# expr_children = []
225225
elseif a1.name === Symbol("@doc")
@@ -313,7 +313,7 @@ function _insert_convert_expr(@nospecialize(e), graph::SyntaxGraph, src::SourceA
313313
elseif e.head === :(=)
314314
if e.args[1] isa Expr && e.args[1].head === :call
315315
st_k = K"function"
316-
st_flags |= JuliaSyntax.SHORT_FORM_FUNCTION_FLAG
316+
st_flags |= JS.SHORT_FORM_FUNCTION_FLAG
317317
child_exprs[2] = maybe_strip_block(child_exprs[2])
318318
end
319319
elseif e.head === :module
@@ -351,7 +351,6 @@ function _insert_convert_expr(@nospecialize(e), graph::SyntaxGraph, src::SourceA
351351
st_id = _insert_tree_node(graph, K"MacroName", src, st_flags)
352352
mac_name = string(e.args[1])
353353
setattr!(graph, st_id, name_val=mac_name == "@__dot__" ? "@." : mac_name)
354-
@info mac_name[2:end] Base.is_valid_identifier(mac_name[2:end])
355354
if !Base.is_valid_identifier(mac_name[2:end])
356355
return _insert_var_str(st_id, graph, src)
357356
end

0 commit comments

Comments
 (0)