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

Names in inner closure are not resolved against the right owner

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-JSR-5
    • 1.0-JSR-6
    • class generator
    • None

    Description

      import groovy.xml.StreamingMarkupBuilder

      def doc = new StreamingMarkupBuilder().bind {
      root {
      1..2.each

      { item() }

      }
      }

      System.out << doc

      fails as item is not resolved.

      This is because the owner of the each closure has been set to the script. The owner should be the colsure passed to the root method.

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            tug John Wilson
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: