Skip to content

Commit 3184e4c

Browse files
committed
AEDebugging_ Group graph by scopes
SQUASHED: AUTO-COMMIT-src-client-reactive-components-basic-aexpr-graph.js,
1 parent df005e9 commit 3184e4c

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

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

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export default class AexprGraph extends Morph {
4646

4747
const aes = AExprRegistry.allAsArray();
4848

49+
const allScopes = new Map();
4950
const allDeps = new Map();
5051
const allAEs = new Map();
5152

@@ -57,6 +58,11 @@ export default class AexprGraph extends Morph {
5758
const aeData = this.extractData(ae);
5859
nodes.push(`AE${aeCount} [shape="record" label="{${aeData.join("|")}}"]`);
5960
for(const dep of ae.dependencies().all()) {
61+
const [context, identifier, value] = dep.contextIdentifierValue();
62+
if(!allScopes.has(context)) {
63+
allScopes.set(context, []);
64+
}
65+
allScopes.get(context).push(dep);
6066
if(!allDeps.has(dep)) {
6167
allDeps.set(dep, depCount);
6268
depCount++;
@@ -76,22 +82,28 @@ export default class AexprGraph extends Morph {
7682
}
7783
}
7884
}
79-
for(const dep of allDeps.keys()) {
85+
let i = 0;
86+
for(const [context, deps] of allScopes) {
8087
const subgraphNodes = [];
8188
const subgraphEdges = [];
82-
subgraphNodes.push(`DEP${allDeps.get(dep)} [shape="record" label="{${this.escapeTextForDOTRecordLabel(dep.getName())}|${dep.type()}}"]`);
83-
for(const hook of dep.getHooks()) {
84-
subgraphNodes.push(`HOOK${hookCount} [shape="record" label="{${this.escapeTextForDOTRecordLabel(hook.informationString())}}"]`);
85-
subgraphEdges.push(`DEP${allDeps.get(dep)} -> HOOK${hookCount}`);
86-
hookCount++;
89+
for(const dep of deps) {
90+
subgraphNodes.push(`DEP${allDeps.get(dep)} [shape="record" label="{${this.escapeTextForDOTRecordLabel(dep.getName())}|${dep.type()}}"]`);
91+
for(const hook of dep.getHooks()) {
92+
subgraphNodes.push(`HOOK${hookCount} [shape="record" label="{${this.escapeTextForDOTRecordLabel(hook.informationString())}}"]`);
93+
subgraphEdges.push(`DEP${allDeps.get(dep)} -> HOOK${hookCount}`);
94+
hookCount++;
95+
}
8796
}
88-
nodes.push(`subgraph cluster${allDeps.get(dep)} {
97+
98+
nodes.push(`subgraph cluster${i} {
8999
graph[color="#00ffff"];
90100
${subgraphNodes.join(";\n")}
91101
${subgraphEdges.join(";\n")}
92-
label = "${this.escapeTextForDOTRecordLabel(dep.getName())}";
102+
label = "${this.escapeTextForDOTRecordLabel(context.toString())}";
93103
}`);
104+
i++;
94105
}
106+
95107
//edges.push(`lol1 -> lol2 [color="#00ff00"]`);
96108

97109
return `digraph {

0 commit comments

Comments
 (0)