1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-06 09:16:02 +02:00
Added X-Reference support for ArrayModifiers and Exception Specifications.  
	Fixed Bug 41551  -  HandleInclusion always throws ScannerException on local includes.

TESTS
	Added CompleteParseASTTest::testArrayModExpression(), testPointerVariable() & 
	testExceptionSpecification().
This commit is contained in:
John Camelon 2003-08-14 15:33:32 +00:00
parent 21a6509a3b
commit 83c27c9bb1
23 changed files with 274 additions and 48 deletions

View file

@ -1,3 +1,7 @@
2003-08-14 John Camelon
Added CompleteParseASTTest::testArrayModExpression(), testPointerVariable() &
testExceptionSpecification().
2003-08-13 John Camelon 2003-08-13 John Camelon
Added testBug41520() to FullParseFailedTests.java. Added testBug41520() to FullParseFailedTests.java.
Added testConstructorChain() to CompleteParseASTTest.java Added testConstructorChain() to CompleteParseASTTest.java

View file

@ -887,6 +887,9 @@ public class CompleteParseASTTest extends TestCase
assertEquals( fqnClass[i], fqnElab[i]); assertEquals( fqnClass[i], fqnElab[i]);
assertEquals( callback.getReferences().size(), 1 ); assertEquals( callback.getReferences().size(), 1 );
assertEquals( callback.getForewardDecls().size(), 1 ); assertEquals( callback.getForewardDecls().size(), 1 );
IASTClassReference ref = (IASTClassReference)callback.getReferences().get(0);
assertTrue( ref.getReferencedElement() instanceof IASTElaboratedTypeSpecifier );
assertEquals( ref.getReferencedElement(), elab );
} }
@ -947,4 +950,35 @@ public class CompleteParseASTTest extends TestCase
assertEquals( reference2.getReferencedElement(), variableX ); assertEquals( reference2.getReferencedElement(), variableX );
} }
public void testArrayModExpression() throws Exception
{
Iterator i = parse( "const int x = 5; int y [ x ]; ").getDeclarations();
IASTVariable varX = (IASTVariable)i.next();
IASTVariable varY = (IASTVariable)i.next();
assertFalse( i.hasNext() );
assertEquals( callback.getReferences().size(), 1 );
}
public void testPointerVariable() throws Exception
{
Iterator i = parse( "class A { }; A * anA;").getDeclarations();
IASTClassSpecifier classA = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
IASTVariable varAnA = (IASTVariable)i.next();
assertFalse( i.hasNext() );
assertEquals( callback.getReferences().size(), 1 );
IASTClassReference ref = (IASTClassReference)callback.getReferences().get(0);
assertEquals( ref.getReferencedElement(), classA );
}
public void testExceptionSpecification() throws Exception
{
Iterator i = parse( "class A { }; void foo( void ) throw ( A );").getDeclarations();
IASTClassSpecifier classA = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
IASTFunction function = (IASTFunction)i.next();
assertFalse( i.hasNext() );
assertEquals( callback.getReferences().size(), 1 );
IASTClassReference ref = (IASTClassReference)callback.getReferences().get(0);
assertEquals( ref.getReferencedElement(), classA );
}
} }

View file

@ -53,7 +53,7 @@ import org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTVariable; import org.eclipse.cdt.core.parser.ast.IASTVariable;
import org.eclipse.cdt.internal.core.parser.ParserException; import org.eclipse.cdt.internal.core.parser.ParserException;
import org.eclipse.cdt.internal.core.parser.ScannerInfo; import org.eclipse.cdt.internal.core.parser.ScannerInfo;
import org.eclipse.cdt.internal.core.parser.ast.quick.ASTArrayModifier; import org.eclipse.cdt.internal.core.parser.ast.ASTArrayModifier;
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProject;

View file

@ -1,3 +1,7 @@
2003-08-14 John Camelon
Added X-Reference support for ArrayModifiers and Exception Specifications.
Fixed Bug 41551 - HandleInclusion always throws ScannerException on local includes.
2003-08-13 John Camelon 2003-08-13 John Camelon
Added constructor expression support for variables. Added constructor expression support for variables.
Added constructor chain x-reference support for methods. Added constructor chain x-reference support for methods.

View file

@ -12,11 +12,13 @@ package org.eclipse.cdt.core.parser.ast;
import java.util.Iterator; import java.util.Iterator;
import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate;
/** /**
* @author jcamelon * @author jcamelon
* *
*/ */
public interface IASTAbstractDeclaration extends IASTTypeSpecifierOwner public interface IASTAbstractDeclaration extends IASTTypeSpecifierOwner, ISourceElementCallbackDelegate
{ {
public boolean isConst(); public boolean isConst();
public boolean isVolatile(); public boolean isVolatile();

View file

@ -10,12 +10,14 @@
***********************************************************************/ ***********************************************************************/
package org.eclipse.cdt.core.parser.ast; package org.eclipse.cdt.core.parser.ast;
import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate;
/** /**
* @author jcamelon * @author jcamelon
* *
*/ */
public interface IASTArrayModifier public interface IASTArrayModifier extends ISourceElementCallbackDelegate
{ {
public IASTExpression getExpression(); public IASTExpression getExpression();
} }

View file

@ -12,11 +12,13 @@ package org.eclipse.cdt.core.parser.ast;
import java.util.Iterator; import java.util.Iterator;
import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate;
/** /**
* @author jcamelon * @author jcamelon
* *
*/ */
public interface IASTExceptionSpecification public interface IASTExceptionSpecification extends ISourceElementCallbackDelegate
{ {
public Iterator getTypeIds(); public Iterator getTypeIds();
} }

View file

@ -102,7 +102,7 @@ public interface IASTFactory
IASTInitializerClause.Kind kind, IASTInitializerClause.Kind kind,
IASTExpression assignmentExpression, IASTExpression assignmentExpression,
List initializerClauses); List initializerClauses);
public IASTExceptionSpecification createExceptionSpecification(List typeIds); public IASTExceptionSpecification createExceptionSpecification(IASTScope scope, List typeIds) throws ASTSemanticException;
/** /**
* @param exp * @param exp
*/ */

View file

@ -1968,10 +1968,18 @@ public class Parser implements IParser
} }
} }
if (exceptionSpecIds != null) if (exceptionSpecIds != null)
d.setExceptionSpecification( try
astFactory {
.createExceptionSpecification( d.setExceptionSpecification(
exceptionSpecIds)); astFactory
.createExceptionSpecification(
d.getDeclarationWrapper().getScope(), exceptionSpecIds));
}
catch (ASTSemanticException e)
{
failParse();
throw backtrack;
}
} }
// check for optional pure virtual // check for optional pure virtual
if (LT(1) == IToken.tASSIGN if (LT(1) == IToken.tASSIGN

View file

@ -308,6 +308,9 @@ public class Scanner implements IScanner {
} }
} }
} }
if (throwExceptionOnInclusionNotFound && inclusionReader == null )
throw new ScannerException("Cannot find inclusion " + fileName);
} }
else // local inclusion else // local inclusion
{ {
@ -332,9 +335,6 @@ public class Scanner implements IScanner {
handleInclusion( fileName, true, nameOffset, beginOffset, endOffset ); handleInclusion( fileName, true, nameOffset, beginOffset, endOffset );
} }
} }
if (throwExceptionOnInclusionNotFound && inclusionReader == null )
throw new ScannerException("Cannot find inclusion " + fileName);
IASTInclusion inclusion = astFactory.createInclusion( fileName, newPath, !useIncludePaths, beginOffset, endOffset, nameOffset ); IASTInclusion inclusion = astFactory.createInclusion( fileName, newPath, !useIncludePaths, beginOffset, endOffset, nameOffset );
contextStack.updateContext(inclusionReader, newPath, ScannerContext.INCLUSION, inclusion, requestor ); contextStack.updateContext(inclusionReader, newPath, ScannerContext.INCLUSION, inclusion, requestor );

View file

@ -13,8 +13,10 @@ package org.eclipse.cdt.internal.core.parser.ast;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
import org.eclipse.cdt.core.parser.ast.ASTPointerOperator; import org.eclipse.cdt.core.parser.ast.ASTPointerOperator;
import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration; import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTArrayModifier;
import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier; import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
/** /**
@ -65,6 +67,7 @@ public class ASTAbstractDeclaration implements IASTAbstractDeclaration
*/ */
public Iterator getPointerOperators() public Iterator getPointerOperators()
{ {
if( pointerOperators == null ) return new EmptyIterator();
return pointerOperators.iterator(); return pointerOperators.iterator();
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -72,6 +75,7 @@ public class ASTAbstractDeclaration implements IASTAbstractDeclaration
*/ */
public Iterator getArrayModifiers() public Iterator getArrayModifiers()
{ {
if( arrayModifiers == null ) return new EmptyIterator();
return arrayModifiers.iterator(); return arrayModifiers.iterator();
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -79,6 +83,7 @@ public class ASTAbstractDeclaration implements IASTAbstractDeclaration
*/ */
public Iterator getParameters() public Iterator getParameters()
{ {
if( parms == null ) return new EmptyIterator();
return parms.iterator(); return parms.iterator();
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -95,4 +100,25 @@ public class ASTAbstractDeclaration implements IASTAbstractDeclaration
{ {
return isVolatile; return isVolatile;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void acceptElement(ISourceElementRequestor requestor)
{
Iterator arrayMods = getArrayModifiers();
while( arrayMods.hasNext() )
((IASTArrayModifier)arrayMods.next()).acceptElement(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)
{
}
} }

View file

@ -8,8 +8,9 @@
* Contributors: * Contributors:
* IBM Rational Software - Initial API and implementation * IBM Rational Software - Initial API and implementation
***********************************************************************/ ***********************************************************************/
package org.eclipse.cdt.internal.core.parser.ast.quick; package org.eclipse.cdt.internal.core.parser.ast;
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
import org.eclipse.cdt.core.parser.ast.IASTArrayModifier; import org.eclipse.cdt.core.parser.ast.IASTArrayModifier;
import org.eclipse.cdt.core.parser.ast.IASTExpression; import org.eclipse.cdt.core.parser.ast.IASTExpression;
@ -35,4 +36,27 @@ public class ASTArrayModifier implements IASTArrayModifier
{ {
return expression; return expression;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void acceptElement(ISourceElementRequestor requestor)
{
if( expression != null )
expression.acceptElement( 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)
{
}
} }

View file

@ -12,7 +12,6 @@ package org.eclipse.cdt.internal.core.parser.ast;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.NoSuchElementException;
import org.eclipse.cdt.core.parser.ISourceElementRequestor; import org.eclipse.cdt.core.parser.ISourceElementRequestor;
import org.eclipse.cdt.core.parser.ast.IASTExpression; import org.eclipse.cdt.core.parser.ast.IASTExpression;

View file

@ -14,6 +14,7 @@ import java.util.List;
import org.eclipse.cdt.core.parser.ast.ASTPointerOperator; import org.eclipse.cdt.core.parser.ast.ASTPointerOperator;
import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration; import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTArrayModifier;
import org.eclipse.cdt.core.parser.ast.IASTExpression; import org.eclipse.cdt.core.parser.ast.IASTExpression;
import org.eclipse.cdt.core.parser.ast.IASTInclusion; import org.eclipse.cdt.core.parser.ast.IASTInclusion;
import org.eclipse.cdt.core.parser.ast.IASTInitializerClause; import org.eclipse.cdt.core.parser.ast.IASTInitializerClause;
@ -65,5 +66,10 @@ public class BaseASTFactory {
return new ASTInitializerClause( kind, assignmentExpression, initializerClauses ); return new ASTInitializerClause( kind, assignmentExpression, initializerClauses );
} }
public IASTArrayModifier createArrayModifier(IASTExpression exp)
{
return new ASTArrayModifier( exp );
}
} }

View file

@ -0,0 +1,68 @@
/**********************************************************************
* 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.Iterator;
import java.util.List;
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
import org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification;
import org.eclipse.cdt.internal.core.parser.ast.EmptyIterator;
/**
* @author jcamelon
*
*/
public class ASTExceptionSpecification implements IASTExceptionSpecification
{
private final List typeIds;
private final ASTReferenceStore store;
/**
* @param newTypeIds
* @param references
*/
public ASTExceptionSpecification(List newTypeIds, List references)
{
this.typeIds = newTypeIds;
store = new ASTReferenceStore( references );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification#getTypeIds()
*/
public Iterator getTypeIds()
{
if( typeIds == null ) return new EmptyIterator();
return typeIds.iterator();
}
/* (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)
{
}
}

View file

@ -57,6 +57,7 @@ public class ASTField extends ASTVariable implements IASTField
referenceDelegate.processReferences(requestor); referenceDelegate.processReferences(requestor);
if( getInitializerClause() != null ) if( getInitializerClause() != null )
getInitializerClause().acceptElement(requestor); getInitializerClause().acceptElement(requestor);
if( getAbstractDeclaration() != null )
getAbstractDeclaration().acceptElement(requestor);
} }
} }

View file

@ -15,6 +15,7 @@ import java.util.List;
import org.eclipse.cdt.core.parser.ISourceElementRequestor; import org.eclipse.cdt.core.parser.ISourceElementRequestor;
import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration; import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTArrayModifier;
import org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification; import org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification;
import org.eclipse.cdt.core.parser.ast.IASTFunction; import org.eclipse.cdt.core.parser.ast.IASTFunction;
import org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration; import org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration;
@ -191,13 +192,22 @@ public class ASTFunction extends ASTScope implements IASTFunction
public void acceptElement(ISourceElementRequestor requestor) public void acceptElement(ISourceElementRequestor requestor)
{ {
requestor.acceptFunctionDeclaration(this); requestor.acceptFunctionDeclaration(this);
functionCallbacks(requestor);
}
protected void functionCallbacks(ISourceElementRequestor requestor)
{
references.processReferences(requestor); references.processReferences(requestor);
processParameterInitializers(requestor); processParameterInitializersAndArrayMods(requestor);
if( getReturnType() != null )
getReturnType().acceptElement(requestor);
if( getExceptionSpec() != null )
getExceptionSpec().acceptElement(requestor);
} }
/** /**
* @param requestor * @param requestor
*/ */
protected void processParameterInitializers(ISourceElementRequestor requestor) protected void processParameterInitializersAndArrayMods(ISourceElementRequestor requestor)
{ {
Iterator i = parameters.iterator(); Iterator i = parameters.iterator();
while( i.hasNext() ) while( i.hasNext() )
@ -205,6 +215,11 @@ public class ASTFunction extends ASTScope implements IASTFunction
IASTParameterDeclaration parm = (IASTParameterDeclaration)i.next(); IASTParameterDeclaration parm = (IASTParameterDeclaration)i.next();
if( parm.getDefaultValue() != null ) if( parm.getDefaultValue() != null )
parm.getDefaultValue().acceptElement(requestor); parm.getDefaultValue().acceptElement(requestor);
Iterator arrays = parm.getArrayModifiers();
while( arrays.hasNext() )
{
((IASTArrayModifier)arrays.next()).acceptElement(requestor);
}
} }
} }
@ -215,8 +230,7 @@ public class ASTFunction extends ASTScope implements IASTFunction
public void enterScope(ISourceElementRequestor requestor) public void enterScope(ISourceElementRequestor requestor)
{ {
requestor.enterFunctionBody( this ); requestor.enterFunctionBody( this );
references.processReferences(requestor); functionCallbacks( requestor );
processParameterInitializers(requestor);
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor) * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)

View file

@ -126,8 +126,11 @@ public class ASTMethod extends ASTFunction implements IASTMethod
public void acceptElement(ISourceElementRequestor requestor) public void acceptElement(ISourceElementRequestor requestor)
{ {
requestor.acceptMethodDeclaration(this); requestor.acceptMethodDeclaration(this);
references.processReferences(requestor); methodCallbacks(requestor);
processParameterInitializers(requestor); }
protected void methodCallbacks(ISourceElementRequestor requestor)
{
functionCallbacks(requestor);
processConstructorChain(requestor); processConstructorChain(requestor);
} }
@ -149,8 +152,7 @@ public class ASTMethod extends ASTFunction implements IASTMethod
public void enterScope(ISourceElementRequestor requestor) public void enterScope(ISourceElementRequestor requestor)
{ {
requestor.enterMethodBody(this); requestor.enterMethodBody(this);
references.processReferences(requestor); methodCallbacks( requestor );
processConstructorChain(requestor);
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor) * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)

View file

@ -70,7 +70,8 @@ public class ASTTypedef extends ASTSymbol implements IASTTypedefDeclaration
public void acceptElement(ISourceElementRequestor requestor) public void acceptElement(ISourceElementRequestor requestor)
{ {
requestor.acceptTypedefDeclaration(this); requestor.acceptTypedefDeclaration(this);
referenceStore.processReferences(requestor); referenceStore.processReferences(requestor);
getAbstractDeclarator().acceptElement( requestor );
} }
/* (non-Javadoc) /* (non-Javadoc)

View file

@ -166,6 +166,9 @@ public class ASTVariable extends ASTSymbol implements IASTVariable
initializerClause.acceptElement(requestor); initializerClause.acceptElement(requestor);
if( constructorExpression != null ) if( constructorExpression != null )
constructorExpression.acceptElement(requestor); constructorExpression.acceptElement(requestor);
if( getAbstractDeclaration() != null )
getAbstractDeclaration().acceptElement(requestor);
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor) * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)

View file

@ -483,7 +483,11 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
symbol = (IContainerSymbol)symbol.lookup( t.getImage() ); symbol = (IContainerSymbol)symbol.lookup( t.getImage() );
else else
symbol = symbol.lookupNestedNameSpecifier( t.getImage() ); symbol = symbol.lookupNestedNameSpecifier( t.getImage() );
references.add( createReference( symbol, t.getImage(), t.getOffset() ));
if( symbol != null )
references.add( createReference( symbol, t.getImage(), t.getOffset() ));
else
throw new ASTSemanticException();
} }
catch( ParserSymbolTableException pste ) catch( ParserSymbolTableException pste )
{ {
@ -687,18 +691,24 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createExceptionSpecification(java.util.List) * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createExceptionSpecification(java.util.List)
*/ */
public IASTExceptionSpecification createExceptionSpecification(List typeIds) public IASTExceptionSpecification createExceptionSpecification(IASTScope scope, List typeIds) throws ASTSemanticException
{ {
// TODO Auto-generated method stub List references = new ArrayList();
return null; List newTypeIds = new ArrayList();
} if( typeIds != null )
/* (non-Javadoc) {
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createArrayModifier(org.eclipse.cdt.core.parser.ast.IASTExpression) Iterator iter =typeIds.iterator();
*/ while( iter.hasNext() )
public IASTArrayModifier createArrayModifier(IASTExpression exp) {
{ ITokenDuple duple = (ITokenDuple)iter.next();
// TODO Auto-generated method stub if( duple != null )
return null; {
lookupQualifiedName( scopeToSymbol( scope ), duple, references, false );
newTypeIds.add( duple.toString() );
}
}
}
return new ASTExceptionSpecification( newTypeIds, references );
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createConstructorMemberInitializer(org.eclipse.cdt.core.parser.ITokenDuple, org.eclipse.cdt.core.parser.ast.IASTExpression) * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createConstructorMemberInitializer(org.eclipse.cdt.core.parser.ITokenDuple, org.eclipse.cdt.core.parser.ast.IASTExpression)
@ -784,8 +794,11 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
typeSymbol = ((IContainerSymbol)typeSymbol).lookupNestedNameSpecifier( current.getImage()); typeSymbol = ((IContainerSymbol)typeSymbol).lookupNestedNameSpecifier( current.getImage());
else else
typeSymbol = ((IContainerSymbol)typeSymbol).lookup( current.getImage()); typeSymbol = ((IContainerSymbol)typeSymbol).lookup( current.getImage());
references.add( createReference( typeSymbol, current.getImage(), current.getOffset() )); if( typeSymbol != null )
references.add( createReference( typeSymbol, current.getImage(), current.getOffset() ));
else
throw new ASTSemanticException();
} }
catch (ParserSymbolTableException e) catch (ParserSymbolTableException e)
{ {

View file

@ -14,6 +14,7 @@ import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
import org.eclipse.cdt.core.parser.ITokenDuple; import org.eclipse.cdt.core.parser.ITokenDuple;
import org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification; import org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification;
@ -42,4 +43,25 @@ public class ASTExceptionSpecification implements IASTExceptionSpecification
{ {
return typeIds.iterator(); return typeIds.iterator();
} }
/* (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)
{
}
} }

View file

@ -20,7 +20,6 @@ import org.eclipse.cdt.core.parser.ast.ASTSemanticException;
import org.eclipse.cdt.core.parser.ast.IASTASMDefinition; import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration; import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration; import org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTArrayModifier;
import org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier; import org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier; import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit; import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
@ -163,19 +162,11 @@ public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createExceptionSpecification(java.util.List) * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createExceptionSpecification(java.util.List)
*/ */
public IASTExceptionSpecification createExceptionSpecification(List typeIds) public IASTExceptionSpecification createExceptionSpecification(IASTScope scope, List typeIds)
{ {
return new ASTExceptionSpecification( typeIds ); return new ASTExceptionSpecification( typeIds );
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createArrayModifier(org.eclipse.cdt.core.parser.ast.IASTExpression)
*/
public IASTArrayModifier createArrayModifier(IASTExpression exp)
{
return new ASTArrayModifier( exp );
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createConstructorMemberInitializer(org.eclipse.cdt.core.parser.ITokenDuple, org.eclipse.cdt.core.parser.ast.IASTExpression) * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createConstructorMemberInitializer(org.eclipse.cdt.core.parser.ITokenDuple, org.eclipse.cdt.core.parser.ast.IASTExpression)
*/ */