abstract class CmdCode
super DocCommand
- autoinit(model, modelbuilder, filter, format)
+ autoinit(model, filter, node, format)
- # ModelBuilder used to get AST nodes
- var modelbuilder: ModelBuilder
+ # AST node to display code from
+ var node: nullable ANode = null is optional, writable
# Rendering format
#
autoinit(model, modelbuilder, filter, mentity, mentity_name, format)
- # AST node to return
- var node: nullable ANode = null is optional, writable
+ # ModelBuilder used to get AST nodes from entities
+ var modelbuilder: ModelBuilder
# Same as `CmdEntity::init_mentity`
#
else
print title
end
- if no_color == null or not no_color then
+ var node = self.node
+ if (no_color == null or not no_color) and node != null then
var ansi = render_code(node)
- if ansi != null then
- print "~~~"
- print ansi.write_to_string
- print "~~~"
- end
+ print "~~~"
+ print ansi.write_to_string
+ print "~~~"
else
printn mentity.cs_source_code
end