Skip to content

Commit 31de060

Browse files
committed
AEDebugging_ Reuse Dependencies in Graph
SQUASHED: AUTO-COMMIT-src-client-reactive-active-expression-rewriting-active-expression-rewriting.js,AUTO-COMMIT-src-client-reactive-components-basic-aexpr-graph.js,
1 parent c5fa19c commit 31de060

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

src/client/reactive/active-expression-rewriting/active-expression-rewriting.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ class Dependency {
205205
if (this.isGlobalDependency()) {
206206
return identifier.toString()
207207
}
208-
return context.constructor.name + "." + identifier;
208+
return (context?context.constructor.name:"") + "." + identifier;
209209
}
210210

211211
getAsDependencyDescription() {

src/client/reactive/components/basic/aexpr-graph.js

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,21 @@ import { DebuggingCache } from 'src/client/reactive/active-expression-rewriting/
88
export default class AexprGraph extends Morph {
99
async initialize() {
1010
this.windowTitle = "Active Expression Graph";
11+
this.setWindowSize(1200, 800);
1112
let width = window.innerWidth;
1213
let height = window.innerHeight;
13-
this.graphViz = await (<d3-graphviz style="background:gray; width:100%; height: 100%"></d3-graphviz>)
14+
this.graphViz = await (<d3-graphviz style="background:gray"></d3-graphviz>)
1415
this.graph.append(this.graphViz);
1516
await this.graphViz.setDotData(this.graphData());
1617
const containerElement = this.graphViz.shadowRoot.querySelector("#container");
17-
containerElement.setAttribute("display", "flex");
18+
/*containerElement.setAttribute("display", "flex");
19+
containerElement.children[0].setAttribute("display", "flex");
1820
setTimeout(() => {
1921
debugger;
2022
const svgElement = this.graphViz.shadowRoot.querySelector("svg");
2123
svgElement.setAttribute("height", "100%");
2224
svgElement.setAttribute("width", "100%");
23-
}, 100);
25+
}, 10000);*/
2426
}
2527

2628
graphData() {
@@ -30,25 +32,32 @@ export default class AexprGraph extends Morph {
3032

3133
const aes = AExprRegistry.allAsArray();
3234

35+
const allDeps = new Map();
36+
3337
let aeCount = 0;
3438
let depCount = 0;
3539
let hookCount = 0;
3640
for (const ae of aes) {
37-
debugger;
3841
const aeData = this.extractData(ae);
3942
nodes.push(`AE${aeCount} [shape="record" label="{${aeData.join("|")}}"]`);
4043
for(const dep of ae.dependencies().all()) {
41-
nodes.push(`DEP${depCount} [shape="record" label="{${this.escapeTextForDOTRecordLabel(dep.getName())}|${dep.type()}}"]`);
42-
edges.push(`AE${aeCount} -> DEP${depCount}`);
43-
for(const hook of dep.getHooks()) {
44-
nodes.push(`HOOK${hookCount} [shape="record" label="{${this.escapeTextForDOTRecordLabel(hook.informationString())}}"]`);
45-
edges.push(`DEP${depCount} -> HOOK${hookCount}`);
46-
hookCount++;
44+
if(!allDeps.has(dep)) {
45+
allDeps.set(dep, depCount);
46+
nodes.push(`DEP${depCount} [shape="record" label="{${this.escapeTextForDOTRecordLabel(dep.getName())}|${dep.type()}}"]`);
47+
depCount++;
4748
}
48-
depCount++;
49+
50+
edges.push(`AE${aeCount} -> DEP${allDeps.get(dep)}`);
4951
}
5052
aeCount++;
5153
}
54+
for(const dep of allDeps.keys()) {
55+
for(const hook of dep.getHooks()) {
56+
nodes.push(`HOOK${hookCount} [shape="record" label="{${this.escapeTextForDOTRecordLabel(hook.informationString())}}"]`);
57+
edges.push(`DEP${allDeps.get(dep)} -> HOOK${hookCount}`);
58+
hookCount++;
59+
}
60+
}
5261

5362
return `digraph {
5463
graph [ splines="true" overlap="false" ];

0 commit comments

Comments
 (0)