@@ -638,15 +638,16 @@ Expr *TypeChecker::buildAutoClosureExpr(DeclContext *DC, Expr *expr,
638
638
return closure;
639
639
}
640
640
641
- static Type lookupDefaultLiteralType (TypeChecker &TC, const DeclContext *dc,
641
+ static Type lookupDefaultLiteralType (const DeclContext *dc,
642
642
StringRef name) {
643
+ auto &ctx = dc->getASTContext ();
643
644
auto lookupOptions = defaultUnqualifiedLookupOptions;
644
645
if (isa<AbstractFunctionDecl>(dc))
645
646
lookupOptions |= NameLookupFlags::KnownPrivate;
646
- auto lookup = TC. lookupUnqualified (dc->getModuleScopeContext (),
647
- TC. Context .getIdentifier (name),
648
- SourceLoc (),
649
- lookupOptions);
647
+ auto lookup = TypeChecker:: lookupUnqualified (dc->getModuleScopeContext (),
648
+ ctx .getIdentifier (name),
649
+ SourceLoc (),
650
+ lookupOptions);
650
651
TypeDecl *TD = lookup.getSingleTypeResult ();
651
652
if (!TD)
652
653
return Type ();
@@ -709,15 +710,12 @@ swift::DefaultTypeRequest::evaluate(Evaluator &evaluator,
709
710
if (!name)
710
711
return nullptr ;
711
712
712
- // FIXME: Creating a whole type checker just to do lookup is unnecessary.
713
- TypeChecker &tc = TypeChecker::createForContext (dc->getASTContext ());
714
-
715
713
Type type;
716
714
if (performLocalLookup)
717
- type = lookupDefaultLiteralType (tc, dc, name);
715
+ type = lookupDefaultLiteralType (dc, name);
718
716
719
717
if (!type)
720
- type = lookupDefaultLiteralType (tc, tc. getStdlibModule (dc), name);
718
+ type = lookupDefaultLiteralType (TypeChecker:: getStdlibModule (dc), name);
721
719
722
720
// Strip off one level of sugar; we don't actually want to print
723
721
// the name of the typealias itself anywhere.
0 commit comments