tweak reg resolution repr

This commit is contained in:
Jean-Marie 'Histausse' Mineau 2025-02-21 20:00:27 +01:00
parent 03be7a6350
commit c05e8ba34f
Signed by: histausse
GPG key ID: B66AEEDA9B645AD2
2 changed files with 17 additions and 4 deletions

View file

@ -232,13 +232,26 @@ impl<'a> MethodCFG<'a> {
dot_string dot_string
} }
/// Compute a sanitized version of the method name
pub(crate) fn dot_sanitized_method_dscr(&self) -> String {
self.method
.descriptor
.__str__()
.replace("/", "_")
.replace(";", "")
.replace(">", "")
.replace("-", "_")
.replace("(", "_")
.replace(")", "_")
}
// method call: cluster_{mth}:node_{i}:i{j}:e -> cluster_{mth2}:n ? // method call: cluster_{mth}:node_{i}:i{j}:e -> cluster_{mth2}:n ?
/// Serialize the graph to dot format. /// Serialize the graph to dot format.
pub fn to_dot_subgraph(&self) -> String { pub fn to_dot_subgraph(&self) -> String {
let mut dot_string = format!( let mut dot_string = format!(
"subgraph \"cluster_{}\" {{\n", "subgraph \"cluster_{}\" {{\n",
self.method.descriptor.__str__() self.dot_sanitized_method_dscr()
); );
dot_string += " style=\"dashed\";\n"; dot_string += " style=\"dashed\";\n";
dot_string += " color=\"black\";\n"; dot_string += " color=\"black\";\n";

View file

@ -102,7 +102,7 @@ impl MethodCFG<'_> {
let types = self.get_reg_types(); let types = self.get_reg_types();
let mut dot_string = format!( let mut dot_string = format!(
"subgraph \"cluster_reg_types_{}\" {{\n", "subgraph \"cluster_reg_types_{}\" {{\n",
self.method.descriptor.__str__() self.dot_sanitized_method_dscr()
); );
dot_string += " style=\"dashed\";\n"; dot_string += " style=\"dashed\";\n";
dot_string += " color=\"black\";\n"; dot_string += " color=\"black\";\n";
@ -129,9 +129,9 @@ impl MethodCFG<'_> {
dot_string += &format!( dot_string += &format!(
" cluster_{}:node_{}:s -> cluster_reg_types_{}:node_{}:n \ " cluster_{}:node_{}:s -> cluster_reg_types_{}:node_{}:n \
[style=\"solid,bold\",color=grey,weight=10,constraint=true];\n", [style=\"solid,bold\",color=grey,weight=10,constraint=true];\n",
self.method.descriptor.__str__(), self.dot_sanitized_method_dscr(),
i, i,
self.method.descriptor.__str__(), self.dot_sanitized_method_dscr(),
name name
); );
} }