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:
parent
95a0a3e4a4
commit
5a685e501f
2 changed files with 13 additions and 10 deletions
|
@ -66,6 +66,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
||||||
protected IToken lastToken;
|
protected IToken lastToken;
|
||||||
private boolean limitReached = false;
|
private boolean limitReached = false;
|
||||||
private Stack templateIdScopes = null;
|
private Stack templateIdScopes = null;
|
||||||
|
private TypeId typeIdInstance = new TypeId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Returns the astFactory.
|
* @return Returns the astFactory.
|
||||||
|
@ -1696,7 +1697,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
||||||
if( kind == null )
|
if( kind == null )
|
||||||
throw backtrack;
|
throw backtrack;
|
||||||
|
|
||||||
TypeId id = TypeId.getInstance(scope);
|
TypeId id = getTypeIdInstance(scope);
|
||||||
IToken last = lastToken;
|
IToken last = lastToken;
|
||||||
|
|
||||||
//template parameters are consumed as part of name
|
//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
|
* @param expression
|
||||||
* @throws BacktrackException
|
* @throws BacktrackException
|
||||||
|
|
|
@ -30,17 +30,11 @@ public class TypeId implements IDeclarator
|
||||||
private List arrayModifiers;
|
private List arrayModifiers;
|
||||||
private List pointerOperators;
|
private List pointerOperators;
|
||||||
private IASTScope scope;
|
private IASTScope scope;
|
||||||
private static TypeId instance = new TypeId();
|
|
||||||
|
|
||||||
public static TypeId getInstance(IASTScope scope)
|
|
||||||
{
|
|
||||||
instance.reset(scope);
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* @param scope2
|
* @param scope2
|
||||||
*/
|
*/
|
||||||
private void reset(IASTScope s) {
|
void reset(IASTScope s) {
|
||||||
this.scope = s;
|
this.scope = s;
|
||||||
arrayModifiers = Collections.EMPTY_LIST;
|
arrayModifiers = Collections.EMPTY_LIST;
|
||||||
pointerOperators = Collections.EMPTY_LIST;
|
pointerOperators = Collections.EMPTY_LIST;
|
||||||
|
@ -49,7 +43,7 @@ public class TypeId implements IDeclarator
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private TypeId()
|
TypeId()
|
||||||
{
|
{
|
||||||
reset( null );
|
reset( null );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue