[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-patch] Applied [HEAD] : typename support in postfix expressions
|
CORE
Partial fix for Bug 43221 : POSTFIX_TYPENAME_IDENTIFIER not
implemented
TEST
Updated
CompleteParseASTExpressionTest::testPostfixTypenameIdentifier() for Hoda.
JohnC
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/ChangeLog,v
retrieving revision 1.111
diff -u -r1.111 ChangeLog
--- ChangeLog 24 Sep 2003 17:26:38 -0000 1.111
+++ ChangeLog 25 Sep 2003 13:24:44 -0000
@@ -1,3 +1,6 @@
+2003-09-25 John Camelon
+ Updated CompleteParseASTExpressionTest::testPostfixTypenameIdentifier() for Hoda.
+
2003-09-24 John Camelon
Added testBug43375() to CompleteParseASTTest.
Moved testConditionalExpressionWithReferencesB_Bug43106 from failed tests to passed tests.
Index: parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTExpressionTest.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTExpressionTest.java,v
retrieving revision 1.8
diff -u -r1.8 CompleteParseASTExpressionTest.java
--- parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTExpressionTest.java 24 Sep 2003 17:26:38 -0000 1.8
+++ parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTExpressionTest.java 25 Sep 2003 13:24:45 -0000
@@ -199,24 +199,14 @@
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
Index: parser/ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/ChangeLog,v
retrieving revision 1.136
diff -u -r1.136 ChangeLog
--- parser/ChangeLog 24 Sep 2003 17:26:45 -0000 1.136
+++ parser/ChangeLog 25 Sep 2003 13:20:49 -0000
@@ -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
Index: parser/org/eclipse/cdt/internal/core/parser/Parser.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java,v
retrieving revision 1.113
diff -u -r1.113 Parser.java
--- parser/org/eclipse/cdt/internal/core/parser/Parser.java 24 Sep 2003 17:26:45 -0000 1.113
+++ parser/org/eclipse/cdt/internal/core/parser/Parser.java 25 Sep 2003 13:20:54 -0000
@@ -4082,8 +4082,45 @@
switch (LT(1))
{
case IToken.t_typename :
- consume(); //TODO: the rest of this
- break;
+ 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 :
firstExpression =
@@ -4224,7 +4261,7 @@
break;
case IToken.tLPAREN :
// function call
- consume();
+ consume(IToken.tLPAREN);
secondExpression = expression(scope);
consume(IToken.tRPAREN);
try