Skip to content

Commit bea0a6a

Browse files
committed
Don't cache the standard library twice
1 parent 9da2e86 commit bea0a6a

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

lib/Sema/TypeChecker.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -209,17 +209,11 @@ Type TypeChecker::getObjectLiteralParameterType(ObjectLiteralExpr *expr,
209209
}
210210

211211
ModuleDecl *TypeChecker::getStdlibModule(const DeclContext *dc) {
212-
if (StdlibModule)
213-
return StdlibModule;
214-
215-
StdlibModule = Context.getStdlibModule();
216-
217-
if (!StdlibModule) {
218-
return dc->getParentModule();
212+
if (auto *stdlib = Context.getStdlibModule()) {
213+
return stdlib;
219214
}
220215

221-
assert(StdlibModule && "no main module found");
222-
return StdlibModule;
216+
return dc->getParentModule();
223217
}
224218

225219
/// Bind the given extension to the given nominal type.

lib/Sema/TypeChecker.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -574,8 +574,6 @@ class TypeChecker final : public LazyResolver {
574574
/// The set of expressions currently being analyzed for failures.
575575
llvm::DenseMap<Expr*, Expr*> DiagnosedExprs;
576576

577-
ModuleDecl *StdlibModule = nullptr;
578-
579577
/// The index of the next response metavariable to bind to a REPL result.
580578
unsigned NextResponseVariableIndex = 0;
581579

0 commit comments

Comments
 (0)