stg-tud/tigerseyeplugin — Issue #35: InvokationDispatcherGroovyTransformation can create ambiguous statement
Author: leoroos
Created: 2011-12-19 21:05:20+00:00
State: open
Labels: Core

The Groovy `InvokationDispatcherGroovyTransformation` passes a closure to the `eval` function.
If the argument itself is a closure this will produce a directly nested closure which can not be compiled by the Groovy compiler.

## Example

we have the function declaration

repeat__p0__p1(int i, Closure c) { ... }

and the dsl function call

repeat 5 { ...closurecode... }

The result tranformation will look like that:

DSLInvoker.eval(DSLLang.class,
repeat__p0__p1(5,
DSLInvoker.eval(DSLLang.class,
{ {...closurecode...} } ))

Which causes the compile error

Groovy:Ambiguous expression could be either a parameterless closure expression or an isolated open code block;

## Solution

Could use the `de.tud.stg.tigerseye.eclipse.core.builder.transformers.ast.InvokationDispatcherJavaTransformation` for Groovy and Java.