Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ public static VCSimplificationResult simplifyOnce(VCSimplificationResult implica
VCImplication simplified = pass.apply(implication.getImplication());
if (implication.getImplication().equals(simplified))
return implication;
return new VCSimplificationResult(simplified, implication);
return new VCSimplificationResult(simplified, implication, pass.getName());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,9 @@
*/
public interface VCSimplificationPass {
VCImplication apply(VCImplication implication);

default String getName() {
return getClass().getSimpleName().replaceFirst("^VC", "").replaceFirst("Simplification$", "")
.replaceAll("(?<=[a-z0-9])(?=[A-Z])", " ");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,18 @@ public final class VCSimplificationResult {

private final VCImplication implication;
private final VCSimplificationResult origin;
private final String simplification;

public VCSimplificationResult(VCImplication implication) {
this(implication, null);
this.implication = Objects.requireNonNull(implication).clone();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we use this "requireNonNull" in several places across the codebase? I was under the impression we didn't use that as a standard

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we don't, I'll remove it.

this.origin = null;
this.simplification = null;
}

public VCSimplificationResult(VCImplication implication, VCSimplificationResult origin) {
public VCSimplificationResult(VCImplication implication, VCSimplificationResult origin, String simplification) {
this.implication = Objects.requireNonNull(implication).clone();
this.origin = origin;
this.origin = Objects.requireNonNull(origin);
this.simplification = Objects.requireNonNull(simplification);
}

/**
Expand All @@ -35,6 +39,13 @@ public VCSimplificationResult getOrigin() {
return origin;
}

/**
* Returns the name of the simplification pass that produced this result or null for the original VC chain
*/
public String getSimplification() {
return simplification;
}

@Override
public String toString() {
if (origin == null)
Expand Down
Loading