module demo::lang::Pico::Uninit
rascal-0.40.17
Usage
import demo::lang::Pico::Uninit;
Dependencies
import demo::lang::Pico::Abstract;
import demo::lang::Pico::Load;
import demo::lang::Pico::UseDef;
import demo::lang::Pico::ControlFlow;
import analysis::graphs::Graph;
function defNodes
set[CFNode] defNodes(PicoId Id, set[Occurrence] Defs) =
{statement(occ.stat.src, occ.stat) | Occurrence occ <- Defs, occ.name == Id};
function uninitProgram
set[Occurrence] uninitProgram(PROGRAM P) {
D = defs(P); ❶
CFG = cflowProgram(P); ❶
return { occ | occ <- uses(P),
any(CFNode N <- reachX(CFG.graph, CFG.entry, defNodes(occ.name, D)),
N has location && occ.src <= N.location)
};
}
set[Occurrence] uninitProgram(str txt) = uninitProgram(load(txt));