Fix error messages or revert changed semantics of ASTNode.toString()

Issue #37 resolved
Görel Hedin created an issue

In commit [39f7c6a], the semantics of ASTNode.toString() was changed. Previously it pretty-printed the subtree rooted at the node, but now it only prints information about the node.

Many error messages in JastAddJ rely on the prettyprinting semantics, so either they have to be updated, or the semantics should be reverted back to the previous one.

For example, there are error messages in typecheck.jrag that call getExpr() and getTypeAccess(), and there are many other cases. Some error messages also call thiswhich has the same effect.

I (Görel) think it might be a good idea to revert the semantics since this change might affect many users of JastAddJ. They might have written their own error messages, and they might have tests that check error message output.

Comments (2)

  1. Jesper Öqvist

    The reason for the change of ASTNode.toString() in JastAddJ was that the pretty printing often leads to problems during debugging - inspecting nodes in a debugger causes toString to be called and that in turn causes many different method calls which often lead to additional breakpoints triggering.

    I also think it is important to have a separate interface for pretty printing other than toString because toString is used in so many different contexts for different reasons.

  2. Log in to comment