mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
REPL: Don't keep stale ASTs if typechecking fails.
Oops, appendToREPLTranslationUnit's "CurTUElem" wasn't intended to leak into the REPLContext. Swift SVN r4205
This commit is contained in:
@@ -164,6 +164,7 @@ bool swift::appendToREPLTranslationUnit(TranslationUnit *TU,
|
||||
assert(TU->Kind == TranslationUnit::Repl && "Can't append to a non-REPL TU");
|
||||
|
||||
bool FoundAnySideEffects = false;
|
||||
unsigned CurTUElem = RC.CurTUElem;
|
||||
do {
|
||||
FoundAnySideEffects |= parseIntoTranslationUnit(TU, RC.BufferID,
|
||||
&BufferOffset,
|
||||
@@ -172,9 +173,9 @@ bool swift::appendToREPLTranslationUnit(TranslationUnit *TU,
|
||||
// PatternBinding to bind the result to a metavariable.
|
||||
reparseREPLMetavariable(TU, RC);
|
||||
|
||||
performNameBinding(TU, RC.CurTUElem);
|
||||
performTypeChecking(TU, RC.CurTUElem);
|
||||
RC.CurTUElem = TU->Decls.size();
|
||||
performNameBinding(TU, CurTUElem);
|
||||
performTypeChecking(TU, CurTUElem);
|
||||
CurTUElem = TU->Decls.size();
|
||||
} while (BufferOffset != BufferEndOffset);
|
||||
return FoundAnySideEffects;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user