You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function Base.getproperty(node::Node{T}, name::Symbol) where T
if name ===:element
getfield(node, :t)
elseif name ===:children
NodeChildren(node)
elseif name ===:next
getfield(node, :nxt)
elseif name ===:previous
getfield(node, :prv)
elseif name ===:parent
getfield(node, :parent)
elseif name ===:meta
getfield(node, :meta)
else
#TODO: error("type Node does not have property $(name)")
@debug"Accessing private field $(name) of Node"stacktrace()
getfield(node, name)
end
end
function Base.setproperty!(node::Node, name::Symbol, x)
if name ===:element
setfield!(node, :t, x)
elseif name ===:meta
setfield!(node, :meta, x)
elseif name inpropertynames(node)
#TODO: error("Unable to set property $(name) for Node")
@debug"Setting private field :$(name) of Node"stacktrace()
setfield!(node, name, x)
else
#TODO: error("type Node does not have property $(name)")
@debug"Accessing private field :$(name) of Node"stacktrace()
setfield!(node, name, x)
end
end
We should clean that up and make sure that you can only access documented fields. Internally, we can use getfield and setfield! where necessary. But let's do that in 0.2.0.
We have these internal fields like
.nxt
and.first_child
, and we do some unnecessary get/setproperty stuff:MarkdownAST.jl/src/node.jl
Lines 103 to 137 in 99e0f82
We should clean that up and make sure that you can only access documented fields. Internally, we can use
getfield
andsetfield!
where necessary. But let's do that in 0.2.0.X-ref: #19.
The text was updated successfully, but these errors were encountered: