Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Solution to bug#43679


Core:
        Solution to bug#43679 : Exceptions in indexer
Tests:
        -Added testBug43679_A() & testBug43679_B() to CompleteParseASTTest
        -Renamed FailedCompleteParseASTExpressionTest to FailedCompleteParseASTTest
        -Added FailedCompleteParseASTTest::testBug43503()




Thanks,
Hoda Amer
Staff Software Engineer
Rational Software - IBM Software Group

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/ChangeLog,v
retrieving revision 1.121
diff -u -r1.121 ChangeLog
--- ChangeLog	29 Sep 2003 19:49:19 -0000	1.121
+++ ChangeLog	29 Sep 2003 21:23:38 -0000
@@ -1,3 +1,8 @@
+2003-09-29 Hoda Amer
+	-Added testBug43679_A() & testBug43679_B() to CompleteParseASTTest
+	-Renamed FailedCompleteParseASTExpressionTest to FailedCompleteParseASTTest
+	-Added FailedCompleteParseASTTest::testBug43503()
+
 2003-09-29 Andrew Niefer
 	added testbug43834() to ParserSymbolTableTest
 
Index: failures/org/eclipse/cdt/core/parser/failedTests/FailedCompleteParseASTExpressionTest.java
===================================================================
RCS file: failures/org/eclipse/cdt/core/parser/failedTests/FailedCompleteParseASTExpressionTest.java
diff -N failures/org/eclipse/cdt/core/parser/failedTests/FailedCompleteParseASTExpressionTest.java
--- failures/org/eclipse/cdt/core/parser/failedTests/FailedCompleteParseASTExpressionTest.java	24 Sep 2003 17:26:38 -0000	1.7
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,118 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2002,2003 Rational Software Corporation and others.
- * All rights reserved.   This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- * 
- * Contributors: 
- * IBM Rational Software - Initial API and implementation
-***********************************************************************/
-package org.eclipse.cdt.core.parser.failedTests;
-
-import java.util.Iterator;
-
-import org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
-import org.eclipse.cdt.core.parser.ast.IASTFunction;
-import org.eclipse.cdt.core.parser.ast.IASTMethod;
-import org.eclipse.cdt.core.parser.ast.IASTReference;
-import org.eclipse.cdt.core.parser.ast.IASTVariable;
-import org.eclipse.cdt.core.parser.tests.CompleteParseBaseTest;
-
-/**
- * @author jcamelon
- *
- */
-public class FailedCompleteParseASTExpressionTest extends CompleteParseBaseTest
-{
-    /**
-     * 
-     */
-    public FailedCompleteParseASTExpressionTest()
-    {
-        super();
-    }
-    /**
-     * @param name
-     */
-    public FailedCompleteParseASTExpressionTest(String name)
-    {
-        super(name);
-    }
-	
-	public void testPMDotStarPointerToMemberFunction_Bug43242() throws Exception
-	{
-		Iterator i = parse ("class A { int m(int); }; \n A a; int A::*pm = &A::m; \n int f(){} \n int f(int); \n int x = f((a.*pm)(5));").getDeclarations();
-		IASTClassSpecifier cl = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
-		Iterator members = getDeclarations(cl);
-		IASTMethod method = (IASTMethod)members.next();
-		IASTVariable a  = (IASTVariable) i.next();
-		IASTVariable pm  = (IASTVariable) i.next();
-		IASTFunction f1 = (IASTFunction) i.next();
-		IASTFunction f2 = (IASTFunction) i.next();
-		IASTVariable x  = (IASTVariable) i.next();
-
-		assertAllReferences( 5 /* should be 8 */, 
-			createTaskList( new Task( cl, 2 /* should be 3 */ ), new Task( method ), new Task( a ), new Task( pm ) /* should be ,new Task( f2 ) */  
-				));	
-	}
-	public void testPMArrowStarPointerToMemberFunction_Bug43242() throws Exception
-	{
-		Iterator i = parse ("class A { int m(int); }; \n A * a; int A::*pm = &A::m; \n int f(){} \n int f(int); \n int x = f((a->*pm)(5));").getDeclarations();
-		IASTClassSpecifier cl = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
-		Iterator members = getDeclarations(cl);
-		IASTMethod method = (IASTMethod)members.next();
-		IASTVariable a  = (IASTVariable) i.next();
-		IASTVariable pm  = (IASTVariable) i.next();
-		IASTFunction f1 = (IASTFunction) i.next();
-		IASTFunction f2 = (IASTFunction) i.next();
-		IASTVariable x  = (IASTVariable) i.next();
-		
-		assertAllReferences( 5 /*  should be more */,
-			createTaskList( new Task( cl, 2 ), new Task( method ), new Task( a /*, 2 */), new Task( pm  )/* ,new Task( f2 )*/));
-		
-	}  
-	public void testUnaryStarCastexpressionPointerToFunction_Bug43241() throws Exception
-	{
-		Iterator i = parse ("int m(int); \n int *pm = &m; \n int f(){} \n int f(int); \n int x = f((*pm)(5));").getDeclarations();
-		IASTFunction m = (IASTFunction) i.next();
-		IASTVariable pm  = (IASTVariable) i.next();
-		IASTFunction f1 = (IASTFunction) i.next();
-		IASTFunction f2 = (IASTFunction) i.next();
-		IASTVariable x  = (IASTVariable) i.next();
-		assertAllReferences( 2 /* should be 3 */, 
-			createTaskList( new Task( m ), new Task( pm ) /* ,new Task( f2 )*/));
-	}
-	
-	// Kind DELETE_CASTEXPRESSION        
-	// Kind DELETE_VECTORCASTEXPRESSION  
-	// Kind CASTEXPRESSION               
-	// Kind PM_DOTSTAR                   
-	public void testPMDotStar_bug43579() throws Exception
-	{
-		Iterator i = parse ("class A { int m; }; \n A a; int A::*pm; \n int f(){} \n int f(int); \n int x = f(a.*pm);").getDeclarations();
-		IASTClassSpecifier cl = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
-		IASTVariable a  = (IASTVariable) i.next();
-		IASTVariable pm  = (IASTVariable) i.next();
-		IASTFunction f1 = (IASTFunction) i.next();
-		IASTFunction f2 = (IASTFunction) i.next();
-		IASTVariable x  = (IASTVariable) i.next();
-		assertFalse( i.hasNext() );
-		assertAllReferences( 4 /*should be 5 */, createTaskList( new Task( cl /* , 2 */ ), new Task( a), new Task( pm), new Task( f2)));
-	}
-
-	// Kind PM_ARROWSTAR          
-	public void testPMArrowStar_bug43579() throws Exception
-	{
-		Iterator i = parse ("class A { int m; }; \n A * a; int A::*pm; \n int f(){} \n int f(int); \n int x = f(a->*pm);").getDeclarations();
-		IASTClassSpecifier cl = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
-		IASTVariable a  = (IASTVariable) i.next();
-		IASTVariable pm  = (IASTVariable) i.next();
-		IASTFunction f1 = (IASTFunction) i.next();
-		IASTFunction f2 = (IASTFunction) i.next();
-		IASTVariable x  = (IASTVariable) i.next();
-		assertFalse( i.hasNext() );
-		assertAllReferences( 4 /*should be 5 */, createTaskList( new Task( cl /* , 2 */ ), new Task( a), new Task( pm), new Task( f2)));
-	}
-}
Index: failures/org/eclipse/cdt/core/parser/failedTests/FailedCompleteParseASTTest.java
===================================================================
RCS file: failures/org/eclipse/cdt/core/parser/failedTests/FailedCompleteParseASTTest.java
diff -N failures/org/eclipse/cdt/core/parser/failedTests/FailedCompleteParseASTTest.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ failures/org/eclipse/cdt/core/parser/failedTests/FailedCompleteParseASTTest.java	29 Sep 2003 21:23:39 -0000
@@ -0,0 +1,133 @@
+/**********************************************************************
+ * Copyright (c) 2002,2003 Rational Software Corporation and others.
+ * All rights reserved.   This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ * 
+ * Contributors: 
+ * IBM Rational Software - Initial API and implementation
+***********************************************************************/
+package org.eclipse.cdt.core.parser.failedTests;
+
+import java.util.Iterator;
+
+import org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration;
+import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
+import org.eclipse.cdt.core.parser.ast.IASTFunction;
+import org.eclipse.cdt.core.parser.ast.IASTMethod;
+import org.eclipse.cdt.core.parser.ast.IASTVariable;
+import org.eclipse.cdt.core.parser.tests.CompleteParseBaseTest;
+
+/**
+ * @author jcamelon
+ *
+ */
+public class FailedCompleteParseASTTest extends CompleteParseBaseTest
+{
+    /**
+     * 
+     */
+    public FailedCompleteParseASTTest()
+    {
+        super();
+    }
+    /**
+     * @param name
+     */
+    public FailedCompleteParseASTTest(String name)
+    {
+        super(name);
+    }
+	
+	public void testPMDotStarPointerToMemberFunction_Bug43242() throws Exception
+	{
+		Iterator i = parse ("class A { int m(int); }; \n A a; int A::*pm = &A::m; \n int f(){} \n int f(int); \n int x = f((a.*pm)(5));").getDeclarations();
+		IASTClassSpecifier cl = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
+		Iterator members = getDeclarations(cl);
+		IASTMethod method = (IASTMethod)members.next();
+		IASTVariable a  = (IASTVariable) i.next();
+		IASTVariable pm  = (IASTVariable) i.next();
+		IASTFunction f1 = (IASTFunction) i.next();
+		IASTFunction f2 = (IASTFunction) i.next();
+		IASTVariable x  = (IASTVariable) i.next();
+
+		assertAllReferences( 5 /* should be 8 */, 
+			createTaskList( new Task( cl, 2 /* should be 3 */ ), new Task( method ), new Task( a ), new Task( pm ) /* should be ,new Task( f2 ) */  
+				));	
+	}
+	public void testPMArrowStarPointerToMemberFunction_Bug43242() throws Exception
+	{
+		Iterator i = parse ("class A { int m(int); }; \n A * a; int A::*pm = &A::m; \n int f(){} \n int f(int); \n int x = f((a->*pm)(5));").getDeclarations();
+		IASTClassSpecifier cl = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
+		Iterator members = getDeclarations(cl);
+		IASTMethod method = (IASTMethod)members.next();
+		IASTVariable a  = (IASTVariable) i.next();
+		IASTVariable pm  = (IASTVariable) i.next();
+		IASTFunction f1 = (IASTFunction) i.next();
+		IASTFunction f2 = (IASTFunction) i.next();
+		IASTVariable x  = (IASTVariable) i.next();
+		
+		assertAllReferences( 5 /*  should be more */,
+			createTaskList( new Task( cl, 2 ), new Task( method ), new Task( a /*, 2 */), new Task( pm  )/* ,new Task( f2 )*/));
+		
+	}  
+	public void testUnaryStarCastexpressionPointerToFunction_Bug43241() throws Exception
+	{
+		Iterator i = parse ("int m(int); \n int *pm = &m; \n int f(){} \n int f(int); \n int x = f((*pm)(5));").getDeclarations();
+		IASTFunction m = (IASTFunction) i.next();
+		IASTVariable pm  = (IASTVariable) i.next();
+		IASTFunction f1 = (IASTFunction) i.next();
+		IASTFunction f2 = (IASTFunction) i.next();
+		IASTVariable x  = (IASTVariable) i.next();
+		assertAllReferences( 2 /* should be 3 */, 
+			createTaskList( new Task( m ), new Task( pm ) /* ,new Task( f2 )*/));
+	}
+	
+	// Kind DELETE_CASTEXPRESSION        
+	// Kind DELETE_VECTORCASTEXPRESSION  
+	// Kind CASTEXPRESSION               
+	// Kind PM_DOTSTAR                   
+	public void testPMDotStar_bug43579() throws Exception
+	{
+		Iterator i = parse ("class A { int m; }; \n A a; int A::*pm; \n int f(){} \n int f(int); \n int x = f(a.*pm);").getDeclarations();
+		IASTClassSpecifier cl = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
+		IASTVariable a  = (IASTVariable) i.next();
+		IASTVariable pm  = (IASTVariable) i.next();
+		IASTFunction f1 = (IASTFunction) i.next();
+		IASTFunction f2 = (IASTFunction) i.next();
+		IASTVariable x  = (IASTVariable) i.next();
+		assertFalse( i.hasNext() );
+		assertAllReferences( 4 /*should be 5 */, createTaskList( new Task( cl /* , 2 */ ), new Task( a), new Task( pm), new Task( f2)));
+	}
+
+	// Kind PM_ARROWSTAR          
+	public void testPMArrowStar_bug43579() throws Exception
+	{
+		Iterator i = parse ("class A { int m; }; \n A * a; int A::*pm; \n int f(){} \n int f(int); \n int x = f(a->*pm);").getDeclarations();
+		IASTClassSpecifier cl = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
+		IASTVariable a  = (IASTVariable) i.next();
+		IASTVariable pm  = (IASTVariable) i.next();
+		IASTFunction f1 = (IASTFunction) i.next();
+		IASTFunction f2 = (IASTFunction) i.next();
+		IASTVariable x  = (IASTVariable) i.next();
+		assertFalse( i.hasNext() );
+		assertAllReferences( 4 /*should be 5 */, createTaskList( new Task( cl /* , 2 */ ), new Task( a), new Task( pm), new Task( f2)));
+	}
+	
+	public void testBug43503 () throws Exception {
+		Iterator i = parse("class SD_01 { f_SD_01() {}}; int main(){ SD_01 * a = new SD_01(); a->f_SD_01();	} ").getDeclarations();
+		IASTClassSpecifier classA = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
+		Iterator j = getDeclarations(classA);
+		IASTMethod f = (IASTMethod)j.next();
+		assertFalse(j.hasNext());
+		IASTFunction main = (IASTFunction) i.next();
+		assertFalse(i.hasNext());
+		Iterator k = getDeclarations(main);
+		
+		assertFalse(k.hasNext()); // this should be true, there is one declaration of "a"
+		// "a" is found to be in a multiplication expression, not a declaration
+		// not knowing "a" causes us to not find the reference to "f"
+		
+	}	
+}
Index: parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java,v
retrieving revision 1.35
diff -u -r1.35 CompleteParseASTTest.java
--- parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java	29 Sep 2003 19:21:57 -0000	1.35
+++ parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java	29 Sep 2003 21:23:39 -0000
@@ -31,6 +31,7 @@
 import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification;
 import org.eclipse.cdt.core.parser.ast.IASTMethod;
 import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
+import org.eclipse.cdt.core.parser.ast.IASTOffsetableElement;
 import org.eclipse.cdt.core.parser.ast.IASTReference;
 import org.eclipse.cdt.core.parser.ast.IASTScope;
 import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier;
@@ -855,5 +856,41 @@
 		IASTVariable b = (IASTVariable)i.next();
 		assertEquals( b.getName(), "b");
 		assertFalse(i.hasNext());
+	}
+	
+	public void testBug43679_A () throws Exception
+	{
+		try{ // this used to throw a null pointer exception 
+			Iterator i = parse( "struct Sample { int size() const; }; extern const Sample * getSample(); int trouble() {  return getSample()->size(); } ", false ).getDeclarations();
+			IASTClassSpecifier A = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
+			Iterator j = getDeclarations(A);
+			IASTMethod s = (IASTMethod) j.next();
+			assertFalse (j.hasNext());
+			IASTFunction g = (IASTFunction) i.next();
+			IASTFunction t = (IASTFunction) i.next();
+			assertFalse (i.hasNext());
+			Iterator ref = callback.getReferences().iterator();
+			assertAllReferences( 3, createTaskList( new Task(A) , new Task( s ) , new Task (g) ));
+	
+		} catch(Exception e){
+			fail();
+		}
+	}
+	public void testBug43679_B () throws Exception
+	{
+		try{ // this used to throw a class cast exception 
+		Iterator i = parse( "struct Sample{int size() const; }; struct Sample; ", false ).getDeclarations();
+		IASTClassSpecifier A = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
+		Iterator j = getDeclarations(A);
+		IASTMethod s = (IASTMethod) j.next();
+		assertFalse (j.hasNext());
+		IASTAbstractTypeSpecifierDeclaration forwardDecl = (IASTAbstractTypeSpecifierDeclaration)i.next();
+		assertFalse (i.hasNext());
+		Iterator ref = callback.getReferences().iterator();
+		assertFalse (ref.hasNext());
+				
+		} catch(Exception e){
+			fail();
+		}
 	}
 }
Index: suite/org/eclipse/cdt/core/suite/AutomatedIntegrationSuite.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/suite/AutomatedIntegrationSuite.java,v
retrieving revision 1.21
diff -u -r1.21 AutomatedIntegrationSuite.java
--- suite/org/eclipse/cdt/core/suite/AutomatedIntegrationSuite.java	26 Sep 2003 17:53:41 -0000	1.21
+++ suite/org/eclipse/cdt/core/suite/AutomatedIntegrationSuite.java	29 Sep 2003 21:23:39 -0000
@@ -28,7 +28,7 @@
 import org.eclipse.cdt.core.model.tests.ElementDeltaTests;
 import org.eclipse.cdt.core.model.tests.WorkingCopyTests;
 import org.eclipse.cdt.core.parser.failedTests.ASTFailedTests;
-import org.eclipse.cdt.core.parser.failedTests.FailedCompleteParseASTExpressionTest;
+import org.eclipse.cdt.core.parser.failedTests.FailedCompleteParseASTTest;
 import org.eclipse.cdt.core.parser.failedTests.STLFailedTests;
 import org.eclipse.cdt.core.parser.tests.ParserTestSuite;
 import org.eclipse.cdt.core.search.tests.SearchTestSuite;
@@ -97,7 +97,7 @@
 		suite.addTestSuite(ASTFailedTests.class);
 		suite.addTestSuite(STLFailedTests.class);
 		suite.addTestSuite(CModelElementsFailedTests.class);
-		suite.addTestSuite(FailedCompleteParseASTExpressionTest.class);
+		suite.addTestSuite(FailedCompleteParseASTTest.class);
 
 		// Last test to trigger report generation
 		suite.addTest(suite.new GenerateReport("generateReport"));
Index: parser/ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/ChangeLog,v
retrieving revision 1.142
diff -u -r1.142 ChangeLog
--- parser/ChangeLog	29 Sep 2003 19:49:13 -0000	1.142
+++ parser/ChangeLog	29 Sep 2003 21:23:19 -0000
@@ -1,3 +1,6 @@
+2003-09-29 Hoda Amer
+	Solution to bug#43679 : Exceptions in indexer 
+	
 2003-09-29 Andrew Niefer
 	fixed bug 43834 : Empty Parameter list and parameter list taking one void do not match
 
Index: parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java,v
retrieving revision 1.49
diff -u -r1.49 CompleteParseASTFactory.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java	29 Sep 2003 19:22:08 -0000	1.49
+++ parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java	29 Sep 2003 21:23:20 -0000
@@ -763,58 +763,66 @@
         IASTTypeId typeId,
         ITokenDuple idExpression, String literal, IASTNewExpressionDescriptor newDescriptor) throws ASTSemanticException
     {
-    	List references = new ArrayList(); 
-    	    	
-        //look up id & add to references
-        IContainerSymbol startingScope = scopeToSymbol( scope );
-                
-        //look up typeId & add to references
-		ISymbol symbol = null;
-
-        if( idExpression != null )
-        	symbol = lookupQualifiedName( startingScope, idExpression, references, false );
-        
-		// "a.m" or "a->m : lookup m in the scope of the declaration of a        
-		if((kind == IASTExpression.Kind.POSTFIX_DOT_IDEXPRESSION) 
-		|| (kind == IASTExpression.Kind.POSTFIX_ARROW_IDEXPRESSION)
-		|| (kind == IASTExpression.Kind.POSTFIX_DOT_TEMPL_IDEXPRESS)
-		|| (kind == IASTExpression.Kind.POSTFIX_ARROW_TEMPL_IDEXP)		
-		|| (kind == IASTExpression.Kind.PM_DOTSTAR)
-		|| (kind == IASTExpression.Kind.PM_ARROWSTAR)
-		){
-			TypeInfo lhsInfo = (TypeInfo) ((ASTExpression)lhs).getResultType().iterator().next();
-			ISymbol containingScope = (ISymbol) lhsInfo.getTypeSymbol().getTypeSymbol();
-			if(containingScope != null){
-				symbol = lookupQualifiedName((IContainerSymbol)containingScope, ((ASTExpression)rhs).getIdExpressionTokenDuple(), references, false);
+    	try{
+	    	List references = new ArrayList(); 
+	    	    	
+	        //look up id & add to references
+	        IContainerSymbol startingScope = scopeToSymbol( scope );
+	                
+	        //look up typeId & add to references
+			ISymbol symbol = null;
+	
+	        if( idExpression != null )
+	        	symbol = lookupQualifiedName( startingScope, idExpression, references, false );
+	        
+			// "a.m" or "a->m : lookup m in the scope of the declaration of a        
+			if((kind == IASTExpression.Kind.POSTFIX_DOT_IDEXPRESSION) 
+			|| (kind == IASTExpression.Kind.POSTFIX_ARROW_IDEXPRESSION)
+			|| (kind == IASTExpression.Kind.POSTFIX_DOT_TEMPL_IDEXPRESS)
+			|| (kind == IASTExpression.Kind.POSTFIX_ARROW_TEMPL_IDEXP)		
+			|| (kind == IASTExpression.Kind.PM_DOTSTAR)
+			|| (kind == IASTExpression.Kind.PM_ARROWSTAR)
+			){
+				TypeInfo lhsInfo = (TypeInfo) ((ASTExpression)lhs).getResultType().iterator().next();
+				if(lhsInfo != null){
+					ISymbol firstContainingScope = (ISymbol) lhsInfo.getTypeSymbol();
+					if(firstContainingScope != null){
+						ISymbol containingScope = firstContainingScope.getTypeSymbol();
+						if(containingScope != null){
+							symbol = lookupQualifiedName((IContainerSymbol)containingScope, ((ASTExpression)rhs).getIdExpressionTokenDuple(), references, false);
+						}
+					}
+				}
 			}
-		}
-		
-		// go up the scope until you hit a class
-		if (kind == IASTExpression.Kind.PRIMARY_THIS){
-			ASTScope parentScope = (ASTScope)scope;
-			while (!(parentScope instanceof IASTClassSpecifier) )
-			{
-				parentScope = (ASTScope)((ASTScope)parentScope).getOwnerScope();
+			
+			// go up the scope until you hit a class
+			if (kind == IASTExpression.Kind.PRIMARY_THIS){
+				ASTScope parentScope = (ASTScope)scope;
+				while (!(parentScope instanceof IASTClassSpecifier) )
+				{
+					parentScope = (ASTScope)((ASTScope)parentScope).getOwnerScope();
+				}
+				if(parentScope instanceof IASTClassSpecifier)
+					symbol = parentScope.getSymbol();
 			}
-			if(parentScope instanceof IASTClassSpecifier)
-				symbol = parentScope.getSymbol();
-		}
-		
-		if (kind == IASTExpression.Kind.POSTFIX_FUNCTIONCALL){        							
-			ITokenDuple functionId = ((ASTExpression)lhs).getIdExpressionTokenDuple();
-			List parameters = ((ASTExpression)rhs).getResultType();
-			symbol = lookupQualifiedName(startingScope, functionId, TypeInfo.t_function, parameters, references, false);	        	
-		}
-        
-        ASTExpression expression =  new ASTExpression( kind, lhs, rhs, thirdExpression, 
-        							typeId,	idExpression, literal, newDescriptor, references);
-		try{       							
+			
+			if (kind == IASTExpression.Kind.POSTFIX_FUNCTIONCALL){        							
+				ITokenDuple functionId = ((ASTExpression)lhs).getIdExpressionTokenDuple();
+				List parameters = ((ASTExpression)rhs).getResultType();
+				symbol = lookupQualifiedName(startingScope, functionId, TypeInfo.t_function, parameters, references, false);	        	
+			}
+	        
+	        ASTExpression expression =  new ASTExpression( kind, lhs, rhs, thirdExpression, 
+	        							typeId,	idExpression, literal, newDescriptor, references);
+	
 			expression.setResultType (getExpressionResultType(expression, symbol));
+
+			return expression;
+			
 		}catch (ASTSemanticException e){
 			throw e;
 		}
         							
-        return expression;
     }
     /*
      * Conditional Expression conversion
@@ -1228,6 +1236,7 @@
 					IParameterizedSymbol psymbol = (IParameterizedSymbol) symbol;
 					ISymbol returnTypeSymbol = psymbol.getReturnType();
 					info.setType(returnTypeSymbol.getType());  
+					info.setTypeSymbol(returnTypeSymbol);
 				}
 				result.add(info);
 				return result;
@@ -2272,29 +2281,27 @@
                 	throw new ASTSemanticException();
                 }
 			}
-			return (IASTElaboratedTypeSpecifier)checkSymbol.getASTExtension().getPrimaryDeclaration();
  		}
-		else
-		{	
-			if( checkSymbol.getASTExtension().getPrimaryDeclaration() instanceof IASTClassSpecifier ||
-			    checkSymbol.getASTExtension().getPrimaryDeclaration() instanceof IASTEnumerationSpecifier 
-			)
+ 		
+		if( checkSymbol.getASTExtension().getPrimaryDeclaration() instanceof IASTClassSpecifier ||
+		    checkSymbol.getASTExtension().getPrimaryDeclaration() instanceof IASTEnumerationSpecifier 
+		)
+		{
+			ASTElaboratedTypeSpecifier elab = new ASTElaboratedTypeSpecifier( checkSymbol, kind, startingOffset, name.getFirstToken().getOffset(), name.getLastToken().getEndOffset(), endOffset, references, isForewardDecl );
+			try
 			{
-				ASTElaboratedTypeSpecifier elab = new ASTElaboratedTypeSpecifier( checkSymbol, kind, startingOffset, name.getFirstToken().getOffset(), name.getLastToken().getEndOffset(), endOffset, references, isForewardDecl );
-				try
-				{
-					attachSymbolExtension( checkSymbol, elab );
-				}
-				catch (ExtensionException e2)
-				{
-					throw new ASTSemanticException();
-				}
-				return elab;
+				attachSymbolExtension( checkSymbol, elab );
 			}
-			if( checkSymbol.getASTExtension().getPrimaryDeclaration() instanceof IASTElaboratedTypeSpecifier )
-				return (IASTElaboratedTypeSpecifier)checkSymbol.getASTExtension().getPrimaryDeclaration();
-	
+			catch (ExtensionException e2)
+			{
+				throw new ASTSemanticException();
+			}
+			return elab;
 		}
+		
+		if( checkSymbol.getASTExtension().getPrimaryDeclaration() instanceof IASTElaboratedTypeSpecifier )
+			return (IASTElaboratedTypeSpecifier)checkSymbol.getASTExtension().getPrimaryDeclaration();
+	
 		
 		throw new ASTSemanticException();
     }

Back to the top