1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00
Partial fix for Bug 43221 : POSTFIX_TYPENAME_IDENTIFIER not implemented 

TEST
	Updated CompleteParseASTExpressionTest::testPostfixTypenameIdentifier() for Hoda.
This commit is contained in:
John Camelon 2003-09-25 13:33:33 +00:00
parent 5f524fb890
commit a6efadb09a
3 changed files with 46 additions and 16 deletions

View file

@ -199,24 +199,14 @@ public class CompleteParseASTExpressionTest extends CompleteParseBaseTest{
assertAllReferences( 1, createTaskList( new Task( foo )));
}
// Kind POSTFIX_TYPENAME_IDENTIFIER
// // Kind POSTFIX_TYPENAME_IDENTIFIER
// 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();
// IASTFunction f1 = (IASTFunction) i.next();
// IASTFunction f2 = (IASTFunction) i.next();
// IASTVariable x = (IASTVariable) i.next();
// Iterator members = getDeclarations(cl);
// 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);
// assertAllReferences( 3, createTaskList( new Task( cl, 2 ), new Task( f2) ) );
// }
// Kind POSTFIX_TYPENAME_TEMPLATEID

View file

@ -1,3 +1,6 @@
2003-09-25 John Camelon
Partial fix for Bug 43221 : POSTFIX_TYPENAME_IDENTIFIER not implemented
2003-09-24 John Camelon
Fixed Bug 43106 : Symbol Table support needed to resolve types
Fixed Bug 43375 : isExtern not returning true for extern declarations

View file

@ -4082,7 +4082,44 @@ public class Parser implements IParser
switch (LT(1))
{
case IToken.t_typename :
consume(); //TODO: the rest of this
consume(IToken.t_typename);
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 , .. )
case IToken.t_char :
@ -4224,7 +4261,7 @@ public class Parser implements IParser
break;
case IToken.tLPAREN :
// function call
consume();
consume(IToken.tLPAREN);
secondExpression = expression(scope);
consume(IToken.tRPAREN);
try