groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anto Aravinth <anto.aravinth....@gmail.com>
Subject DSL Type Checker Help
Date Wed, 19 Aug 2015 13:27:53 GMT
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.

Mime
View raw message