Reputation: 871
I am completely new to Rascal and am trying to create ASTs from an eclipse project using the following code
Module FirstTryAST
import lang::java::m3::Core;
import lang::java::jdt::m3::Core;
import Set;
import Relation;
import IO;
import List;
import Map;
import Exception;
import ParseTree;
void test(){
M3 myModel = createM3FromEclipseProject(|project://MyProject/|);
println("Loaded M3 model, looping through methods..");
for(m <- methods(model)) mAST = getMethodASTEclipse(m);
println("Success");
}
When the program (run in eclipse Rascal Console) tries to execute
getMethodASTEclipse(m);
it returns:
|plugin://rascal_eclipse/src/org/rascalmpl/eclipse/library/lang/java/jdt/m3/Core.rsc|(1238,18,<40,12>,<40,30>): Undeclared variable: getModelContaining
How do I get around this / what did I do wrong ?
I am using Eclipse Mars on Ubuntu 15.04 (Cinnamon). If you need more information, please let me know.
Update:
When I use getMethodASTEclipse(m, model = myModel)
it works fine.
Although this workaround works for me, I still would like to know the answer on why I get this undeclared variable message.
Upvotes: 0
Views: 465
Reputation: 15439
This has been translated into an issue on github. This was a bit of an unused function, and I think we will delete it.
To get the AST use either lang::java::jdt::m3::AST::createAstsFromEclipseProject
or lang::java::jdt::m3::AST::createAstsFromEclipseFile
. With rascal pattern matching you can find the methods inside.
Upvotes: 2