mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 09:46:02 +02:00
CORE
Partial fix for Bug 43221 : POSTFIX_TYPENAME_IDENTIFIER not implemented TEST Updated CompleteParseASTExpressionTest::testPostfixTypenameIdentifier() for Hoda.
This commit is contained in:
parent
5f524fb890
commit
a6efadb09a
3 changed files with 46 additions and 16 deletions
|
@ -199,24 +199,14 @@ public class CompleteParseASTExpressionTest extends CompleteParseBaseTest{
|
||||||
assertAllReferences( 1, createTaskList( new Task( foo )));
|
assertAllReferences( 1, createTaskList( new Task( foo )));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Kind POSTFIX_TYPENAME_IDENTIFIER
|
// // Kind POSTFIX_TYPENAME_IDENTIFIER
|
||||||
// public void testPostfixTypenameIdentifier() throws Exception{
|
// public void testPostfixTypenameIdentifier() throws Exception{
|
||||||
// Iterator i = parse( "class A {}; \n int foo(); int foo( A a ); \n int x = foo( typename A(); );").getDeclarations();
|
// Iterator i = parse( "class A {}; \n int foo(); int foo( A a ); \n int x = foo( typename A() );").getDeclarations();
|
||||||
// IASTClassSpecifier cl = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
|
// IASTClassSpecifier cl = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
|
||||||
// IASTFunction f1 = (IASTFunction) i.next();
|
// IASTFunction f1 = (IASTFunction) i.next();
|
||||||
// IASTFunction f2 = (IASTFunction) i.next();
|
// IASTFunction f2 = (IASTFunction) i.next();
|
||||||
// IASTVariable x = (IASTVariable) i.next();
|
// IASTVariable x = (IASTVariable) i.next();
|
||||||
// Iterator members = getDeclarations(cl);
|
// assertAllReferences( 3, createTaskList( new Task( cl, 2 ), new Task( f2) ) );
|
||||||
// IASTField m = (IASTField)members.next();
|
|
||||||
// Iterator references = callback.getReferences().iterator();
|
|
||||||
// IASTClassReference clr= (IASTClassReference)references.next();
|
|
||||||
// assertEquals(clr.getReferencedElement(), cl);
|
|
||||||
// IASTVariableReference ar = (IASTVariableReference)references.next();
|
|
||||||
// assertEquals(ar.getReferencedElement(), a);
|
|
||||||
// IASTFieldReference mr = (IASTFieldReference) references.next();
|
|
||||||
// assertEquals(mr.getReferencedElement(), m);
|
|
||||||
// IASTFunctionReference fr = (IASTFunctionReference) references.next();
|
|
||||||
// assertEquals(fr.getReferencedElement(), f2);
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// Kind POSTFIX_TYPENAME_TEMPLATEID
|
// Kind POSTFIX_TYPENAME_TEMPLATEID
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
2003-09-25 John Camelon
|
||||||
|
Partial fix for Bug 43221 : POSTFIX_TYPENAME_IDENTIFIER not implemented
|
||||||
|
|
||||||
2003-09-24 John Camelon
|
2003-09-24 John Camelon
|
||||||
Fixed Bug 43106 : Symbol Table support needed to resolve types
|
Fixed Bug 43106 : Symbol Table support needed to resolve types
|
||||||
Fixed Bug 43375 : isExtern not returning true for extern declarations
|
Fixed Bug 43375 : isExtern not returning true for extern declarations
|
||||||
|
|
|
@ -4082,8 +4082,45 @@ public class Parser implements IParser
|
||||||
switch (LT(1))
|
switch (LT(1))
|
||||||
{
|
{
|
||||||
case IToken.t_typename :
|
case IToken.t_typename :
|
||||||
consume(); //TODO: the rest of this
|
consume(IToken.t_typename);
|
||||||
break;
|
ITokenDuple nestedName = name();
|
||||||
|
boolean templateTokenConsumed = false;
|
||||||
|
if( LT(1) == IToken.t_template )
|
||||||
|
{
|
||||||
|
consume( IToken.t_template );
|
||||||
|
templateTokenConsumed = true;
|
||||||
|
}
|
||||||
|
IToken current = mark();
|
||||||
|
ITokenDuple templateId = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
templateId = new TokenDuple( current, templateId() );
|
||||||
|
}
|
||||||
|
catch( Backtrack bt )
|
||||||
|
{
|
||||||
|
if( templateTokenConsumed )
|
||||||
|
throw bt;
|
||||||
|
backup( current );
|
||||||
|
}
|
||||||
|
consume( IToken.tLPAREN );
|
||||||
|
IASTExpression expressionList = expression( scope );
|
||||||
|
consume( IToken.tRPAREN );
|
||||||
|
try {
|
||||||
|
firstExpression =
|
||||||
|
astFactory.createExpression( scope,
|
||||||
|
(( templateId != null )? IASTExpression.Kind.POSTFIX_TYPENAME_TEMPLATEID : IASTExpression.Kind.POSTFIX_TYPENAME_IDENTIFIER ),
|
||||||
|
expressionList,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
nestedName,
|
||||||
|
"",
|
||||||
|
null );
|
||||||
|
} catch (ASTSemanticException ase ) {
|
||||||
|
failParse();
|
||||||
|
throw backtrack;
|
||||||
|
}
|
||||||
|
break;
|
||||||
// simple-type-specifier ( assignment-expression , .. )
|
// simple-type-specifier ( assignment-expression , .. )
|
||||||
case IToken.t_char :
|
case IToken.t_char :
|
||||||
firstExpression =
|
firstExpression =
|
||||||
|
@ -4224,7 +4261,7 @@ public class Parser implements IParser
|
||||||
break;
|
break;
|
||||||
case IToken.tLPAREN :
|
case IToken.tLPAREN :
|
||||||
// function call
|
// function call
|
||||||
consume();
|
consume(IToken.tLPAREN);
|
||||||
secondExpression = expression(scope);
|
secondExpression = expression(scope);
|
||||||
consume(IToken.tRPAREN);
|
consume(IToken.tRPAREN);
|
||||||
try
|
try
|
||||||
|
|
Loading…
Add table
Reference in a new issue