Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert TypecheckingContext.CheckModifies to a property #986

Merged
merged 1 commit into from
Nov 17, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 0 additions & 1 deletion Source/Concurrency/CivlUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ public static int ResolveAndTypecheck(CoreOptions options, Absy absy, Resolution
}

var tc = new TypecheckingContext(null, options);
tc.CheckModifies = false; // to prevent access to tc.Proc which is null
absy.Typecheck(tc);
return tc.ErrorCount;
}
Expand Down
3 changes: 0 additions & 3 deletions Source/Concurrency/LinearRewriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -530,10 +530,7 @@ private void ResolveAndTypecheck(CoreOptions options, IEnumerable<Absy> absys)
return;
}
var tc = new TypecheckingContext(null, options);
var oldCheckModifies = tc.CheckModifies;
tc.CheckModifies = false;
absys.ForEach(absy => absy.Typecheck(tc));
tc.CheckModifies = oldCheckModifies;
}

private List<Cmd> CreateAccessAsserts(Expr expr, IToken tok, string msg)
Expand Down
3 changes: 1 addition & 2 deletions Source/Core/ResolutionContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -751,13 +751,12 @@ public class TypecheckingContext : CheckingContext
public LayerRange ExpectedLayerRange;
public bool GlobalAccessOnlyInOld;
public int InsideOld;
public bool CheckModifies;
public bool CheckModifies => Proc != null && (Proc.IsPure || (!Options?.DoModSetAnalysis ?? true));

public TypecheckingContext(IErrorSink errorSink, CoreOptions options)
: base(errorSink)
{
this.Options = options;
this.CheckModifies = !options?.DoModSetAnalysis ?? true;
}

public bool InFrame(Variable v)
Expand Down
Loading