1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Fixed concurrent parse issue w/TypeId singleton.

This commit is contained in:
John Camelon 2004-06-02 18:17:55 +00:00
parent 95a0a3e4a4
commit 5a685e501f
2 changed files with 13 additions and 10 deletions

View file

@ -66,6 +66,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
protected IToken lastToken;
private boolean limitReached = false;
private Stack templateIdScopes = null;
private TypeId typeIdInstance = new TypeId();
/**
* @return Returns the astFactory.
@ -1696,7 +1697,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
if( kind == null )
throw backtrack;
TypeId id = TypeId.getInstance(scope);
TypeId id = getTypeIdInstance(scope);
IToken last = lastToken;
//template parameters are consumed as part of name
@ -1731,6 +1732,14 @@ public class ExpressionParser implements IExpressionParser, IParserData {
}
}
/**
* @param scope
* @return
*/
private TypeId getTypeIdInstance(IASTScope scope) {
typeIdInstance.reset(scope);
return typeIdInstance;
}
/**
* @param expression
* @throws BacktrackException

View file

@ -30,17 +30,11 @@ public class TypeId implements IDeclarator
private List arrayModifiers;
private List pointerOperators;
private IASTScope scope;
private static TypeId instance = new TypeId();
public static TypeId getInstance(IASTScope scope)
{
instance.reset(scope);
return instance;
}
/**
* @param scope2
*/
private void reset(IASTScope s) {
void reset(IASTScope s) {
this.scope = s;
arrayModifiers = Collections.EMPTY_LIST;
pointerOperators = Collections.EMPTY_LIST;
@ -49,7 +43,7 @@ public class TypeId implements IDeclarator
/**
*
*/
private TypeId()
TypeId()
{
reset( null );
}