mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 12:24:24 +00:00
Migration: Improvements to graph debug output.
Two minor fixes: - Ensure that the immutable nodes `always` and `never` are always drawn with the `shape=none` attribute. (Previously, the first time we encountered an immutable node we would draw it in the style of a mutable node, which made things very confusing). - Add a space before `style=filled` in the graphviz output. Previously we would output things like `n21 [label="type(13) (ordinary nullable)"style=filled]`, which graphviz seems to do ok with but seems inadvisable. Change-Id: Iefcb4005c9bb2e24ae8d80552e5e4a23ec062c56 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133868 Commit-Queue: Paul Berry <paulberry@google.com> Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
This commit is contained in:
parent
ab6d0ef178
commit
aa5a5ff5a8
1 changed files with 8 additions and 6 deletions
|
@ -248,22 +248,24 @@ class NullabilityGraph {
|
|||
Map<NullabilityNode, String> shortNames = {};
|
||||
int counter = 0;
|
||||
String nameNode(NullabilityNode node) {
|
||||
if (node.isImmutable) {
|
||||
var name = 'n${counter++}';
|
||||
print(' $name [label="$node" shape=none]');
|
||||
return name;
|
||||
}
|
||||
var name = shortNames[node];
|
||||
if (name == null) {
|
||||
shortNames[node] = name = 'n${counter++}';
|
||||
String styleSuffix = node.isNullable ? 'style=filled' : '';
|
||||
String styleSuffix = node.isNullable ? ' style=filled' : '';
|
||||
String intentSuffix =
|
||||
node.nonNullIntent.isPresent ? ', non-null intent' : '';
|
||||
print(
|
||||
' $name [label="$node (${node._nullability}$intentSuffix)"$styleSuffix]');
|
||||
String label = '$node (${node._nullability}$intentSuffix)';
|
||||
print(' $name [label="$label"$styleSuffix]');
|
||||
if (node is _NullabilityNodeCompound) {
|
||||
for (var component in node._components) {
|
||||
print(' ${nameNode(component)} -> $name [style=dashed]');
|
||||
}
|
||||
}
|
||||
} else if (node.isImmutable) {
|
||||
shortNames[node] = name = 'n${counter++}';
|
||||
print(' $name [label="$node" shape=none]');
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue