Hi, 

It seems that variable substitution does not work inside of closures in
macro block. I.e:

def var = GeneralUtils.varX("foo")
def x = macro {
    $v{var}.takesClosure { $v{var} }
} 

generate AST more or less like that:

methodCall {
    variable("foo") // correct substitution
    constant "takesClosure"
    argumentList {
        closure {
            parameters{}
            block {
                expression {
                    methodCall {
                        variable("this")
                        constant('$v') // no substitution
                        argumentList {
                            closure { // literal handing of {var}
                                parameters {}
                                block {
                                    expression {
                                        variable("var")
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

So if $v is inside another closure it will not be replaced. 

Regards,
Krzysztof



--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html

Reply via email to