diff options
author | MichalMoskal <unknown> | 2011-01-26 23:37:02 +0000 |
---|---|---|
committer | MichalMoskal <unknown> | 2011-01-26 23:37:02 +0000 |
commit | a47bd58c659854aa13758fcdbd493093c820fc5c (patch) | |
tree | a541c36beca98cc9d65fca15647f9a67df919d39 /Source/ModelViewer | |
parent | cfa55f3b6815a7fa81409c7742fe81a695a6299d (diff) |
Simplify state name selection
Diffstat (limited to 'Source/ModelViewer')
-rw-r--r-- | Source/ModelViewer/VccProvider.cs | 31 |
1 files changed, 6 insertions, 25 deletions
diff --git a/Source/ModelViewer/VccProvider.cs b/Source/ModelViewer/VccProvider.cs index 2cd7c383..0bd59d34 100644 --- a/Source/ModelViewer/VccProvider.cs +++ b/Source/ModelViewer/VccProvider.cs @@ -124,22 +124,19 @@ namespace Microsoft.Boogie.ModelViewer.Vcc states.Clear();
var i = 0;
while (i < allStates.Length) {
- var bestState = allStates[i];
- var bestName = TryParseSourceLocation(bestState.State.Name);
+ var lastGoodName = allStates[i].State.Name;
i++;
while (i < allStates.Length) {
if (allStates[i].State.Variables.Contains("$s"))
break;
var curName = TryParseSourceLocation(allStates[i].State.Name);
- if (CompareNames(curName, bestName) < 0) {
- bestName = curName;
- bestState = allStates[i];
- }
+ if (!IsBadName(curName))
+ lastGoodName = allStates[i].State.Name;
i++;
}
var lastState = allStates[i - 1];
- lastState.capturedStateName = bestState.CapturedStateName;
+ lastState.capturedStateName = lastGoodName;
lastState.index = states.Count;
states.Add(lastState);
lastState.SetupVars();
@@ -154,26 +151,10 @@ namespace Microsoft.Boogie.ModelViewer.Vcc GenerateSourceLocations(states);
}
- int NameBadness(SourceLocation l)
- {
- if (l == null) return 5;
- if (l.Filename.StartsWith("<")) return 4;
- if (l.AddInfo == "") return 3;
- return 0;
- }
- int CompareNames(SourceLocation l1, SourceLocation l2)
+ bool IsBadName(SourceLocation l)
{
- if (l1 == l2) return 0;
-
- var res = NameBadness(l1) - NameBadness(l2);
- if (res != 0)
- return res;
-
- res = l1.Line - l2.Line;
- if (res == 0)
- res = l1.Column - l2.Column;
- return res;
+ return l == null || l.Filename.StartsWith("<");
}
private void ComputeLocalVariableNames()
|