1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-01 05:15:43 +02:00

Workaround for Bug 51502 - Parser spins on particular file (Scalability)

This commit is contained in:
John Camelon 2004-02-10 20:51:23 +00:00
parent 901cb862ed
commit 9a439466fc
2 changed files with 10 additions and 5 deletions

View file

@ -1,3 +1,6 @@
2004-02-10 John Camelon
Workaround for Bug 51502 - Parser spins on particular file (Scalability)
2004-02-10 John Camelon 2004-02-10 John Camelon
Fixed Bug 51302 - Content Assist: No completion list available following namespace declaration. Fixed Bug 51302 - Content Assist: No completion list available following namespace declaration.

View file

@ -956,8 +956,10 @@ public abstract class Parser implements IParser
throws BacktrackException, EndOfFileException throws BacktrackException, EndOfFileException
{ {
IToken firstToken = LA(1); IToken firstToken = LA(1);
if( firstToken.getType() == IToken.tLBRACE ) throw backtrack;
DeclarationWrapper sdw = DeclarationWrapper sdw =
new DeclarationWrapper(scope, firstToken.getOffset(), firstToken.getLineNumber(), ownerTemplate); new DeclarationWrapper(scope, firstToken.getOffset(), firstToken.getLineNumber(), ownerTemplate);
firstToken = null; // necessary for scalability
setCompletionValues( scope, getCompletionKindForDeclaration(scope, overideKind), Key.DECL_SPECIFIER_SEQUENCE ); setCompletionValues( scope, getCompletionKindForDeclaration(scope, overideKind), Key.DECL_SPECIFIER_SEQUENCE );
declSpecifierSeq(sdw, false, strategy == SimpleDeclarationStrategy.TRY_CONSTRUCTOR ); declSpecifierSeq(sdw, false, strategy == SimpleDeclarationStrategy.TRY_CONSTRUCTOR );
@ -1025,8 +1027,6 @@ public abstract class Parser implements IParser
{ {
if( LT(1) == IToken.tLBRACE ) if( LT(1) == IToken.tLBRACE )
{ {
if( firstToken == LA(1) )
throw backtrack;
declarator.setHasFunctionBody(true); declarator.setHasFunctionBody(true);
hasFunctionBody = true; hasFunctionBody = true;
} }
@ -1943,10 +1943,12 @@ public abstract class Parser implements IParser
throws EndOfFileException, BacktrackException throws EndOfFileException, BacktrackException
{ {
// handle initializer // handle initializer
final IASTScope scope = d.getDeclarationWrapper().getScope();
if (LT(1) == IToken.tASSIGN) if (LT(1) == IToken.tASSIGN)
{ {
consume(IToken.tASSIGN); consume(IToken.tASSIGN);
d.setInitializerClause(initializerClause(d.getDeclarationWrapper().getScope())); IASTInitializerClause clause = initializerClause(scope);
d.setInitializerClause(clause);
} }
else if (LT(1) == IToken.tLPAREN ) else if (LT(1) == IToken.tLPAREN )
{ {
@ -1956,7 +1958,7 @@ public abstract class Parser implements IParser
{ {
consume(IToken.tLPAREN); // EAT IT! consume(IToken.tLPAREN); // EAT IT!
IASTExpression astExpression = null; IASTExpression astExpression = null;
astExpression = expression(d.getDeclarationWrapper().getScope()); astExpression = expression(scope);
consume(IToken.tRPAREN); consume(IToken.tRPAREN);
d.setConstructorExpression(astExpression); d.setConstructorExpression(astExpression);
} catch( BacktrackException bt ) } catch( BacktrackException bt )