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

variable assignment within nested closures doesn't work

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-beta-6
    • 1.0-JSR-5
    • None
    • None
    • jdk 1.5.0-beta2

    Description

      This code...

      i=100;
      println "first i = ${i}";
      [1].each {
      i=7;
      println "now i = ${i}";
      [4,5,6,7].each

      { println i; i++; }

      println "and now i = ${i}";
      }

      ...produces this:

      first i = 100
      now i = 7
      7
      8
      9
      10
      and now i = 7

      ...however, if first 2 lines are removed, it works ok

      Attachments

        Issue Links

          Activity

            People

              blackdrag Jochen Theodorou
              vonwao@gmai.com Otto von Wachter
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: