@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
51 lines • 2.06 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.FlowrAnalyzerDependenciesContext = void 0;
const abstract_flowr_analyzer_context_1 = require("./abstract-flowr-analyzer-context");
const flowr_analyzer_package_versions_plugin_1 = require("../plugins/package-version-plugins/flowr-analyzer-package-versions-plugin");
/**
* This context is responsible for managing the dependencies of the project, including their versions and interplays with {@link FlowrAnalyzerPackageVersionsPlugin}s.
*
* If you are interested in inspecting these dependencies, refer to {@link ReadOnlyFlowrAnalyzerDependenciesContext}.
*/
class FlowrAnalyzerDependenciesContext extends abstract_flowr_analyzer_context_1.AbstractFlowrAnalyzerContext {
name = 'flowr-analyzer-dependencies-context';
functionsContext;
dependencies = new Map();
staticsLoaded = false;
reset() {
this.dependencies = new Map();
this.staticsLoaded = false;
}
constructor(functionsContext, plugins) {
super(functionsContext.getAttachedContext(), flowr_analyzer_package_versions_plugin_1.FlowrAnalyzerPackageVersionsPlugin.defaultPlugin(), plugins);
this.functionsContext = functionsContext;
}
resolveStaticDependencies() {
this.applyPlugins(undefined);
this.staticsLoaded = true;
}
addDependency(pkg) {
const p = this.dependencies.get(pkg.name);
if (p) {
p.mergeInPlace(pkg);
}
else {
this.dependencies.set(pkg.name, pkg);
}
}
getDependency(name) {
if (!this.staticsLoaded) {
this.resolveStaticDependencies();
}
return this.dependencies.get(name);
}
getDependencies() {
if (!this.staticsLoaded) {
this.resolveStaticDependencies();
}
return Array.from(this.dependencies.values());
}
}
exports.FlowrAnalyzerDependenciesContext = FlowrAnalyzerDependenciesContext;
//# sourceMappingURL=flowr-analyzer-dependencies-context.js.map