Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Applied [HEAD] Constructor chains and initializers X-Ref support

CORE
        Added constructor expression support for variables. 
        Added constructor chain x-reference support for methods. 

TESTS
        Added testBug41520() to FullParseFailedTests.java. 
        Added testConstructorChain() to CompleteParseASTTest.java

JohnC

Index: parser/ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/ChangeLog,v
retrieving revision 1.99
diff -u -r1.99 ChangeLog
--- parser/ChangeLog	13 Aug 2003 21:51:48 -0000	1.99
+++ parser/ChangeLog	13 Aug 2003 23:53:28 -0000
@@ -1,4 +1,8 @@
 2003-08-13 John Camelon
+	Added constructor expression support for variables.  
+	Added constructor chain x-reference support for methods. 
+
+2003-08-13 John Camelon
 	Added Expression x-reference support into Parser.
 
 2003-08-12 John Camelon
Index: parser/org/eclipse/cdt/core/parser/ast/IASTConstructorMemberInitializer.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTConstructorMemberInitializer.java,v
retrieving revision 1.1
diff -u -r1.1 IASTConstructorMemberInitializer.java
--- parser/org/eclipse/cdt/core/parser/ast/IASTConstructorMemberInitializer.java	30 Jun 2003 22:08:38 -0000	1.1
+++ parser/org/eclipse/cdt/core/parser/ast/IASTConstructorMemberInitializer.java	13 Aug 2003 23:53:28 -0000
@@ -10,11 +10,13 @@
 ***********************************************************************/
 package org.eclipse.cdt.core.parser.ast;
 
+import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate;
+
 /**
  * @author jcamelon
  *
  */
-public interface IASTConstructorMemberInitializer
+public interface IASTConstructorMemberInitializer extends ISourceElementCallbackDelegate
 {
 	public IASTExpression getExpressionList(); 
 	public String getName();
Index: parser/org/eclipse/cdt/core/parser/ast/IASTFactory.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTFactory.java,v
retrieving revision 1.21
diff -u -r1.21 IASTFactory.java
--- parser/org/eclipse/cdt/core/parser/ast/IASTFactory.java	13 Aug 2003 21:51:48 -0000	1.21
+++ parser/org/eclipse/cdt/core/parser/ast/IASTFactory.java	13 Aug 2003 23:53:28 -0000
@@ -113,8 +113,8 @@
      * @return
      */
     public IASTConstructorMemberInitializer createConstructorMemberInitializer(
-        ITokenDuple duple,
-        IASTExpression expressionList);
+        IASTScope scope,
+        ITokenDuple duple, IASTExpression expressionList) throws ASTSemanticException;
     public IASTSimpleTypeSpecifier createSimpleTypeSpecifier(
         IASTScope scope,
         IASTSimpleTypeSpecifier.Type kind,
@@ -159,12 +159,12 @@
         boolean isVirtual,
         boolean isExplicit,
         boolean isPureVirtual,
-        ASTAccessVisibility visibility) throws ASTSemanticException;
+        ASTAccessVisibility visibility, List constructorChain) throws ASTSemanticException;
         
 	public IASTVariable createVariable(IASTScope scope, String name, boolean isAuto, IASTInitializerClause initializerClause, IASTExpression bitfieldExpression, 
-		   IASTAbstractDeclaration abstractDeclaration, boolean isMutable, boolean isExtern, boolean isRegister, boolean isStatic, int startingOffset, int nameOffset ) throws ASTSemanticException;
+		   IASTAbstractDeclaration abstractDeclaration, boolean isMutable, boolean isExtern, boolean isRegister, boolean isStatic, int startingOffset, int nameOffset, IASTExpression constructorExpression ) throws ASTSemanticException;
 		   
-	public IASTField createField( IASTScope scope, String name, boolean isAuto, IASTInitializerClause initializerClause, IASTExpression bitfieldExpression, IASTAbstractDeclaration abstractDeclaration, boolean isMutable, boolean isExtern, boolean isRegister, boolean isStatic, int startingOffset, int nameOffset, ASTAccessVisibility visibility) throws ASTSemanticException;
+	public IASTField createField( IASTScope scope, String name, boolean isAuto, IASTInitializerClause initializerClause, IASTExpression bitfieldExpression, IASTAbstractDeclaration abstractDeclaration, boolean isMutable, boolean isExtern, boolean isRegister, boolean isStatic, int startingOffset, int nameOffset, IASTExpression constructorExpression, ASTAccessVisibility visibility) throws ASTSemanticException;
 	
 	public IASTParameterDeclaration createParameterDeclaration( boolean isConst, boolean isVolatile, IASTTypeSpecifier getTypeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp, String parameterName, IASTInitializerClause initializerClause );
 	
Index: parser/org/eclipse/cdt/core/parser/ast/IASTMethod.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTMethod.java,v
retrieving revision 1.5
diff -u -r1.5 IASTMethod.java
--- parser/org/eclipse/cdt/core/parser/ast/IASTMethod.java	18 Jul 2003 16:39:22 -0000	1.5
+++ parser/org/eclipse/cdt/core/parser/ast/IASTMethod.java	13 Aug 2003 23:53:28 -0000
@@ -10,6 +10,8 @@
 ***********************************************************************/
 package org.eclipse.cdt.core.parser.ast;
 
+import java.util.Iterator;
+
 
 /**
  * @author jcamelon
@@ -27,5 +29,5 @@
 	public boolean isVolatile(); 
 	public boolean isPureVirtual(); 
 	
-
+	public Iterator getConstructorChainInitializers();
 }
Index: parser/org/eclipse/cdt/core/parser/ast/IASTVariable.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTVariable.java,v
retrieving revision 1.7
diff -u -r1.7 IASTVariable.java
--- parser/org/eclipse/cdt/core/parser/ast/IASTVariable.java	18 Jul 2003 16:39:22 -0000	1.7
+++ parser/org/eclipse/cdt/core/parser/ast/IASTVariable.java	13 Aug 2003 23:53:28 -0000
@@ -29,4 +29,5 @@
 	
 	public boolean isBitfield(); 
 	public IASTExpression getBitfieldExpression(); 
+	public IASTExpression getConstructorExpression();
 }
Index: parser/org/eclipse/cdt/internal/core/parser/DeclarationWrapper.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/DeclarationWrapper.java,v
retrieving revision 1.14
diff -u -r1.14 DeclarationWrapper.java
--- parser/org/eclipse/cdt/internal/core/parser/DeclarationWrapper.java	12 Aug 2003 18:19:38 -0000	1.14
+++ parser/org/eclipse/cdt/internal/core/parser/DeclarationWrapper.java	13 Aug 2003 23:53:28 -0000
@@ -381,7 +381,7 @@
 					name,
 					abs, getStartingOffset(), d.getNameStartOffset() ); 
         	else
-        		return astFactory.createVariable( scope, name, auto, d.getInitializerClause(), d.getBitFieldExpression(), abs, mutable, extern, register, staticc, getStartingOffset(), d.getNameStartOffset() );
+        		return astFactory.createVariable( scope, name, auto, d.getInitializerClause(), d.getBitFieldExpression(), abs, mutable, extern, register, staticc, getStartingOffset(), d.getNameStartOffset(), d.getConstructorExpression() );
         	
         }
         else
@@ -437,7 +437,7 @@
         virtual,
             explicit,
             declarator.isPureVirtual(),
-            ((IASTClassSpecifier)scope).getCurrentVisibilityMode());
+            ((IASTClassSpecifier)scope).getCurrentVisibilityMode(), declarator.getConstructorMemberInitializers());
     }
     /**
      * @param declarator
@@ -485,7 +485,7 @@
             staticc,
             startingOffset,
             declarator.getNameStartOffset(),
-            ((IASTClassSpecifier)scope).getCurrentVisibilityMode());
+            declarator.getConstructorExpression(), ((IASTClassSpecifier)scope).getCurrentVisibilityMode());
     }
     private List createParameterList(List currentParameters)
     {
@@ -534,7 +534,7 @@
             register,
             staticc,
             getStartingOffset(),
-            declarator.getNameStartOffset());
+            declarator.getNameStartOffset(), declarator.getConstructorExpression());
     }        
     
     /* (non-Javadoc)
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.90
diff -u -r1.90 Parser.java
--- parser/org/eclipse/cdt/internal/core/parser/Parser.java	13 Aug 2003 21:51:48 -0000	1.90
+++ parser/org/eclipse/cdt/internal/core/parser/Parser.java	13 Aug 2003 23:53:30 -0000
@@ -972,10 +972,18 @@
 
                 consume(IToken.tRPAREN);
 
-                d.addConstructorMemberInitializer(
-                    astFactory.createConstructorMemberInitializer(
-                        duple,
-                        expressionList));
+                try
+                {
+                    d.addConstructorMemberInitializer(
+                        astFactory.createConstructorMemberInitializer(
+                            d.getDeclarationWrapper().getScope(),
+                            duple, expressionList));
+                }
+                catch (ASTSemanticException e)
+                {
+                    failParse();
+                    throw backtrack;
+                }
                 if (LT(1) == IToken.tLBRACE)
                     break;
                 consume(IToken.tCOMMA);
Index: parser/org/eclipse/cdt/internal/core/parser/ast/ASTInitializerClause.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTInitializerClause.java,v
retrieving revision 1.1
diff -u -r1.1 ASTInitializerClause.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/ASTInitializerClause.java	13 Aug 2003 21:51:48 -0000	1.1
+++ parser/org/eclipse/cdt/internal/core/parser/ast/ASTInitializerClause.java	13 Aug 2003 23:53:30 -0000
@@ -44,35 +44,6 @@
 		return kind;
 	}
 
-	public static class EmptyIterator implements Iterator 
-	{
-
-        /* (non-Javadoc)
-         * @see java.util.Iterator#hasNext()
-         */
-        public boolean hasNext()
-        {
-            return false;
-        }
-
-        /* (non-Javadoc)
-         * @see java.util.Iterator#next()
-         */
-        public Object next()
-        {
-            throw new NoSuchElementException();
-        }
-
-        /* (non-Javadoc)
-         * @see java.util.Iterator#remove()
-         */
-        public void remove()
-        {
-			throw new UnsupportedOperationException();          
-        }
-		
-	}
-
 	/* (non-Javadoc)
 	 * @see org.eclipse.cdt.core.parser.ast.IASTInitializerClause#getInitializerList()
 	 */
Index: parser/org/eclipse/cdt/internal/core/parser/ast/EmptyIterator.java
===================================================================
RCS file: parser/org/eclipse/cdt/internal/core/parser/ast/EmptyIterator.java
diff -N parser/org/eclipse/cdt/internal/core/parser/ast/EmptyIterator.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ parser/org/eclipse/cdt/internal/core/parser/ast/EmptyIterator.java	13 Aug 2003 23:53:30 -0000
@@ -0,0 +1,44 @@
+/**********************************************************************
+ * 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.internal.core.parser.ast;
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+
+public class EmptyIterator implements Iterator 
+{
+
+    /* (non-Javadoc)
+     * @see java.util.Iterator#hasNext()
+     */
+    public boolean hasNext()
+    {
+        return false;
+    }
+
+    /* (non-Javadoc)
+     * @see java.util.Iterator#next()
+     */
+    public Object next()
+    {
+        throw new NoSuchElementException();
+    }
+
+    /* (non-Javadoc)
+     * @see java.util.Iterator#remove()
+     */
+    public void remove()
+    {
+		throw new UnsupportedOperationException();          
+    }
+	
+}
\ No newline at end of file
Index: parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTConstructorMemberInitializer.java
===================================================================
RCS file: parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTConstructorMemberInitializer.java
diff -N parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTConstructorMemberInitializer.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTConstructorMemberInitializer.java	13 Aug 2003 23:53:30 -0000
@@ -0,0 +1,71 @@
+/**********************************************************************
+ * 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.internal.core.parser.ast.complete;
+
+import java.util.List;
+
+import org.eclipse.cdt.core.parser.ISourceElementRequestor;
+import org.eclipse.cdt.core.parser.ast.IASTConstructorMemberInitializer;
+import org.eclipse.cdt.core.parser.ast.IASTExpression;
+
+/**
+ * @author jcamelon
+ *
+ */
+public class ASTConstructorMemberInitializer
+    implements IASTConstructorMemberInitializer
+{
+    private final String name;
+    private final IASTExpression expression;
+    private final ASTReferenceStore store;
+    /**
+     * 
+     */
+    public ASTConstructorMemberInitializer( IASTExpression expression, String name, List references )
+    {
+    	this.expression = expression;
+    	this.name = name; 
+    	store = new ASTReferenceStore( references );
+    }
+    /* (non-Javadoc)
+     * @see org.eclipse.cdt.core.parser.ast.IASTConstructorMemberInitializer#getExpressionList()
+     */
+    public IASTExpression getExpressionList()
+    {
+        return expression;
+    }
+    /* (non-Javadoc)
+     * @see org.eclipse.cdt.core.parser.ast.IASTConstructorMemberInitializer#getName()
+     */
+    public String getName()
+    {
+        return name;
+    }
+    /* (non-Javadoc)
+     * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
+     */
+    public void acceptElement(ISourceElementRequestor requestor)
+    {
+        store.processReferences( requestor );
+    }
+    /* (non-Javadoc)
+     * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
+     */
+    public void enterScope(ISourceElementRequestor requestor)
+    {
+    }
+    /* (non-Javadoc)
+     * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
+     */
+    public void exitScope(ISourceElementRequestor requestor)
+    {
+    }
+}
Index: parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTExpression.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTExpression.java,v
retrieving revision 1.1
diff -u -r1.1 ASTExpression.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTExpression.java	13 Aug 2003 21:51:48 -0000	1.1
+++ parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTExpression.java	13 Aug 2003 23:53:30 -0000
@@ -120,8 +120,11 @@
      */
     public void acceptElement(ISourceElementRequestor requestor)
     {
-    	ASTReferenceStore store = new ASTReferenceStore( references );
-    	store.processReferences(requestor);
+    	if( ! references.isEmpty() )
+    	{
+	    	ASTReferenceStore store = new ASTReferenceStore( references );
+	    	store.processReferences(requestor);
+    	}
     }
     /* (non-Javadoc)
      * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
Index: parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTField.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTField.java,v
retrieving revision 1.2
diff -u -r1.2 ASTField.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTField.java	13 Aug 2003 21:51:48 -0000	1.2
+++ parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTField.java	13 Aug 2003 23:53:30 -0000
@@ -37,9 +37,9 @@
      * @param references
      * @param visibility
      */
-    public ASTField(ISymbol newSymbol, IASTAbstractDeclaration abstractDeclaration, IASTInitializerClause initializerClause, IASTExpression bitfieldExpression, int startingOffset, int nameOffset, List references, ASTAccessVisibility visibility)
+    public ASTField(ISymbol newSymbol, IASTAbstractDeclaration abstractDeclaration, IASTInitializerClause initializerClause, IASTExpression bitfieldExpression, int startingOffset, int nameOffset, List references, IASTExpression constructorExpression, ASTAccessVisibility visibility)
     {
-        super( newSymbol, abstractDeclaration, initializerClause, bitfieldExpression, startingOffset, nameOffset, references );
+        super( newSymbol, abstractDeclaration, initializerClause, bitfieldExpression, startingOffset, nameOffset, references, constructorExpression );
         this.visibility = visibility;  
         
     }
Index: parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTMethod.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTMethod.java,v
retrieving revision 1.3
diff -u -r1.3 ASTMethod.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTMethod.java	13 Aug 2003 21:51:48 -0000	1.3
+++ parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTMethod.java	13 Aug 2003 23:53:30 -0000
@@ -10,14 +10,17 @@
 ***********************************************************************/
 package org.eclipse.cdt.internal.core.parser.ast.complete;
 
+import java.util.Iterator;
 import java.util.List;
 
 import org.eclipse.cdt.core.parser.ISourceElementRequestor;
 import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
 import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
+import org.eclipse.cdt.core.parser.ast.IASTConstructorMemberInitializer;
 import org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification;
 import org.eclipse.cdt.core.parser.ast.IASTMethod;
 import org.eclipse.cdt.core.parser.ast.IASTTemplate;
+import org.eclipse.cdt.internal.core.parser.ast.EmptyIterator;
 import org.eclipse.cdt.internal.core.parser.pst.IParameterizedSymbol;
 import org.eclipse.cdt.internal.core.parser.pst.TypeInfo;
 
@@ -27,6 +30,7 @@
  */
 public class ASTMethod extends ASTFunction implements IASTMethod
 {
+    private final List constructorChain;
     private final boolean isConstructor;
     private final boolean isPureVirtual;
     private final ASTAccessVisibility visibility;
@@ -42,7 +46,7 @@
      * @param references
      */
     public ASTMethod(IParameterizedSymbol symbol, List parameters, IASTAbstractDeclaration returnType, IASTExceptionSpecification exception, int startOffset, int nameOffset, IASTTemplate ownerTemplate, List references, 
-	boolean isConstructor, boolean isDestructor, boolean isPureVirtual, ASTAccessVisibility visibility )
+	boolean isConstructor, boolean isDestructor, boolean isPureVirtual, ASTAccessVisibility visibility, List constructorChain )
     {
         super(
             symbol,
@@ -57,7 +61,7 @@
         this.isConstructor = isConstructor;
         this.isDestructor = isDestructor;
         this.isPureVirtual = isPureVirtual; 
-        
+        this.constructorChain = constructorChain;
     }
     /* (non-Javadoc)
      * @see org.eclipse.cdt.core.parser.ast.IASTMethod#isVirtual()
@@ -124,6 +128,20 @@
         requestor.acceptMethodDeclaration(this);
         references.processReferences(requestor);
         processParameterInitializers(requestor);
+        processConstructorChain(requestor);
+    }
+    
+    protected void processConstructorChain(ISourceElementRequestor requestor)
+    {
+        if( constructorChain != null )
+        {
+        	Iterator i = getConstructorChainInitializers(); 
+        	while( i.hasNext() )
+        	{
+        		IASTConstructorMemberInitializer c = (IASTConstructorMemberInitializer)i.next();
+        		c.acceptElement(requestor);
+        	}
+        }
     }
     /* (non-Javadoc)
      * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
@@ -132,6 +150,7 @@
     {
 		requestor.enterMethodBody(this);
 		references.processReferences(requestor);
+		processConstructorChain(requestor);
     }
     /* (non-Javadoc)
      * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
@@ -139,5 +158,14 @@
     public void exitScope(ISourceElementRequestor requestor)
     {
         requestor.exitMethodBody( this );
+    }
+    /* (non-Javadoc)
+     * @see org.eclipse.cdt.core.parser.ast.IASTMethod#getConstructorChainInitializers()
+     */
+    public Iterator getConstructorChainInitializers()
+    {
+		if( constructorChain == null )
+			return new EmptyIterator(); 
+        return constructorChain.iterator();
     }
 }
Index: parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTVariable.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTVariable.java,v
retrieving revision 1.2
diff -u -r1.2 ASTVariable.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTVariable.java	13 Aug 2003 21:51:48 -0000	1.2
+++ parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTVariable.java	13 Aug 2003 23:53:30 -0000
@@ -29,7 +29,8 @@
  */
 public class ASTVariable extends ASTSymbol implements IASTVariable
 {
-	protected final ASTReferenceStore referenceDelegate;
+	private final IASTExpression constructorExpression;
+    protected final ASTReferenceStore referenceDelegate;
 	private final ASTQualifiedNamedElement qualifiedName;
 	private NamedOffsets offsets = new NamedOffsets();
     private final IASTExpression bitfieldExpression;
@@ -44,12 +45,13 @@
      * @param nameOffset
      * @param references
      */
-    public ASTVariable(ISymbol newSymbol, IASTAbstractDeclaration abstractDeclaration, IASTInitializerClause initializerClause, IASTExpression bitfieldExpression, int startingOffset, int nameOffset, List references)
+    public ASTVariable(ISymbol newSymbol, IASTAbstractDeclaration abstractDeclaration, IASTInitializerClause initializerClause, IASTExpression bitfieldExpression, int startingOffset, int nameOffset, List references, IASTExpression constructorExpression )
     {
     	super( newSymbol );
         this.abstractDeclaration = abstractDeclaration;
 		this.initializerClause = initializerClause;
 		this.bitfieldExpression = bitfieldExpression;
+		this.constructorExpression = constructorExpression;
 		setStartingOffset( startingOffset );
 		setNameOffset( nameOffset );
 		referenceDelegate = new ASTReferenceStore( references );
@@ -162,6 +164,8 @@
         referenceDelegate.processReferences(requestor);
         if( initializerClause != null )
         	initializerClause.acceptElement(requestor);
+        if( constructorExpression != null )
+        	constructorExpression.acceptElement(requestor);
     }
     /* (non-Javadoc)
      * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
@@ -202,5 +206,12 @@
     public int getEndingOffset()
     {
         return offsets.getEndingOffset();
+    }
+    /* (non-Javadoc)
+     * @see org.eclipse.cdt.core.parser.ast.IASTVariable#getConstructorExpression()
+     */
+    public IASTExpression getConstructorExpression()
+    {
+        return constructorExpression;
     }
 }
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.14
diff -u -r1.14 CompleteParseASTFactory.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java	13 Aug 2003 21:51:48 -0000	1.14
+++ parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java	13 Aug 2003 23:53:31 -0000
@@ -704,11 +704,17 @@
      * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createConstructorMemberInitializer(org.eclipse.cdt.core.parser.ITokenDuple, org.eclipse.cdt.core.parser.ast.IASTExpression)
      */
     public IASTConstructorMemberInitializer createConstructorMemberInitializer(
-        ITokenDuple duple,
-        IASTExpression expressionList)
+        IASTScope scope,
+        ITokenDuple duple, IASTExpression expressionList) throws ASTSemanticException
     {
-        // TODO Auto-generated method stub
-        return null;
+        List references = new ArrayList(); 
+        
+        IContainerSymbol scopeSymbol = scopeToSymbol(scope);
+        if( duple != null )
+        	lookupQualifiedName( scopeSymbol, duple, references, false );
+        
+        getExpressionReferences( expressionList, references ); 
+        return new ASTConstructorMemberInitializer( expressionList, duple == null ? "" : duple.toString(), references );
     }
     /* (non-Javadoc)
      * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createSimpleTypeSpecifier(org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier.Type, org.eclipse.cdt.core.parser.ITokenDuple, boolean, boolean, boolean, boolean, boolean)
@@ -1000,7 +1006,7 @@
         boolean isVirtual,
         boolean isExplicit,
         boolean isPureVirtual,
-        ASTAccessVisibility visibility) throws ASTSemanticException
+        ASTAccessVisibility visibility, List constructorChain) throws ASTSemanticException
     {
 		IContainerSymbol ownerScope = scopeToSymbol( scope );
 		IParameterizedSymbol symbol = pst.newParameterizedSymbol( name, TypeInfo.t_function );
@@ -1008,7 +1014,8 @@
 		setMethodTypeInfoBits( symbol, isConst, isVolatile, isVirtual, isExplicit );
 		List references = new ArrayList();
     	
-		setParameter( symbol, returnType, false, references );
+    	if( returnType.getTypeSpecifier() != null )
+			setParameter( symbol, returnType, false, references );
 		setParameters( symbol, references, parameters.iterator() );
     	
 		try
@@ -1020,9 +1027,7 @@
 			throw new ASTSemanticException();   
 		}
     	
-
-        
-        ASTMethod method = new ASTMethod( symbol, parameters, returnType, exception, startOffset, nameOffset, ownerTemplate, references, isConstructor, isDestructor, isPureVirtual, visibility );
+        ASTMethod method = new ASTMethod( symbol, parameters, returnType, exception, startOffset, nameOffset, ownerTemplate, references, isConstructor, isDestructor, isPureVirtual, visibility, constructorChain );
         try
         {
             attachSymbolExtension( symbol, method );
@@ -1066,7 +1071,7 @@
         boolean isRegister,
         boolean isStatic,
         int startingOffset,
-        int nameOffset) throws ASTSemanticException
+        int nameOffset, IASTExpression constructorExpression) throws ASTSemanticException
     {
 		List references = new ArrayList(); 
         ISymbol newSymbol = cloneSimpleTypeSymbol(name, abstractDeclaration, references);
@@ -1088,7 +1093,7 @@
 			// TODO Auto-generated catch block
 		}
         
-        ASTVariable variable = new ASTVariable( newSymbol, abstractDeclaration, initializerClause, bitfieldExpression, startingOffset, nameOffset, references );
+        ASTVariable variable = new ASTVariable( newSymbol, abstractDeclaration, initializerClause, bitfieldExpression, startingOffset, nameOffset, references, constructorExpression );
         try
         {
             attachSymbolExtension(newSymbol, variable );
@@ -1159,7 +1164,7 @@
         boolean isStatic,
         int startingOffset,
         int nameOffset,
-        ASTAccessVisibility visibility) throws ASTSemanticException
+        IASTExpression constructorExpression, ASTAccessVisibility visibility) throws ASTSemanticException
     {
 		List references = new ArrayList(); 
 		ISymbol newSymbol = cloneSimpleTypeSymbol(name, abstractDeclaration, references);
@@ -1182,7 +1187,7 @@
 			throw new ASTSemanticException();
 		}
 		
-		ASTField field = new ASTField( newSymbol, abstractDeclaration, initializerClause, bitfieldExpression, startingOffset, nameOffset, references, visibility );
+		ASTField field = new ASTField( newSymbol, abstractDeclaration, initializerClause, bitfieldExpression, startingOffset, nameOffset, references, constructorExpression, visibility );
 		try
 		{
 			attachSymbolExtension(newSymbol, field );
Index: parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTConstructorMemberInitializer.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTConstructorMemberInitializer.java,v
retrieving revision 1.1
diff -u -r1.1 ASTConstructorMemberInitializer.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTConstructorMemberInitializer.java	30 Jun 2003 22:08:38 -0000	1.1
+++ parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTConstructorMemberInitializer.java	13 Aug 2003 23:53:31 -0000
@@ -10,6 +10,7 @@
 ***********************************************************************/
 package org.eclipse.cdt.internal.core.parser.ast.quick;
 
+import org.eclipse.cdt.core.parser.ISourceElementRequestor;
 import org.eclipse.cdt.core.parser.ast.IASTConstructorMemberInitializer;
 import org.eclipse.cdt.core.parser.ast.IASTExpression;
 
@@ -45,5 +46,23 @@
     public String getName()
     {
         return name;
+    }
+    /* (non-Javadoc)
+     * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
+     */
+    public void acceptElement(ISourceElementRequestor requestor)
+    {
+    }
+    /* (non-Javadoc)
+     * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
+     */
+    public void enterScope(ISourceElementRequestor requestor)
+    {
+    }
+    /* (non-Javadoc)
+     * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
+     */
+    public void exitScope(ISourceElementRequestor requestor)
+    {
     }
 }
Index: parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTField.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTField.java,v
retrieving revision 1.3
diff -u -r1.3 ASTField.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTField.java	21 Jul 2003 17:29:54 -0000	1.3
+++ parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTField.java	13 Aug 2003 23:53:31 -0000
@@ -38,7 +38,7 @@
      * @param isRegister
      * @param isStatic
      */
-    public ASTField(IASTScope scope, String name, boolean isAuto, IASTInitializerClause initializerClause, IASTExpression bitfieldExpression, IASTAbstractDeclaration abstractDeclaration, boolean isMutable, boolean isExtern, boolean isRegister, boolean isStatic, int startingOffset, int nameOffset, ASTAccessVisibility visibility)
+    public ASTField(IASTScope scope, String name, boolean isAuto, IASTInitializerClause initializerClause, IASTExpression bitfieldExpression, IASTAbstractDeclaration abstractDeclaration, boolean isMutable, boolean isExtern, boolean isRegister, boolean isStatic, int startingOffset, int nameOffset, IASTExpression constructorExpression, ASTAccessVisibility visibility)
     {
         super(
             scope,
@@ -50,7 +50,7 @@
             isMutable,
             isExtern,
             isRegister,
-            isStatic, startingOffset, nameOffset);
+            isStatic, startingOffset, nameOffset, constructorExpression );
 		this.visibility = visibility; 
     }
 
Index: parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTFunction.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTFunction.java,v
retrieving revision 1.7
diff -u -r1.7 ASTFunction.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTFunction.java	22 Jul 2003 18:32:40 -0000	1.7
+++ parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTFunction.java	13 Aug 2003 23:53:31 -0000
@@ -182,7 +182,6 @@
     public void acceptElement(ISourceElementRequestor requestor)
     {
         requestor.acceptFunctionDeclaration(this);
-        
     }
     /* (non-Javadoc)
      * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enter(org.eclipse.cdt.core.parser.ISourceElementRequestor)
Index: parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTMethod.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTMethod.java,v
retrieving revision 1.4
diff -u -r1.4 ASTMethod.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTMethod.java	21 Jul 2003 17:29:54 -0000	1.4
+++ parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTMethod.java	13 Aug 2003 23:53:31 -0000
@@ -9,6 +9,7 @@
  * IBM Rational Software - Initial API and implementation
 ***********************************************************************/
 package org.eclipse.cdt.internal.core.parser.ast.quick;
+import java.util.Iterator;
 import java.util.List;
 
 import org.eclipse.cdt.core.parser.ISourceElementRequestor;
@@ -20,12 +21,14 @@
 import org.eclipse.cdt.core.parser.ast.IASTScope;
 import org.eclipse.cdt.core.parser.ast.IASTTemplate;
 import org.eclipse.cdt.internal.core.parser.ast.ASTQualifiedNamedElement;
+import org.eclipse.cdt.internal.core.parser.ast.EmptyIterator;
 /**
  * @author jcamelon
  *
  */
 public class ASTMethod extends ASTFunction implements IASTMethod
 {
+    private final List constructorChainElements;
     private final boolean isConst;
     private final boolean isDestructor;
     private final boolean isConstructor;
@@ -66,7 +69,7 @@
         boolean isDestructor,
         boolean isVirtual,
         boolean isExplicit,
-        boolean isPureVirtual, ASTAccessVisibility visibility)
+        boolean isPureVirtual, ASTAccessVisibility visibility, List constructorChainElements )
     {
         super(
             scope,
@@ -88,6 +91,7 @@
         this.isConst = isConst;
         this.isVolatile = isVolatile;
         this.visibility = visibility;
+        this.constructorChainElements = constructorChainElements;
         qualifiedName = new ASTQualifiedNamedElement( scope, name );
     }
     /* (non-Javadoc)
@@ -173,4 +177,13 @@
 	{
 		requestor.exitMethodBody(this);
 	}
+    /* (non-Javadoc)
+     * @see org.eclipse.cdt.core.parser.ast.IASTMethod#getConstructorChainInitializers()
+     */
+    public Iterator getConstructorChainInitializers()
+    {
+    	if( constructorChainElements == null )
+    		return new EmptyIterator(); 
+        return constructorChainElements.iterator();
+    }
 }
Index: parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTVariable.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTVariable.java,v
retrieving revision 1.7
diff -u -r1.7 ASTVariable.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTVariable.java	23 Jul 2003 13:59:56 -0000	1.7
+++ parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTVariable.java	13 Aug 2003 23:53:31 -0000
@@ -25,6 +25,7 @@
  */
 public class ASTVariable extends ASTDeclaration implements IASTVariable
 {
+    private IASTExpression constructorExpression;
     private final boolean isAuto;
     private final IASTInitializerClause initializerClause;
     private final IASTExpression bitfieldExpression;
@@ -40,7 +41,7 @@
      * @param scope
      */
     public ASTVariable(IASTScope scope, String name, boolean isAuto, IASTInitializerClause initializerClause, IASTExpression bitfieldExpression, 
-    	IASTAbstractDeclaration abstractDeclaration, boolean isMutable, boolean isExtern, boolean isRegister, boolean isStatic, int startingOffset, int nameOffset )
+    	IASTAbstractDeclaration abstractDeclaration, boolean isMutable, boolean isExtern, boolean isRegister, boolean isStatic, int startingOffset, int nameOffset, IASTExpression constructorExpression )
     {
         super(scope);
 		this.isAuto = isAuto;
@@ -52,6 +53,7 @@
 		this.isRegister = isRegister;
 		this.isStatic = isStatic;
 		this.name = name;
+		this.constructorExpression = constructorExpression;
 		qualifiedName = new ASTQualifiedNamedElement( scope, name );
 		setStartingOffset(startingOffset);
 		setNameOffset(nameOffset);
@@ -193,6 +195,13 @@
      */
     public void exitScope(ISourceElementRequestor requestor)
     {
+    }
+    /* (non-Javadoc)
+     * @see org.eclipse.cdt.core.parser.ast.IASTVariable#getConstructorExpression()
+     */
+    public IASTExpression getConstructorExpression()
+    {
+        return constructorExpression;
     }
    
  
Index: parser/org/eclipse/cdt/internal/core/parser/ast/quick/QuickParseASTFactory.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/QuickParseASTFactory.java,v
retrieving revision 1.22
diff -u -r1.22 QuickParseASTFactory.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/quick/QuickParseASTFactory.java	13 Aug 2003 21:51:48 -0000	1.22
+++ parser/org/eclipse/cdt/internal/core/parser/ast/quick/QuickParseASTFactory.java	13 Aug 2003 23:53:31 -0000
@@ -179,7 +179,7 @@
     /* (non-Javadoc)
      * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createConstructorMemberInitializer(org.eclipse.cdt.core.parser.ITokenDuple, org.eclipse.cdt.core.parser.ast.IASTExpression)
      */
-    public IASTConstructorMemberInitializer createConstructorMemberInitializer(ITokenDuple duple, IASTExpression expressionList )
+    public IASTConstructorMemberInitializer createConstructorMemberInitializer(IASTScope scope, ITokenDuple duple, IASTExpression expressionList )
     {
         return new ASTConstructorMemberInitializer( duple.toString(), expressionList );
     }
@@ -203,25 +203,25 @@
     /* (non-Javadoc)
      * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createMethod(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, java.util.List, org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration, org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification, boolean, boolean, boolean, int, int, org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration, boolean, boolean, boolean, boolean, boolean, boolean, boolean, org.eclipse.cdt.core.parser.ast.ASTAccessVisibility)
      */
-    public IASTMethod createMethod(IASTScope scope, String name, List parameters, IASTAbstractDeclaration returnType, IASTExceptionSpecification exception, boolean isInline, boolean isFriend, boolean isStatic, int startOffset, int nameOffset, IASTTemplate ownerTemplate, boolean isConst, boolean isVolatile, boolean isConstructor, boolean isDestructor, boolean isVirtual, boolean isExplicit, boolean isPureVirtual, ASTAccessVisibility visibility)
+    public IASTMethod createMethod(IASTScope scope, String name, List parameters, IASTAbstractDeclaration returnType, IASTExceptionSpecification exception, boolean isInline, boolean isFriend, boolean isStatic, int startOffset, int nameOffset, IASTTemplate ownerTemplate, boolean isConst, boolean isVolatile, boolean isConstructor, boolean isDestructor, boolean isVirtual, boolean isExplicit, boolean isPureVirtual, ASTAccessVisibility visibility, List constructorChain)
     {
-        return new ASTMethod(scope, name, parameters, returnType, exception, isInline, isFriend, isStatic, startOffset, nameOffset, ownerTemplate, isConst, isVolatile, isConstructor, isDestructor, isVirtual, isExplicit, isPureVirtual, visibility);
+        return new ASTMethod(scope, name, parameters, returnType, exception, isInline, isFriend, isStatic, startOffset, nameOffset, ownerTemplate, isConst, isVolatile, isConstructor, isDestructor, isVirtual, isExplicit, isPureVirtual, visibility, constructorChain);
     }
 
     /* (non-Javadoc)
      * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createVariable(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, boolean, org.eclipse.cdt.core.parser.ast.IASTInitializerClause, org.eclipse.cdt.core.parser.ast.IASTExpression, org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration, boolean, boolean, boolean, boolean)
      */
-    public IASTVariable createVariable(IASTScope scope, String name, boolean isAuto, IASTInitializerClause initializerClause, IASTExpression bitfieldExpression, IASTAbstractDeclaration abstractDeclaration, boolean isMutable, boolean isExtern, boolean isRegister, boolean isStatic, int startingOffset, int nameOffset)
+    public IASTVariable createVariable(IASTScope scope, String name, boolean isAuto, IASTInitializerClause initializerClause, IASTExpression bitfieldExpression, IASTAbstractDeclaration abstractDeclaration, boolean isMutable, boolean isExtern, boolean isRegister, boolean isStatic, int startingOffset, int nameOffset, IASTExpression constructorExpression)
     {
-        return new ASTVariable(scope, name, isAuto, initializerClause, bitfieldExpression, abstractDeclaration, isMutable, isExtern, isRegister, isStatic, startingOffset, nameOffset);
+        return new ASTVariable(scope, name, isAuto, initializerClause, bitfieldExpression, abstractDeclaration, isMutable, isExtern, isRegister, isStatic, startingOffset, nameOffset, constructorExpression);
     }
 
     /* (non-Javadoc)
      * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createField(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, boolean, org.eclipse.cdt.core.parser.ast.IASTInitializerClause, org.eclipse.cdt.core.parser.ast.IASTExpression, org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration, boolean, boolean, boolean, boolean, org.eclipse.cdt.core.parser.ast.ASTAccessVisibility)
      */
-    public IASTField createField(IASTScope scope, String name, boolean isAuto, IASTInitializerClause initializerClause, IASTExpression bitfieldExpression, IASTAbstractDeclaration abstractDeclaration, boolean isMutable, boolean isExtern, boolean isRegister, boolean isStatic, int startingOffset, int nameOffset, ASTAccessVisibility visibility)
+    public IASTField createField(IASTScope scope, String name, boolean isAuto, IASTInitializerClause initializerClause, IASTExpression bitfieldExpression, IASTAbstractDeclaration abstractDeclaration, boolean isMutable, boolean isExtern, boolean isRegister, boolean isStatic, int startingOffset, int nameOffset, IASTExpression constructorExpression, ASTAccessVisibility visibility)
     {
-        return new ASTField(scope, name, isAuto, initializerClause, bitfieldExpression, abstractDeclaration, isMutable, isExtern, isRegister, isStatic, startingOffset, nameOffset, visibility);
+        return new ASTField(scope, name, isAuto, initializerClause, bitfieldExpression, abstractDeclaration, isMutable, isExtern, isRegister, isStatic, startingOffset, nameOffset, constructorExpression, visibility);
     }
 
     /* (non-Javadoc)
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/ChangeLog,v
retrieving revision 1.59
diff -u -r1.59 ChangeLog
--- ChangeLog	13 Aug 2003 21:51:53 -0000	1.59
+++ ChangeLog	13 Aug 2003 23:53:09 -0000
@@ -1,4 +1,8 @@
 2003-08-13 John Camelon
+	Added testBug41520() to FullParseFailedTests.java.  
+	Added testConstructorChain() to CompleteParseASTTest.java
+
+2003-08-13 John Camelon
 	Added testSimpleExpression(), testParameterExpressions() && 
 	testNestedNamespaceExpression() to CompleteParseASTTest.java.
 	
Index: failures/org/eclipse/cdt/core/parser/failedTests/FullParseFailedTests.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/failures/org/eclipse/cdt/core/parser/failedTests/FullParseFailedTests.java,v
retrieving revision 1.2
diff -u -r1.2 FullParseFailedTests.java
--- failures/org/eclipse/cdt/core/parser/failedTests/FullParseFailedTests.java	28 Jul 2003 20:49:41 -0000	1.2
+++ failures/org/eclipse/cdt/core/parser/failedTests/FullParseFailedTests.java	13 Aug 2003 23:53:09 -0000
@@ -13,10 +13,13 @@
  */
 package org.eclipse.cdt.core.parser.failedTests;
 
+import java.util.Iterator;
+
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
-import org.eclipse.cdt.core.parser.tests.BaseASTTest;
+import org.eclipse.cdt.core.parser.ast.IASTVariable;
+import org.eclipse.cdt.core.parser.tests.CompleteParseASTTest;
 
 /**
  * @author aniefer
@@ -24,7 +27,7 @@
  * To change the template for this generated type comment go to
  * Window>Preferences>Java>Code Generation>Code and Comments
  */
-public class FullParseFailedTests extends BaseASTTest {
+public class FullParseFailedTests extends CompleteParseASTTest {
 
 	/**
 	 * @param a
@@ -37,5 +40,27 @@
 		TestSuite suite = new TestSuite(FullParseFailedTests.class.getName());
 		return suite;
 	}
+	
+	public void testBug41520() throws Exception 
+	{
+		Iterator i = parse( "int x = 666; int y ( x );").getDeclarations();
+		IASTVariable variableX = (IASTVariable)i.next();
+		try
+		{ 
+			IASTVariable variableY = (IASTVariable)i.next();
+			failedAsExpected();
+		}catch( ClassCastException cce )
+		{
+			//this is bad
+		}
+	}
+
+    /**
+     * 
+     */
+    private void failedAsExpected()
+    {   
+    }
+
 
 }
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.12
diff -u -r1.12 CompleteParseASTTest.java
--- parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java	13 Aug 2003 21:51:53 -0000	1.12
+++ parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java	13 Aug 2003 23:53:09 -0000
@@ -929,4 +929,22 @@
 		assertFalse( i.hasNext() );
 		assertEquals( callback.getReferences().size(), 2 );		
 	}
+	
+	public void testConstructorChain() throws Exception
+	{
+		Iterator i = parse( "int x = 5;\n class A \n{ public : \n int a; \n A() : a( x ) { } };").getDeclarations(); 
+		IASTVariable variableX = (IASTVariable)i.next(); 
+		IASTClassSpecifier classA = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
+		assertFalse( i.hasNext() );
+		Iterator s = getDeclarations( classA ); 
+		IASTField fieldA = (IASTField)s.next(); 
+		IASTMethod methodA = (IASTMethod)s.next(); 
+		assertFalse( s.hasNext() );
+		assertEquals( callback.getReferences().size(), 2 );
+		IASTFieldReference reference1 = (IASTFieldReference)callback.getReferences().get(0);
+		IASTVariableReference reference2 = (IASTVariableReference)callback.getReferences().get(1);
+		assertEquals( reference1.getReferencedElement(), fieldA );
+		assertEquals( reference2.getReferencedElement(), variableX ); 
+	}
+	
 }

Back to the top