use of org.eclipse.n4js.n4JS.ControlFlowElement in project n4js by eclipse.
the class NullDereferenceAnalyser method getNullDereferences.
/**
* @return a list of all AST locations where a null pointer dereference can happen
*/
public Iterable<NullDereferenceResult> getNullDereferences() {
Set<NullDereferenceResult> nullDerefs = new HashSet<>();
for (Assumption ass : failedAssumptions.values()) {
IsNotNull inn = (IsNotNull) ass;
ControlFlowElement astLocation = inn.creationSite;
NullDereferenceResult ndr = new NullDereferenceResult(astLocation, inn);
nullDerefs.add(ndr);
}
return nullDerefs;
}
use of org.eclipse.n4js.n4JS.ControlFlowElement in project n4js by eclipse.
the class BranchWalker method visit.
@Override
protected final void visit(Node node) {
if (node instanceof RepresentingNode) {
lastRN = node;
ControlFlowElement cfe = node.getRepresentedControlFlowElement();
visit(cfe);
return;
}
if (this.getContainer() == node.getControlFlowElement()) {
ControlFlowElement cfe = node.getControlFlowElement();
if (lastRN == null) {
enterContainer(cfe);
} else {
exitContainer(cfe);
}
lastRN = node;
}
}
use of org.eclipse.n4js.n4JS.ControlFlowElement in project n4js by eclipse.
the class CFGraphProvider method getConnectedEdges.
@Override
public List<Edge> getConnectedEdges(Node node, List<Node> allNodes) {
ControlFlowElement cfe = (ControlFlowElement) node.getElement();
List<Edge> succs = edgesMap.get(cfe);
if (succs == null) {
return Collections.emptyList();
}
return succs;
}
use of org.eclipse.n4js.n4JS.ControlFlowElement in project n4js by eclipse.
the class CatchNodeFinder method getContainer.
/**
* To find the correct catch node, all containers are searched, starting from the innermost.
*/
private static ControlFlowElement getContainer(ControlFlowElement cfe) {
EObject container = cfe.eContainer();
if (container instanceof ControlFlowElement) {
return (ControlFlowElement) container;
}
boolean getNextContainer = false;
getNextContainer |= container instanceof CatchBlock;
getNextContainer |= container instanceof FinallyBlock;
if (getNextContainer) {
return (ControlFlowElement) container.eContainer();
}
return null;
}
use of org.eclipse.n4js.n4JS.ControlFlowElement in project n4js by eclipse.
the class ControlFlowGraphFactory method isExitingFinallyBlock.
private static boolean isExitingFinallyBlock(ComplexNodeMapper cnMapper, Node node) {
ControlFlowElement cfe = node.getControlFlowElement();
ComplexNode cn = cnMapper.get(cfe);
boolean isExitingFinallyBlock = true;
isExitingFinallyBlock &= cfe instanceof Block;
isExitingFinallyBlock &= cfe.eContainer() instanceof FinallyBlock;
isExitingFinallyBlock &= cn.getExit() == node;
return isExitingFinallyBlock;
}
Aggregations