@syntest/analysis
Advanced tools
Comparing version 0.1.0-beta.3 to 0.1.0-beta.4
@@ -6,4 +6,5 @@ export * from "./lib/factories/AbstractSyntaxTreeFactory"; | ||
export * from "./lib/factories/TargetFactory"; | ||
export * from "./lib/util/Events"; | ||
export * from "./lib/RootContext"; | ||
export * from "./lib/Target"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -39,4 +39,5 @@ "use strict"; | ||
__exportStar(require("./lib/factories/TargetFactory"), exports); | ||
__exportStar(require("./lib/util/Events"), exports); | ||
__exportStar(require("./lib/RootContext"), exports); | ||
__exportStar(require("./lib/Target"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -23,3 +23,3 @@ "use strict"; | ||
const path = require("node:path"); | ||
const diagnostics_1 = require("../diagnostics"); | ||
const diagnostics_1 = require("../util/diagnostics"); | ||
class SourceFactory { | ||
@@ -26,0 +26,0 @@ produce(filePath) { |
@@ -22,3 +22,3 @@ "use strict"; | ||
const path = require("node:path"); | ||
const diagnostics_1 = require("./diagnostics"); | ||
const diagnostics_1 = require("./util/diagnostics"); | ||
class RootContext { | ||
@@ -53,8 +53,10 @@ constructor(rootPath, sourceFactory, abstractSyntaxTreeFactory, controlFlowGraphFactory, targetFactory, dependencyFactory) { | ||
getSource(filePath) { | ||
const absoluteTargetPath = this.resolvePath(filePath); | ||
const absolutePath = this.resolvePath(filePath); | ||
// this takes up too much memory we should do some kind of garbage collection if we want to save it all | ||
if (!this._sources.has(absoluteTargetPath)) { | ||
this._sources.set(absoluteTargetPath, this.sourceFactory.produce(absoluteTargetPath)); | ||
if (!this._sources.has(absolutePath)) { | ||
process.emit("sourceResolvingStart", this, absolutePath); | ||
this._sources.set(absolutePath, this.sourceFactory.produce(absolutePath)); | ||
process.emit("sourceResolvingComplete", this, absolutePath, this._sources.get(absolutePath)); | ||
} | ||
return this._sources.get(absoluteTargetPath); | ||
return this._sources.get(absolutePath); | ||
} | ||
@@ -66,8 +68,10 @@ /** | ||
getAbstractSyntaxTree(filePath) { | ||
const absoluteTargetPath = this.resolvePath(filePath); | ||
const absolutePath = this.resolvePath(filePath); | ||
// this takes up too much memory we should do some kind of garbage collection if we want to save it all | ||
if (!this._abstractSyntaxTrees.has(absoluteTargetPath)) { | ||
this._abstractSyntaxTrees.set(absoluteTargetPath, this.abstractSyntaxTreeFactory.convert(absoluteTargetPath, this.getSource(absoluteTargetPath))); | ||
if (!this._abstractSyntaxTrees.has(absolutePath)) { | ||
process.emit("abstractSyntaxTreeResolvingStart", this, absolutePath); | ||
this._abstractSyntaxTrees.set(absolutePath, this.abstractSyntaxTreeFactory.convert(absolutePath, this.getSource(absolutePath))); | ||
process.emit("abstractSyntaxTreeResolvingComplete", this, absolutePath, this._abstractSyntaxTrees.get(absolutePath)); | ||
} | ||
return this._abstractSyntaxTrees.get(absoluteTargetPath); | ||
return this._abstractSyntaxTrees.get(absolutePath); | ||
} | ||
@@ -79,7 +83,9 @@ /** | ||
getControlFlowProgram(filePath) { | ||
const absoluteTargetPath = path.resolve(filePath); | ||
if (!this._controlFlowProgramMap.has(absoluteTargetPath)) { | ||
this._controlFlowProgramMap.set(absoluteTargetPath, this.controlFlowGraphFactory.convert(absoluteTargetPath, this.getAbstractSyntaxTree(absoluteTargetPath))); | ||
const absolutePath = path.resolve(filePath); | ||
if (!this._controlFlowProgramMap.has(absolutePath)) { | ||
process.emit("controlFlowGraphResolvingStart", this, absolutePath); | ||
this._controlFlowProgramMap.set(absolutePath, this.controlFlowGraphFactory.convert(absolutePath, this.getAbstractSyntaxTree(absolutePath))); | ||
process.emit("controlFlowGraphResolvingComplete", this, absolutePath, this._controlFlowProgramMap.get(absolutePath)); | ||
} | ||
return this._controlFlowProgramMap.get(absoluteTargetPath); | ||
return this._controlFlowProgramMap.get(absolutePath); | ||
} | ||
@@ -94,3 +100,5 @@ /** | ||
if (!this._targetMap.has(absolutePath)) { | ||
process.emit("targetExtractionStart", this, absolutePath); | ||
this._targetMap.set(absolutePath, this.targetFactory.extract(absolutePath, this.getAbstractSyntaxTree(absolutePath))); | ||
process.emit("targetExtractionComplete", this, absolutePath, this._targetMap.get(absolutePath)); | ||
} | ||
@@ -113,3 +121,5 @@ return this._targetMap.get(absolutePath); | ||
if (!this._dependenciesMap.has(absolutePath)) { | ||
process.emit("dependencyResolvingStart", this, absolutePath); | ||
this._dependenciesMap.set(absolutePath, this.dependencyFactory.extract(absolutePath, this.getAbstractSyntaxTree(absolutePath))); | ||
process.emit("dependencyResolvingComplete", this, absolutePath, this._dependenciesMap.get(absolutePath)); | ||
} | ||
@@ -116,0 +126,0 @@ return this._dependenciesMap.get(absolutePath); |
{ | ||
"name": "@syntest/analysis", | ||
"version": "0.1.0-beta.3", | ||
"version": "0.1.0-beta.4", | ||
"description": "An analysis package", | ||
@@ -49,2 +49,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@syntest/cfg": "^0.3.0-beta.15", | ||
"@syntest/logging": "^0.1.0-beta.6", | ||
@@ -62,3 +63,3 @@ "lodash.clonedeep": "^4.5.0" | ||
}, | ||
"gitHead": "909f98a3d10c385bb833a094c65b3352ba6a7e3c" | ||
"gitHead": "88813984d20845cfac1b1cd3a1fdbaef5f23d8dc" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36084
44
465
3
+ Added@syntest/cfg@^0.3.0-beta.15
+ Added@syntest/cfg@0.3.0-beta.20(transitive)