JDTVisitor Assignment Node [message #1766361] |
Tue, 20 June 2017 14:38 |
Tiago Martins Messages: 23 Registered: May 2017 |
Junior Member |
|
|
I am trying to understand how MoDisco recursively iterate the java ast.
For instance, I searched in the Source Code and an Assignment is composed by a left expression (Maybe VariableDeclarationImpl class) and then a right expression...
However in the following code, first in the visit of the Assignment node is created the assignment in the factory and in the endVisit method is added the left and right expression if already exists, but in which part of the code the left and right expression is added? I don't understand... can someone please explain me?
I need to understand this in order to implement my own technology layer and new discoverer.
public boolean visit(final org.eclipse.jdt.core.dom.Assignment node) {
Assignment element = this.factory.createAssignment();
this.binding.put(node, element);
return true;
}
@Override
public void endVisit(final org.eclipse.jdt.core.dom.Assignment node) {
Assignment element = (Assignment) this.binding.get(node);
initializeNode(element, node);
element.setOperator(AssignmentKind.get(node.getOperator().toString()));
if (this.binding.get(node.getLeftHandSide()) != null) {
element.setLeftHandSide(JDTVisitorUtils.completeExpression(
this.binding.get(node.getLeftHandSide()), this));
}
if (this.binding.get(node.getRightHandSide()) != null) {
element.setRightHandSide(JDTVisitorUtils.completeExpression(
this.binding.get(node.getRightHandSide()), this));
}
}
|
|
|
Powered by
FUDForum. Page generated in 0.02767 seconds