[CS] NFC: Inline recomputeSummaryFlags

This commit is contained in:
Hamish Knight
2019-09-15 17:59:26 +01:00
parent 4af9744fe3
commit 26dab57edd

View File

@@ -2731,14 +2731,6 @@ bool ConstraintSystem::diagnoseAmbiguity(Expr *expr,
return false; return false;
} }
/// Given a subpath of an old locator, compute its summary flags.
static unsigned recomputeSummaryFlags(ConstraintLocator *oldLocator,
ArrayRef<LocatorPathElt> path) {
if (oldLocator->getSummaryFlags() != 0)
return ConstraintLocator::getSummaryFlagsForPath(path);
return 0;
}
ConstraintLocator * ConstraintLocator *
constraints::simplifyLocator(ConstraintSystem &cs, ConstraintLocator *locator, constraints::simplifyLocator(ConstraintSystem &cs, ConstraintLocator *locator,
SourceRange &range) { SourceRange &range) {
@@ -2752,10 +2744,12 @@ constraints::simplifyLocator(ConstraintSystem &cs, ConstraintLocator *locator,
return locator; return locator;
} }
// Recompute the summary flags if we had any to begin with. This is // If the old locator didn't have any summary flags, neither will the
// necessary because we might remove e.g. tuple elements from the path. // simplified version, as it must contain a subset of the path elements.
unsigned summaryFlags = recomputeSummaryFlags(locator, path); if (locator->getSummaryFlags() == 0)
return cs.getConstraintLocator(anchor, path, summaryFlags); return cs.getConstraintLocator(anchor, path, /*summaryFlags*/ 0);
return cs.getConstraintLocator(anchor, path);
} }
void constraints::simplifyLocator(Expr *&anchor, void constraints::simplifyLocator(Expr *&anchor,