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:
Joe Groff
2013-02-26 00:57:40 +00:00
parent dc28ebb544
commit 5f1344ce68

View File

@@ -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;
}