groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wolfgang Pedot <>
Subject AST transformation to modify variable names
Date Wed, 29 Jul 2015 08:40:11 GMT

I have the following Scenario:

OSGI-based application with embedded GroovyScriptEngines, lots of 
small(ish) scripts which use variables from the Binding.
All those Binding-Variables are written in uppercase (like constants) to 
distinguish them from locally used variables in the script.
While looking into recent increases in compile-time for the scripts I 
learned that those uppercase variable names are part of the problem 
because they cause a lot of undesired class-lookups.
Modifying all the existing scripts would be a giant pain so I thought 
there might be a way to do this using an AST transformation, what I 
would like to do is something like adding a lower-case prefix to all 
uppercase-variables but I cant seem to find the right angle.
Any hints/ideas? Most of the variable-names are known, but some are not.

Wolfgang Pedot

View raw message