From 9a439466fce6a195980abcc9613ed588921e6e7e Mon Sep 17 00:00:00 2001 From: John Camelon Date: Tue, 10 Feb 2004 20:51:23 +0000 Subject: [PATCH] Workaround for Bug 51502 - Parser spins on particular file (Scalability) --- core/org.eclipse.cdt.core/parser/ChangeLog-parser | 3 +++ .../org/eclipse/cdt/internal/core/parser/Parser.java | 12 +++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/core/org.eclipse.cdt.core/parser/ChangeLog-parser b/core/org.eclipse.cdt.core/parser/ChangeLog-parser index 1c1b344f0c7..585ff5bc069 100644 --- a/core/org.eclipse.cdt.core/parser/ChangeLog-parser +++ b/core/org.eclipse.cdt.core/parser/ChangeLog-parser @@ -1,3 +1,6 @@ +2004-02-10 John Camelon + Workaround for Bug 51502 - Parser spins on particular file (Scalability) + 2004-02-10 John Camelon Fixed Bug 51302 - Content Assist: No completion list available following namespace declaration. diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java index 90bfccf16dc..a341095b45c 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java @@ -956,8 +956,10 @@ public abstract class Parser implements IParser throws BacktrackException, EndOfFileException { IToken firstToken = LA(1); + if( firstToken.getType() == IToken.tLBRACE ) throw backtrack; DeclarationWrapper sdw = new DeclarationWrapper(scope, firstToken.getOffset(), firstToken.getLineNumber(), ownerTemplate); + firstToken = null; // necessary for scalability setCompletionValues( scope, getCompletionKindForDeclaration(scope, overideKind), Key.DECL_SPECIFIER_SEQUENCE ); declSpecifierSeq(sdw, false, strategy == SimpleDeclarationStrategy.TRY_CONSTRUCTOR ); @@ -1025,8 +1027,6 @@ public abstract class Parser implements IParser { if( LT(1) == IToken.tLBRACE ) { - if( firstToken == LA(1) ) - throw backtrack; declarator.setHasFunctionBody(true); hasFunctionBody = true; } @@ -1943,10 +1943,12 @@ public abstract class Parser implements IParser throws EndOfFileException, BacktrackException { // handle initializer - if (LT(1) == IToken.tASSIGN) + final IASTScope scope = d.getDeclarationWrapper().getScope(); + if (LT(1) == IToken.tASSIGN) { consume(IToken.tASSIGN); - d.setInitializerClause(initializerClause(d.getDeclarationWrapper().getScope())); + IASTInitializerClause clause = initializerClause(scope); + d.setInitializerClause(clause); } else if (LT(1) == IToken.tLPAREN ) { @@ -1956,7 +1958,7 @@ public abstract class Parser implements IParser { consume(IToken.tLPAREN); // EAT IT! IASTExpression astExpression = null; - astExpression = expression(d.getDeclarationWrapper().getScope()); + astExpression = expression(scope); consume(IToken.tRPAREN); d.setConstructorExpression(astExpression); } catch( BacktrackException bt )