Skip to content

Commit

Permalink
Fix oversights introduced in #386
Browse files Browse the repository at this point in the history
  • Loading branch information
Gnimuc committed Nov 16, 2022
1 parent f197005 commit b80200e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/generator/print.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function pretty_print(io, node::ExprNode{TypedefFunction}, options::Dict)
toks = tokenize(node.cursor)
c_str = reduce((lhs, rhs) -> lhs * " " * rhs, [tok.text for tok in toks])
println(io, "# " * replace(c_str, "\n" => "\n#"))

# print documentation
print_documentation(io, node, "", options)

Expand Down Expand Up @@ -111,7 +111,7 @@ function pretty_print(io, node::ExprNode{<:AbstractStructNodeType}, options::Dic
struct_def = node.exprs[1]
mutable, name, members = struct_def.args
name = Base.sym_to_string(name)

# `chldren(node.cursor)` may also return forward declaration of struct type for example, so we filter these out.
child_nodes = filter(x->x isa CLFieldDecl, children(node.cursor))
fields = filter(x->Meta.isexpr(x, :(::)), members.args)
Expand All @@ -121,7 +121,7 @@ function pretty_print(io, node::ExprNode{<:AbstractStructNodeType}, options::Dic
mutable && print(io, "mutable ")
println(io, "struct ", name)
for (expr, child) in zip(members.args, child_nodes)
inline && print_documentation(io, child, " ", options)
inline && print_documentation(io, ExprNode(:dummy, Skip(), child, Expr[], Int[]), " ", options)
println(io, " ", string(expr))
end
for expr in others
Expand Down Expand Up @@ -158,7 +158,7 @@ function pretty_print(io, node::ExprNode{StructMutualRef}, options::Dict)

# A StructDecl is inserted before the FieldDecl with forward decl
for (ex, child) in zip(block.args, child_nodes)
inline && print_documentation(io, child, " ", options)
inline && print_documentation(io, ExprNode(:dummy, Skip(), child, Expr[], Int[]), " ", options)
if Meta.isexpr(ex, :block)
println(io, " ", string(ex.args[2]), " # ", string(ex.args[1]))
else
Expand Down Expand Up @@ -243,7 +243,7 @@ function pretty_print(io, node::ExprNode{<:OpaqueTags}, options::Dict)
@assert length(node.exprs) == 1
print_documentation(io, node, "", options)
expr = node.exprs[1]

codegen_ops = get(options, "codegen", Dict())
opaque_as_mutable = get(codegen_ops, "opaque_as_mutable_struct", true)

Expand Down

0 comments on commit b80200e

Please sign in to comment.