Move "isDebugMode" into ConstraintSystem

This eliminates the final source of mutation of the TypeCheckerFlags on the ASTContext.
This commit is contained in:
Robert Widmann
2020-05-11 16:48:37 -07:00
parent a5dcb1d400
commit 2bca013457
14 changed files with 80 additions and 68 deletions

View File

@@ -872,7 +872,7 @@ namespace {
contractedCycle = false;
for (const auto &edge : cycleEdges) {
if (unionSets(edge.first, edge.second)) {
if (ctx.TypeCheckerOpts.DebugConstraintSolver) {
if (cs.isDebugMode()) {
auto &log = ctx.TypeCheckerDebug->getStream();
if (cs.solverState)
log.indent(cs.solverState->depth * 2);
@@ -1155,7 +1155,7 @@ bool ConstraintGraph::contractEdges() {
rep2->getImpl().canBindToLValue()) ||
// Allow l-value contractions when binding parameter types.
isParamBindingConstraint)) {
if (CS.getASTContext().TypeCheckerOpts.DebugConstraintSolver) {
if (CS.isDebugMode()) {
auto &log = CS.getASTContext().TypeCheckerDebug->getStream();
if (CS.solverState)
log.indent(CS.solverState->depth * 2);