@syntest/cfg
Advanced tools
Comparing version 0.3.0-beta.17 to 0.3.0-beta.18
@@ -10,4 +10,5 @@ export * from "./lib/algorithms/edgeContraction"; | ||
export * from "./lib/util/parse"; | ||
export * from "./lib/util/SerializableControlFlowProgram"; | ||
export * from "./lib/ControlFlowFunction"; | ||
export * from "./lib/ControlFlowProgram"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -43,4 +43,5 @@ "use strict"; | ||
__exportStar(require("./lib/util/parse"), exports); | ||
__exportStar(require("./lib/util/SerializableControlFlowProgram"), exports); | ||
__exportStar(require("./lib/ControlFlowFunction"), exports); | ||
__exportStar(require("./lib/ControlFlowProgram"), exports); | ||
//# sourceMappingURL=index.js.map |
import { ControlFlowProgram } from "../ControlFlowProgram"; | ||
export declare function format(cfp: ControlFlowProgram): string; | ||
import { SerializableControlFlowProgram } from "./SerializableControlFlowProgram"; | ||
export declare function makeSerializeable(cfp: ControlFlowProgram): SerializableControlFlowProgram; | ||
//# sourceMappingURL=format.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.format = void 0; | ||
function format(cfp) { | ||
exports.makeSerializeable = void 0; | ||
function makeFunctionSerializeable(cff) { | ||
return { | ||
id: cff.id, | ||
name: cff.name, | ||
entry: cff.graph.entry.id, | ||
successExit: cff.graph.successExit.id, | ||
errorExit: cff.graph.errorExit.id, | ||
nodes: [...cff.graph.nodes.values()], | ||
edges: [...cff.graph.edges], | ||
}; | ||
} | ||
function makeSerializeable(cfp) { | ||
const data = { | ||
@@ -11,18 +22,7 @@ entry: cfp.graph.entry.id, | ||
edges: [...cfp.graph.edges], | ||
functions: cfp.functions.map((function_) => { | ||
return { | ||
id: function_.id, | ||
name: function_.name, | ||
entry: function_.graph.entry.id, | ||
successExit: function_.graph.successExit.id, | ||
errorExit: function_.graph.errorExit.id, | ||
nodes: [...function_.graph.nodes.entries()], | ||
edges: [...function_.graph.edges], | ||
}; | ||
}), | ||
functions: cfp.functions.map((function_) => makeFunctionSerializeable(function_)), | ||
}; | ||
// sadly all contraction data is lost | ||
return JSON.stringify(data, undefined, 2); | ||
return data; | ||
} | ||
exports.format = format; | ||
exports.makeSerializeable = makeSerializeable; | ||
//# sourceMappingURL=format.js.map |
import { ControlFlowProgram } from "../ControlFlowProgram"; | ||
import { EdgeType } from "../graph/EdgeType"; | ||
import { MetaData, Statement } from "../graph/Node"; | ||
import { NodeType } from "../graph/NodeType"; | ||
type Node = { | ||
id: string; | ||
type: NodeType; | ||
label: string; | ||
statements: Statement[]; | ||
metadata: MetaData; | ||
description?: string; | ||
}; | ||
type Edge = { | ||
id: string; | ||
type: EdgeType; | ||
label: string; | ||
source: string; | ||
target: string; | ||
description?: string; | ||
}; | ||
export type ExpectedData = { | ||
entry: string; | ||
successExit: string; | ||
errorExit: string; | ||
nodes: Node[]; | ||
edges: Edge[]; | ||
functions: { | ||
id: string; | ||
name: string; | ||
entry: string; | ||
successExit: string; | ||
errorExit: string; | ||
nodes: Node[]; | ||
edges: Edge[]; | ||
}[]; | ||
}; | ||
export declare function parse(data: string): ControlFlowProgram; | ||
export {}; | ||
import { SerializableControlFlowProgram } from "./SerializableControlFlowProgram"; | ||
export declare function makeNonSerializable(serializableCfp: SerializableControlFlowProgram): ControlFlowProgram; | ||
//# sourceMappingURL=parse.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.parse = void 0; | ||
exports.makeNonSerializable = void 0; | ||
const ControlFlowGraph_1 = require("../graph/ControlFlowGraph"); | ||
function parse(data) { | ||
const dataObject = JSON.parse(data); | ||
// sadly all contraction data is lost | ||
function makeNonSerializable(serializableCfp) { | ||
return { | ||
graph: new ControlFlowGraph_1.ControlFlowGraph(dataObject.nodes.find((value) => value.id === dataObject.entry), dataObject.nodes.find((value) => value.id === dataObject.successExit), dataObject.nodes.find((value) => value.id === dataObject.errorExit), new Map(dataObject.nodes.map((node) => [node.id, node])), dataObject.edges), | ||
functions: dataObject.functions.map((function_) => { | ||
graph: new ControlFlowGraph_1.ControlFlowGraph(serializableCfp.nodes.find((value) => value.id === serializableCfp.entry), serializableCfp.nodes.find((value) => value.id === serializableCfp.successExit), serializableCfp.nodes.find((value) => value.id === serializableCfp.errorExit), new Map(serializableCfp.nodes.map((node) => [node.id, node])), serializableCfp.edges), | ||
functions: serializableCfp.functions.map((function_) => { | ||
return { | ||
id: function_.id, | ||
name: function_.name, | ||
graph: new ControlFlowGraph_1.ControlFlowGraph(dataObject.nodes.find((value) => value.id === function_.entry), dataObject.nodes.find((value) => value.id === function_.successExit), dataObject.nodes.find((value) => value.id === function_.errorExit), new Map(function_.nodes.map((node) => [node.id, node])), function_.edges), | ||
graph: new ControlFlowGraph_1.ControlFlowGraph(function_.nodes.find((value) => value.id === function_.entry), function_.nodes.find((value) => value.id === function_.successExit), function_.nodes.find((value) => value.id === function_.errorExit), new Map(function_.nodes.map((node) => [node.id, node])), function_.edges), | ||
}; | ||
@@ -19,3 +17,3 @@ }), | ||
} | ||
exports.parse = parse; | ||
exports.makeNonSerializable = makeNonSerializable; | ||
//# sourceMappingURL=parse.js.map |
{ | ||
"name": "@syntest/cfg", | ||
"version": "0.3.0-beta.17", | ||
"version": "0.3.0-beta.18", | ||
"description": "A Control Flow Graph package", | ||
@@ -61,3 +61,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "c311c436e3d853ced92541ed57f80db8455db4c6" | ||
"gitHead": "45270a3a68b05e2ac9b01aa6c0de71c229116964" | ||
} |
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
Sorry, the diff of this file is not supported yet
66861
60
861