mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Fix handling of unmatched right parens in the REPL
Fixes rdar://14247238 Interpreter hangs and consumes memory on an unmatched right paren Swift SVN r5849
This commit is contained in:
@@ -490,7 +490,7 @@ public:
|
|||||||
TranslationUnit *getTU();
|
TranslationUnit *getTU();
|
||||||
|
|
||||||
REPLInputKind getREPLInput(llvm::SmallVectorImpl<char> &Line) {
|
REPLInputKind getREPLInput(llvm::SmallVectorImpl<char> &Line) {
|
||||||
unsigned BraceCount = 0;
|
int BraceCount = 0;
|
||||||
bool HadLineContinuation = false;
|
bool HadLineContinuation = false;
|
||||||
bool UnfinishedInfixExpr = false;
|
bool UnfinishedInfixExpr = false;
|
||||||
unsigned CurChunkLines = 0;
|
unsigned CurChunkLines = 0;
|
||||||
@@ -579,7 +579,7 @@ public:
|
|||||||
if (*p == ' ' || *p == '\t')
|
if (*p == ' ' || *p == '\t')
|
||||||
UnfinishedInfixExpr = true;
|
UnfinishedInfixExpr = true;
|
||||||
}
|
}
|
||||||
} while (BraceCount != 0 || HadLineContinuation || UnfinishedInfixExpr);
|
} while (BraceCount > 0 || HadLineContinuation || UnfinishedInfixExpr);
|
||||||
|
|
||||||
// The lexer likes null-terminated data.
|
// The lexer likes null-terminated data.
|
||||||
Line.push_back('\0');
|
Line.push_back('\0');
|
||||||
|
|||||||
Reference in New Issue
Block a user