@@ -364,13 +364,13 @@ getAlternativeLiteralTypes(KnownProtocolKind kind) {
364
364
}
365
365
366
366
ConstraintLocator *ConstraintSystem::getConstraintLocator (
367
- TypedNode anchor, ArrayRef<ConstraintLocator::PathElement> path) {
367
+ ASTNode anchor, ArrayRef<ConstraintLocator::PathElement> path) {
368
368
auto summaryFlags = ConstraintLocator::getSummaryFlagsForPath (path);
369
369
return getConstraintLocator (anchor, path, summaryFlags);
370
370
}
371
371
372
372
ConstraintLocator *ConstraintSystem::getConstraintLocator (
373
- TypedNode anchor, ArrayRef<ConstraintLocator::PathElement> path,
373
+ ASTNode anchor, ArrayRef<ConstraintLocator::PathElement> path,
374
374
unsigned summaryFlags) {
375
375
assert (summaryFlags == ConstraintLocator::getSummaryFlagsForPath (path));
376
376
@@ -423,7 +423,7 @@ ConstraintLocator *ConstraintSystem::getConstraintLocator(
423
423
424
424
ConstraintLocator *ConstraintSystem::getCalleeLocator (
425
425
ConstraintLocator *locator, bool lookThroughApply,
426
- llvm::function_ref<Type(const Expr *)> getType,
426
+ llvm::function_ref<Type(Expr *)> getType,
427
427
llvm::function_ref<Type(Type)> simplifyType,
428
428
llvm::function_ref<Optional<SelectedOverload>(ConstraintLocator *)>
429
429
getOverloadFor) {
@@ -3302,7 +3302,7 @@ constraints::simplifyLocator(ConstraintSystem &cs, ConstraintLocator *locator,
3302
3302
return cs.getConstraintLocator (anchor, path);
3303
3303
}
3304
3304
3305
- void constraints::simplifyLocator (TypedNode &anchor,
3305
+ void constraints::simplifyLocator (ASTNode &anchor,
3306
3306
ArrayRef<LocatorPathElt> &path,
3307
3307
SourceRange &range) {
3308
3308
range = SourceRange ();
@@ -3514,7 +3514,7 @@ void constraints::simplifyLocator(TypedNode &anchor,
3514
3514
}
3515
3515
}
3516
3516
3517
- TypedNode constraints::simplifyLocatorToAnchor (ConstraintLocator *locator) {
3517
+ ASTNode constraints::simplifyLocatorToAnchor (ConstraintLocator *locator) {
3518
3518
if (!locator)
3519
3519
return nullptr ;
3520
3520
@@ -3531,7 +3531,7 @@ TypedNode constraints::simplifyLocatorToAnchor(ConstraintLocator *locator) {
3531
3531
return path.empty () ? anchor : nullptr ;
3532
3532
}
3533
3533
3534
- Expr *constraints::getArgumentExpr (TypedNode node, unsigned index) {
3534
+ Expr *constraints::getArgumentExpr (ASTNode node, unsigned index) {
3535
3535
auto *expr = castToExpr (node);
3536
3536
Expr *argExpr = nullptr ;
3537
3537
if (auto *AE = dyn_cast<ApplyExpr>(expr))
@@ -4460,26 +4460,20 @@ void ConstraintSystem::maybeProduceFallbackDiagnostic(
4460
4460
ctx.Diags .diagnose (target.getLoc (), diag::failed_to_produce_diagnostic);
4461
4461
}
4462
4462
4463
- SourceLoc constraints::getLoc (TypedNode anchor) {
4464
- if (auto *E = anchor.dyn_cast <const Expr *>()) {
4463
+ SourceLoc constraints::getLoc (ASTNode anchor) {
4464
+ if (auto *E = anchor.dyn_cast <Expr *>()) {
4465
4465
return E->getLoc ();
4466
- } else if (auto *T = anchor.dyn_cast <const TypeLoc *>()) {
4466
+ } else if (auto *T = anchor.dyn_cast <TypeLoc *>()) {
4467
4467
return T->getLoc ();
4468
- } else if (auto *V = anchor.dyn_cast <const VarDecl *>()) {
4469
- return V->getNameLoc ();
4468
+ } else if (auto *V = anchor.dyn_cast <Decl *>()) {
4469
+ if (auto VD = dyn_cast<VarDecl>(V))
4470
+ return VD->getNameLoc ();
4471
+ return anchor.getStartLoc ();
4470
4472
} else {
4471
- return anchor.get <const Pattern *>()->getLoc ();
4473
+ return anchor.get <Pattern *>()->getLoc ();
4472
4474
}
4473
4475
}
4474
4476
4475
- SourceRange constraints::getSourceRange (TypedNode anchor) {
4476
- if (auto *E = anchor.dyn_cast <const Expr *>()) {
4477
- return E->getSourceRange ();
4478
- } else if (auto *T = anchor.dyn_cast <const TypeLoc *>()) {
4479
- return T->getSourceRange ();
4480
- } else if (auto *V = anchor.dyn_cast <const VarDecl *>()) {
4481
- return V->getSourceRange ();
4482
- } else {
4483
- return anchor.get <const Pattern *>()->getSourceRange ();
4484
- }
4477
+ SourceRange constraints::getSourceRange (ASTNode anchor) {
4478
+ return anchor.getSourceRange ();
4485
4479
}
0 commit comments