Rascal: what does collectBindings bool do in AST creation?

I have a question about the creation of AST from the villains. I usually do the following:

model = createM3FromEclipseProject(|project://testproject|);
decls = createAstsFromEclipseProject(model.id, false);

      

First I would set collectBindings to true. But for some projects I am getting an error. It might be due to the fact that I am using Luna eclipse, but it got me thinking about what the collector does?

I tried looking for it but I couldn't find any documentation (maybe my google skills are bad). I also tried to run it in the same project with different settings for binding and comparing the collection, but I couldn't see anything.

Can someone explain to me what the collector does and why you didn't use it?

Thank!!!

+3


source to share


1 answer


CollectBindings goes one step further after parsing Java code, which should resolve all names and types where possible in the code. This information is then collected from the Java compiler and stored directly in the Rascal AST.

So, if you want the exact qualified names or types of expressions and variables, then you collectBindings

should set to true

. For example, in this code:

int a = 0;
int b = a + a;

      



Without resolveBindings, the two uses a

in the AST would not point to a declaration with an annotation @decl

speaking |java+variable:///something/a|

, and they would not know they are int()

via an annotation @typ

. Even an ad int a

by itself will not know its qualified name or its type.

StackOverFlowError

which you see is reported by josvr on github: https://github.com/cwi-swat/rascal/issues/735 . This is caused by a semantics change in the Java JDT compiler (might be a bug, might be something else).

If you're stuck now, I would suggest going back to Keppler.

+1


source







All Articles