Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-3840

AST Browser - EmptyStatement nodes do not render in AST Browser, visitEmptyStatement missing from GroovyCodeVisitor

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.7-beta-2
    • 1.7-rc-1
    • Compiler
    • None
    • ubuntu linux, probably all

    Description

      The AST Browser displays ASTs for code in GroovyConsole.

      EmptyStatement nodes do not show up in the tree. There are 2 ways to create an empty statement:

      // the TryCatchStatement will have a finallyBlock field that is of type EmptyStatement
      def x
      try {
      x = 1
      } catch (IOException ei) {
      x = 2
      }

      // the IfStatement will have an elseBlock field that is of type EmptyStatement.
      if (true) 1
      2

      To fix this we can add visitEmptyStatement to GroovyCodeVisitor and its subclasses.
      Or we can handle it as a special case in the AST Browser code.

      Attachments

        1. GROOVY-3840_EmptyStatement.patch
          7 kB
          Hamlet D'Arcy

        Activity

          People

            hamletdrc Hamlet D'Arcy
            hamletdrc Hamlet D'Arcy
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: