UNPKG

@eagleoutice/flowr

Version:

Static Dataflow Analyzer and Program Slicer for the R Programming Language

28 lines 1.12 kB
"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) * @see {@link popLocalEnvironment} - to remove the local scope again */ function pushLocalEnvironment({ level, current }) { return { current: new environment_1.Environment(current), level: level + 1 }; } /** * Remove the top local environment scope from the stack, returns the modified variant - sharing the original environments in the stack (no deep-clone) * @see {@link pushLocalEnvironment} - to add a local scope */ function popLocalEnvironment({ current, level }) { (0, assert_1.guard)(level > 0, 'cannot remove the global/root environment'); return { current: current.parent, level: level - 1 }; } //# sourceMappingURL=scoping.js.map