UNPKG

@eagleoutice/flowr

Version:

Static Dataflow Analyzer and Program Slicer for the R Programming Language

23 lines 992 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.pushLocalEnvironment = pushLocalEnvironment; exports.popLocalEnvironment = popLocalEnvironment; const environment_1 = require("./environment"); const assert_1 = require("../../util/assert"); /** Add a new local environment scope to the stack, returns the modified variant - sharing the original environments in the stack (no deep-clone) */ function pushLocalEnvironment(base) { return { current: new environment_1.Environment(base.current), level: base.level + 1 }; } function popLocalEnvironment(base) { (0, assert_1.guard)(base.level > 0, 'cannot remove the global/root environment'); const parent = base.current.parent; (0, assert_1.guard)(parent !== undefined, 'level is wrong, parent is undefined even though level suggested depth > 0 (starts with 0)'); return { current: parent, level: base.level - 1 }; } //# sourceMappingURL=scoping.js.map