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

ClassCodeExpressionTransformer does not visit all expressions

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.2.0-rc-2
    • None
    • ast builder
    • None

    Description

      When testing the ClassCodeExpressionTransformer I found out that not all of my expressions got visited (i.e. DeclarationExpression). I found out that the method visitExpressionStatement() does not call the visit method for the subnodes like the ClassCodeVisitor does.

      When overriding the method visitExpressionStatement() and adding a:

       
        public void visitExpressionStatement(ExpressionStatement es) {
          es.setExpression(transform(es.getExpression()));
        
          es.getExpression().visit(this);
        }  
      

      my transformations worked again. I have not checked if all the other visit...() methods do call the necessary visit() methods for the branches of the AST, but this addition to the ClassCodeExpressionTransformer fixed my problems.

      I added a test case. When you add the part that is commented out, the test runs "good".

      Could you please check the ClassCodeExpressionTransformer?

      Attachments

        Activity

          People

            Unassigned Unassigned
            blorgo71 Andreas Vorgeitz
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: