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

Source locations not correct for some return and block statements created in ReturnAdder class

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.7.2
    • 1.7.3, 1.8-beta-1
    • parser-antlr2
    • None

    Description

      ReturnAdder.addReturnsIfNeeded() does not add source locations in the following places (in Groovy 1.7.2):

      line 126:

                  return new BlockStatement(list,block.getVariableScope());
      

      Should be:

                  BlockStatement newBlock = new BlockStatement(list,block.getVariableScope());
                  newBlock.setSourcePosition(block);
                  return newBlock;
      

      line 135:

                  return new BlockStatement(list,new VariableScope(scope));
      

      Should be:

                  BlockStatement newBlock = new BlockStatement(list,new VariableScope(scope));
                  newBlock.setSourcePosition(statement);
                  return newBlock;
      

      Apologies for not sending a proper patch file, but I am working off the source jar, rather than the svn project. If you prefer, I can send a proper patch. Thanks.

      Attachments

        Activity

          People

            guillaume Guillaume Sauthier
            werdna Andrew Eisenberg
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: