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

The delegate of an eclosing closure is not being used to resolve references

    XMLWordPrintableJSON

Details

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

    Description

      class Test {
      static main(args) {
      c = {
      println a // a is resolved on the delegate OK here

      [1, 2, 3].each

      { println a // a is not resolved on tghe delegate of the enclosing closure here }

      }

      c.delegate = ['a':10]

      c()
      }
      }

      prints 10 and then throws an exception.

      within the each closure 'a' is not resolved. This means that the enclosing closure's delegate is not being examined to see if it has the property 'a'.

      Attachments

        Issue Links

          Activity

            People

              tug John Wilson
              tug John Wilson
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: