groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jamie Echlin <>
Subject replace a property in a static type checking script
Date Wed, 02 Sep 2015 07:24:24 GMT
Struggling a bit here with my STC script.

The binding variables has a Map<String, Object>

But, based on the key, the STC script can provide a more specific type. So
the input script might be something like:


This is failing at the moment because Object has no quack() method.

In the unresolvedProperty closure I am trying to replace map["duck"] with
an expression with a Duck return type:

def bexp = new BinaryExpression(objectExpression.leftExpression,
objectExpression.operation, objectExpression.rightExpression)
def replacementPexp = new PropertyExpression(bexp,
makeDynamic(replacementPexp, ClassHelper.VOID_TYPE)

I don't want to set this as handled, because I want quack() to be checked.

Is there a way to tell the STC script to "reparse" this expression as I am
trying to do, or do I need another AST transform in an earlier compile

Any help appreciated, please LMK if not clear.

cheers, jamie

View raw message