Search in sources :

Example 1 with Assumption

use of org.eclipse.n4js.flowgraphs.dataflow.Assumption 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;
}
Also used : ControlFlowElement(org.eclipse.n4js.n4JS.ControlFlowElement) HashSet(java.util.HashSet) Assumption(org.eclipse.n4js.flowgraphs.dataflow.Assumption)

Example 2 with Assumption

use of org.eclipse.n4js.flowgraphs.dataflow.Assumption in project n4js by eclipse.

the class UsedBeforeDeclaredAnalyserOnDataflow method getUsedButNotDeclaredIdentifierRefs.

/**
 * @return all {@link IdentifierRef}s that are used before declared
 */
public List<ControlFlowElement> getUsedButNotDeclaredIdentifierRefs() {
    List<ControlFlowElement> idRefs = new LinkedList<>();
    for (Assumption ass : failedAssumptions.values()) {
        for (PartialResult result : ass.failedBranches) {
            UsedBeforeFailed ubf = (UsedBeforeFailed) result;
            idRefs.add(ubf.useLocation);
        }
    }
    return idRefs;
}
Also used : PartialResult(org.eclipse.n4js.flowgraphs.dataflow.PartialResult) ControlFlowElement(org.eclipse.n4js.n4JS.ControlFlowElement) LinkedList(java.util.LinkedList) Assumption(org.eclipse.n4js.flowgraphs.dataflow.Assumption)

Aggregations

Assumption (org.eclipse.n4js.flowgraphs.dataflow.Assumption)2 ControlFlowElement (org.eclipse.n4js.n4JS.ControlFlowElement)2 HashSet (java.util.HashSet)1 LinkedList (java.util.LinkedList)1 PartialResult (org.eclipse.n4js.flowgraphs.dataflow.PartialResult)1