Hey Cedric , Thanks for the reply. Given the fact that I'm using methodNotFound extension, it forces me to return a method node.
However the base script class of my dsl has the logic of handling methodMissing. So in the type check, I feel I'm missing something by returning a dummy method node. Looks I'm wrong some where on my design. Any ideas would help me. Thanks again. On 19 Aug 2015 19:01, "Cédric Champeau" <cedric.champ...@gmail.com> wrote: > The type checking DSL provides several helper methods to get access to the > arguments. See for example: > http://docs.groovy-lang.org/2.4.4/html/gapi/index.html?org/codehaus/groovy/transform/stc/GroovyTypeCheckingExtensionSupport.html > > In your case you're probably looking for something like : > https://github.com/apache/incubator-groovy/blob/master/src/main/org/codehaus/groovy/transform/stc/AbstractTypeCheckingExtension.java#L217-217 > > Where you want a Map, but in any case, since you need to check the keys, > it has to be *more* than a Map, it has to be a Map literal (hence why you > see MapEntryExpression). So you should check the structure of the > ArgumentListExpression explicitly. If we can get the macro stuff merged > into 2.5, there will be experimental support for matches, that would make > it even easier, but we're not there yet. > > > > 2015-08-19 15:27 GMT+02:00 Anto Aravinth <anto.aravinth....@gmail.com>: > >> I'm writing an type checker for an DSL. So the type checker looks like >> this: >> >> >> >> class MyAppDSLTypeChecker extends >> GroovyTypeCheckingExtensionSupport.TypeCheckingDSL { >> >> >> >> @Override >> >> Object run() { >> >> methodNotFound { receiver, name, argList, argTypes, call -> >> >> println argList >> >> handled = true >> >> } >> >> } >> >> } >> >> >> >> When my DSL runs, for now it just prints argList, which is something like >> this: >> >> >> >> org.codehaus.groovy.ast.expr.ArgumentListExpression@1fc8bb61 >> [org.codehaus.groovy.ast.expr.NamedArgumentListExpression@3385ed94 >> [org.codehaus.groovy.ast.expr.MapEntryExpression@1db0a9f9(key: >> ConstantExpression[asdasdasddsasd], value: ConstantExpression[someId])]] >> >> >> >> Is there any Visitor support does Groovy gives out of the box, so that I >> can traverse the above ArgumentListExpression AST node? So this is my idea, >> if method name matches my DSL rule, and I need to check its param, which >> should be only map. And that map also should be of some keys. So need to >> check them. >> >> >> >> Thanks for your input. >> > >