|
1 | 1 | const JS = JuliaSyntax |
2 | 2 |
|
3 | | -function _insert_tree_node(graph::SyntaxGraph, k::JuliaSyntax.Kind, |
| 3 | +function _insert_tree_node(graph::SyntaxGraph, k::JS.Kind, |
4 | 4 | src::SourceAttrType, flags::UInt16=0x0000) |
5 | 5 | id = newnode!(graph) |
6 | 6 | sethead!(graph, id, k) |
@@ -29,7 +29,7 @@ function expr_to_syntaxtree(@nospecialize(e), lnn::Union{LineNumberNode, Nothing |
29 | 29 | # Provenance sinkhole for all nodes until we hit a linenode |
30 | 30 | dummy_src = SourceRef( |
31 | 31 | SourceFile("No source for expression $e"), |
32 | | - 1, JuliaSyntax.GreenNode(K"None", 0)) |
| 32 | + 1, JS.GreenNode(K"None", 0)) |
33 | 33 | _insert_tree_node(graph, K"None", dummy_src) |
34 | 34 | else |
35 | 35 | lnn |
|
115 | 115 |
|
116 | 116 | # Get kind by string if exists. TODO relies on internals |
117 | 117 | 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) |
120 | 120 | end |
121 | 121 |
|
122 | 122 | function is_dotted_operator(s::AbstractString) |
@@ -167,7 +167,7 @@ function _insert_convert_expr(@nospecialize(e), graph::SyntaxGraph, src::SourceA |
167 | 167 | return (st_id, src) |
168 | 168 | elseif !(e isa Expr) |
169 | 169 | 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) |
171 | 171 | end |
172 | 172 | # TODO: st_k of Float. others? |
173 | 173 | 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 |
219 | 219 | elseif a1 isa Expr && a1.head === :(.) && a1.args[2] isa QuoteNode |
220 | 220 | child_exprs[1] = Expr(:(.), a1.args[1], Expr(:MacroName, a1.args[2].value)) |
221 | 221 | elseif a1 isa GlobalRef |
222 | | - # syntax-introduced macrocalls |
| 222 | + # TODO syntax-introduced macrocalls |
223 | 223 | if a1.name === Symbol("@cmd") |
224 | 224 | # expr_children = [] |
225 | 225 | elseif a1.name === Symbol("@doc") |
@@ -313,7 +313,7 @@ function _insert_convert_expr(@nospecialize(e), graph::SyntaxGraph, src::SourceA |
313 | 313 | elseif e.head === :(=) |
314 | 314 | if e.args[1] isa Expr && e.args[1].head === :call |
315 | 315 | st_k = K"function" |
316 | | - st_flags |= JuliaSyntax.SHORT_FORM_FUNCTION_FLAG |
| 316 | + st_flags |= JS.SHORT_FORM_FUNCTION_FLAG |
317 | 317 | child_exprs[2] = maybe_strip_block(child_exprs[2]) |
318 | 318 | end |
319 | 319 | elseif e.head === :module |
@@ -351,7 +351,6 @@ function _insert_convert_expr(@nospecialize(e), graph::SyntaxGraph, src::SourceA |
351 | 351 | st_id = _insert_tree_node(graph, K"MacroName", src, st_flags) |
352 | 352 | mac_name = string(e.args[1]) |
353 | 353 | 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]) |
355 | 354 | if !Base.is_valid_identifier(mac_name[2:end]) |
356 | 355 | return _insert_var_str(st_id, graph, src) |
357 | 356 | end |
|
0 commit comments