Commit 1384c957 authored by Clemens Pflaum's avatar Clemens Pflaum

renamed BindingCollector

parent 6bee99ef
......@@ -39,7 +39,7 @@ public class ActionCodeBlock extends CodeBlock implements IProductionRightPart {
this.getParent().accept(visitor, null);
CompilationUnit cu = (CompilationUnit) JavaCompiler.parseJava(getBlob(), this, classpathEntries);
LocalVariableDetector variableCollector = new LocalVariableDetector();
BindingCollector variableCollector = new BindingCollector();
cu.accept(variableCollector);
this.problems = cu.getProblems();
this.variableMap = variableCollector.getVariableMap();
......
......@@ -15,7 +15,7 @@ import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
import org.eclipse.jdt.core.dom.VariableDeclarationStatement;
public class LocalVariableDetector extends ASTVisitor {
public class BindingCollector extends ASTVisitor {
private HashMap<IVariableBinding, LinkedList<SimpleName>> variableMap = new HashMap<IVariableBinding, LinkedList<SimpleName>>();
private LinkedList<SimpleName> methodList = new LinkedList<SimpleName>();
......@@ -55,9 +55,12 @@ public class LocalVariableDetector extends ASTVisitor {
@Override
public boolean visit(SingleVariableDeclaration node) {
IVariableBinding binding = (IVariableBinding) node.resolveBinding();
variableMap.put( binding, new LinkedList<SimpleName>());
System.out.println("found SingleVariableDeclaration " + binding.getName());
if(binding != null){
variableMap.put( binding, new LinkedList<SimpleName>());
System.out.println("found SingleVariableDeclaration " + binding.getName());
}
return false;
}
......@@ -75,6 +78,8 @@ public class LocalVariableDetector extends ASTVisitor {
System.out.println("found variableBinding " + nodeBinding.getName());
}else if(nodeBinding instanceof IMethodBinding) {
methodList.add(node);
System.out.println("found methodBinding " + nodeBinding.getName());
}else{
System.out.println("found SimpleName " + node.getIdentifier());
}
......
......@@ -35,7 +35,7 @@ public class SpecialCodeBlock extends CodeBlock implements IProductionRightPart
public void parseJavaCode(String[] classpathEntries) {
CompilationUnit cu = (CompilationUnit) JavaCompiler.parseJava(getBlob(), this, classpathEntries);
LocalVariableDetector variableCollector = new LocalVariableDetector();
BindingCollector variableCollector = new BindingCollector();
cu.accept(variableCollector);
this.problems = cu.getProblems();
this.variableMap = variableCollector.getVariableMap();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment