Skip to content

Commit

Permalink
Provide more flexibility in configuring which return statements get s…
Browse files Browse the repository at this point in the history
…eparate VCs with isolate_assertions (#979)

### Changes
Enable isolate_assertions to include explicit return statement in Daf…ny
programs
  • Loading branch information
keyboardDrummer authored Nov 13, 2024
1 parent 92e40bd commit 6450474
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Source/Core/Generic/TokenWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ public int CompareTo(IToken? other) {
return Inner.CompareTo(other);
}

public bool IsSourceToken => false;

public int kind {
get => Inner.kind;
set => Inner.kind = value;
Expand Down
6 changes: 6 additions & 0 deletions Source/Core/Token.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ namespace Microsoft.Boogie
[Immutable]
public interface IToken : IComparable<IToken>
{
/// <summary>
/// True if this token was created during parsing
/// </summary>
bool IsSourceToken { get; }
int kind { get; set; } // token kind
string filename { get; set; } // token file
int pos { get; set; } // token position in the source text (starting at 0)
Expand Down Expand Up @@ -48,6 +52,8 @@ public Token(int linenum, int colnum)
this._val = "anything so that it is nonnull";
}

public bool IsSourceToken => true;

public int kind
{
get { return this._kind; }
Expand Down
2 changes: 1 addition & 1 deletion Source/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<!-- Target framework and package configuration -->
<PropertyGroup>
<Version>3.4.1</Version>
<Version>3.4.2</Version>
<TargetFramework>net6.0</TargetFramework>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<Authors>Boogie</Authors>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static (List<ManualSplit> Isolated, ManualSplit Remainder) GetParts(VCGen

var gotoFromReturn = gotoCmd.tok as GotoFromReturn;
var isolateAttribute = QKeyValue.FindAttribute(gotoCmd.Attributes, p => p.Key == "isolate");
var isTypeOfAssert = gotoFromReturn != null && gotoFromReturn.Origin.tok is Token;
var isTypeOfAssert = gotoFromReturn != null && gotoFromReturn.Origin.tok.IsSourceToken;
var isolate = BlockRewriter.ShouldIsolate(isTypeOfAssert && splitOnEveryAssert, isolateAttribute);
if (!isolate) {
continue;
Expand Down

0 comments on commit 6450474

Please sign in to comment.