Search in sources :

Example 1 with PartialResult

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

the class NullDereferenceResult method getFailedSymbol.

private Symbol getFailedSymbol(IsNotNull inn) {
    if (inn.failedBranches.isEmpty()) {
        return null;
    }
    Set<Symbol> failedSymbols = new HashSet<>();
    for (PartialResult result : inn.failedBranches) {
        NullDerefernceFailed ndFailed = (NullDerefernceFailed) result;
        failedSymbols.add(ndFailed.symbol);
    }
    if (failedSymbols.size() == 1) {
        return failedSymbols.iterator().next();
    }
    return null;
}
Also used : Symbol(org.eclipse.n4js.flowgraphs.dataflow.symbols.Symbol) PartialResult(org.eclipse.n4js.flowgraphs.dataflow.PartialResult) HashSet(java.util.HashSet)

Example 2 with PartialResult

use of org.eclipse.n4js.flowgraphs.dataflow.PartialResult 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

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