mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Constraint system] Look for parent/depth info in base constraint system.
Look first in the base constraint system for this information, so it only gets built once in the normal case.
This commit is contained in:
@@ -528,6 +528,12 @@ static void extendDepthMap(
|
||||
|
||||
Optional<std::pair<unsigned, Expr *>> ConstraintSystem::getExprDepthAndParent(
|
||||
Expr *expr) {
|
||||
// Check whether the parent has this information.
|
||||
if (baseCS && baseCS != this) {
|
||||
if (auto known = baseCS->getExprDepthAndParent(expr))
|
||||
return *known;
|
||||
}
|
||||
|
||||
// Bring the set of expression weights up to date.
|
||||
while (NumInputExprsInWeights < InputExprs.size()) {
|
||||
extendDepthMap(InputExprs[NumInputExprsInWeights], ExprWeights);
|
||||
@@ -538,9 +544,6 @@ Optional<std::pair<unsigned, Expr *>> ConstraintSystem::getExprDepthAndParent(
|
||||
if (e != ExprWeights.end())
|
||||
return e->second;
|
||||
|
||||
if (baseCS && baseCS != this)
|
||||
return baseCS->getExprDepthAndParent(expr);
|
||||
|
||||
return None;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user