@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
24 lines • 815 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.remove = remove;
const environment_1 = require("./environment");
const info_1 = require("../info");
/**
* Removes all definitions of a given name from the environment.
*/
function remove(name, environment) {
let current = environment.current;
do {
const definition = current.memory.get(name);
if (definition !== undefined) {
current.memory.delete(name);
if (definition.every(d => (0, info_1.happensInEveryBranch)(d.controlDependencies))) {
break;
}
}
current = current.parent;
} while (current.id !== environment_1.BuiltInEnvironment.id);
// we never remove built ins
return environment;
}
//# sourceMappingURL=remove.js.map