* @param level value that is used to identify the precedence or indentation
* level for placing parentheses and formatting */
void basic::print(const print_context & c, unsigned level) const
+{
+ print_dispatch(get_class_info(), c, level);
+}
+
+/** Like print(), but dispatch to the specified class. Can be used by
+ * implementations of print methods to dispatch to the method of the
+ * superclass.
+ *
+ * @see basic::print */
+void basic::print_dispatch(const registered_class_info & ri, const print_context & c, unsigned level) const
{
// Double dispatch on object type and print_context type
- const registered_class_info * reg_info = &get_class_info();
+ const registered_class_info * reg_info = &ri;
const print_context_class_info * pc_info = &c.get_class_info();
next_class:
void basic::do_print_tree(const print_tree & c, unsigned level) const
{
c.s << std::string(level, ' ') << class_name()
- << std::hex << ", hash=0x" << hashvalue << ", flags=0x" << flags << std::dec
- << ", nops=" << nops()
- << std::endl;
+ << std::hex << ", hash=0x" << hashvalue << ", flags=0x" << flags << std::dec;
+ if (nops())
+ c.s << ", nops=" << nops();
+ c.s << std::endl;
for (size_t i=0; i<nops(); ++i)
op(i).print(c, level + c.delta_indent);
}