title: Passing delegate through nested closures in Groovy
body: <p>I am creating a builder which accepts Groovy closures as markup. However I am having trouble catching method calls with nested closures. </p>
  
  <pre><code>Closure nested = {
     foo ()       //will throw missingMethod exception
  }
  Closure root = {
     foo ()       //prints 'missing foo []'
     inline_nested {
       foo ()     //prints 'missing foo []'
     }
     nested ()    
  }
  builder.execute (root)
  
  // ...
  class MyBuilder {
    void execute (Closure closure) {
      def clone = closure.clone()
      clone.delegate = this
      clone()
    }
    def missingMethod (String name, args) {
       println "missing ${name} ${args}"
    }
  }
  </code></pre>
  
  <p>Is there any way I can set the delegate property for nested closures?</p>