mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-05 08:46:02 +02:00
CORE
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:
parent
21a6509a3b
commit
83c27c9bb1
23 changed files with 274 additions and 48 deletions
|
@ -1,3 +1,7 @@
|
|||
2003-08-14 John Camelon
|
||||
Added CompleteParseASTTest::testArrayModExpression(), testPointerVariable() &
|
||||
testExceptionSpecification().
|
||||
|
||||
2003-08-13 John Camelon
|
||||
Added testBug41520() to FullParseFailedTests.java.
|
||||
Added testConstructorChain() to CompleteParseASTTest.java
|
||||
|
|
|
@ -887,6 +887,9 @@ public class CompleteParseASTTest extends TestCase
|
|||
assertEquals( fqnClass[i], fqnElab[i]);
|
||||
assertEquals( callback.getReferences().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 );
|
||||
}
|
||||
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ import org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration;
|
|||
import org.eclipse.cdt.core.parser.ast.IASTVariable;
|
||||
import org.eclipse.cdt.internal.core.parser.ParserException;
|
||||
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;
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
Added constructor expression support for variables.
|
||||
Added constructor chain x-reference support for methods.
|
||||
|
|
|
@ -12,11 +12,13 @@ package org.eclipse.cdt.core.parser.ast;
|
|||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public interface IASTAbstractDeclaration extends IASTTypeSpecifierOwner
|
||||
public interface IASTAbstractDeclaration extends IASTTypeSpecifierOwner, ISourceElementCallbackDelegate
|
||||
{
|
||||
public boolean isConst();
|
||||
public boolean isVolatile();
|
||||
|
|
|
@ -10,12 +10,14 @@
|
|||
***********************************************************************/
|
||||
package org.eclipse.cdt.core.parser.ast;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate;
|
||||
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public interface IASTArrayModifier
|
||||
public interface IASTArrayModifier extends ISourceElementCallbackDelegate
|
||||
{
|
||||
public IASTExpression getExpression();
|
||||
}
|
||||
|
|
|
@ -12,11 +12,13 @@ package org.eclipse.cdt.core.parser.ast;
|
|||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public interface IASTExceptionSpecification
|
||||
public interface IASTExceptionSpecification extends ISourceElementCallbackDelegate
|
||||
{
|
||||
public Iterator getTypeIds();
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ public interface IASTFactory
|
|||
IASTInitializerClause.Kind kind,
|
||||
IASTExpression assignmentExpression,
|
||||
List initializerClauses);
|
||||
public IASTExceptionSpecification createExceptionSpecification(List typeIds);
|
||||
public IASTExceptionSpecification createExceptionSpecification(IASTScope scope, List typeIds) throws ASTSemanticException;
|
||||
/**
|
||||
* @param exp
|
||||
*/
|
||||
|
|
|
@ -1968,10 +1968,18 @@ public class Parser implements IParser
|
|||
}
|
||||
}
|
||||
if (exceptionSpecIds != null)
|
||||
d.setExceptionSpecification(
|
||||
astFactory
|
||||
.createExceptionSpecification(
|
||||
exceptionSpecIds));
|
||||
try
|
||||
{
|
||||
d.setExceptionSpecification(
|
||||
astFactory
|
||||
.createExceptionSpecification(
|
||||
d.getDeclarationWrapper().getScope(), exceptionSpecIds));
|
||||
}
|
||||
catch (ASTSemanticException e)
|
||||
{
|
||||
failParse();
|
||||
throw backtrack;
|
||||
}
|
||||
}
|
||||
// check for optional pure virtual
|
||||
if (LT(1) == IToken.tASSIGN
|
||||
|
|
|
@ -308,6 +308,9 @@ public class Scanner implements IScanner {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (throwExceptionOnInclusionNotFound && inclusionReader == null )
|
||||
throw new ScannerException("Cannot find inclusion " + fileName);
|
||||
}
|
||||
else // local inclusion
|
||||
{
|
||||
|
@ -332,9 +335,6 @@ public class Scanner implements IScanner {
|
|||
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 );
|
||||
contextStack.updateContext(inclusionReader, newPath, ScannerContext.INCLUSION, inclusion, requestor );
|
||||
|
|
|
@ -13,8 +13,10 @@ package org.eclipse.cdt.internal.core.parser.ast;
|
|||
import java.util.Iterator;
|
||||
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.IASTAbstractDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTArrayModifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
|
||||
|
||||
/**
|
||||
|
@ -65,6 +67,7 @@ public class ASTAbstractDeclaration implements IASTAbstractDeclaration
|
|||
*/
|
||||
public Iterator getPointerOperators()
|
||||
{
|
||||
if( pointerOperators == null ) return new EmptyIterator();
|
||||
return pointerOperators.iterator();
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
|
@ -72,6 +75,7 @@ public class ASTAbstractDeclaration implements IASTAbstractDeclaration
|
|||
*/
|
||||
public Iterator getArrayModifiers()
|
||||
{
|
||||
if( arrayModifiers == null ) return new EmptyIterator();
|
||||
return arrayModifiers.iterator();
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
|
@ -79,6 +83,7 @@ public class ASTAbstractDeclaration implements IASTAbstractDeclaration
|
|||
*/
|
||||
public Iterator getParameters()
|
||||
{
|
||||
if( parms == null ) return new EmptyIterator();
|
||||
return parms.iterator();
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
|
@ -95,4 +100,25 @@ public class ASTAbstractDeclaration implements IASTAbstractDeclaration
|
|||
{
|
||||
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)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,8 +8,9 @@
|
|||
* Contributors:
|
||||
* 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.IASTExpression;
|
||||
|
||||
|
@ -35,4 +36,27 @@ public class ASTArrayModifier implements IASTArrayModifier
|
|||
{
|
||||
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)
|
||||
{
|
||||
}
|
||||
}
|
|
@ -12,7 +12,6 @@ package org.eclipse.cdt.internal.core.parser.ast;
|
|||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTExpression;
|
||||
|
|
|
@ -14,6 +14,7 @@ import java.util.List;
|
|||
|
||||
import org.eclipse.cdt.core.parser.ast.ASTPointerOperator;
|
||||
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.IASTInclusion;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTInitializerClause;
|
||||
|
@ -65,5 +66,10 @@ public class BaseASTFactory {
|
|||
return new ASTInitializerClause( kind, assignmentExpression, initializerClauses );
|
||||
}
|
||||
|
||||
public IASTArrayModifier createArrayModifier(IASTExpression exp)
|
||||
{
|
||||
return new ASTArrayModifier( exp );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
}
|
|
@ -57,6 +57,7 @@ public class ASTField extends ASTVariable implements IASTField
|
|||
referenceDelegate.processReferences(requestor);
|
||||
if( getInitializerClause() != null )
|
||||
getInitializerClause().acceptElement(requestor);
|
||||
|
||||
if( getAbstractDeclaration() != null )
|
||||
getAbstractDeclaration().acceptElement(requestor);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import java.util.List;
|
|||
|
||||
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
|
||||
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.IASTFunction;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration;
|
||||
|
@ -191,13 +192,22 @@ public class ASTFunction extends ASTScope implements IASTFunction
|
|||
public void acceptElement(ISourceElementRequestor requestor)
|
||||
{
|
||||
requestor.acceptFunctionDeclaration(this);
|
||||
functionCallbacks(requestor);
|
||||
}
|
||||
|
||||
protected void functionCallbacks(ISourceElementRequestor requestor)
|
||||
{
|
||||
references.processReferences(requestor);
|
||||
processParameterInitializers(requestor);
|
||||
processParameterInitializersAndArrayMods(requestor);
|
||||
if( getReturnType() != null )
|
||||
getReturnType().acceptElement(requestor);
|
||||
if( getExceptionSpec() != null )
|
||||
getExceptionSpec().acceptElement(requestor);
|
||||
}
|
||||
/**
|
||||
* @param requestor
|
||||
*/
|
||||
protected void processParameterInitializers(ISourceElementRequestor requestor)
|
||||
protected void processParameterInitializersAndArrayMods(ISourceElementRequestor requestor)
|
||||
{
|
||||
Iterator i = parameters.iterator();
|
||||
while( i.hasNext() )
|
||||
|
@ -205,6 +215,11 @@ public class ASTFunction extends ASTScope implements IASTFunction
|
|||
IASTParameterDeclaration parm = (IASTParameterDeclaration)i.next();
|
||||
if( parm.getDefaultValue() != null )
|
||||
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)
|
||||
{
|
||||
requestor.enterFunctionBody( this );
|
||||
references.processReferences(requestor);
|
||||
processParameterInitializers(requestor);
|
||||
functionCallbacks( requestor );
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
|
||||
|
|
|
@ -126,8 +126,11 @@ public class ASTMethod extends ASTFunction implements IASTMethod
|
|||
public void acceptElement(ISourceElementRequestor requestor)
|
||||
{
|
||||
requestor.acceptMethodDeclaration(this);
|
||||
references.processReferences(requestor);
|
||||
processParameterInitializers(requestor);
|
||||
methodCallbacks(requestor);
|
||||
}
|
||||
protected void methodCallbacks(ISourceElementRequestor requestor)
|
||||
{
|
||||
functionCallbacks(requestor);
|
||||
processConstructorChain(requestor);
|
||||
}
|
||||
|
||||
|
@ -149,8 +152,7 @@ public class ASTMethod extends ASTFunction implements IASTMethod
|
|||
public void enterScope(ISourceElementRequestor requestor)
|
||||
{
|
||||
requestor.enterMethodBody(this);
|
||||
references.processReferences(requestor);
|
||||
processConstructorChain(requestor);
|
||||
methodCallbacks( requestor );
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
|
||||
|
|
|
@ -70,7 +70,8 @@ public class ASTTypedef extends ASTSymbol implements IASTTypedefDeclaration
|
|||
public void acceptElement(ISourceElementRequestor requestor)
|
||||
{
|
||||
requestor.acceptTypedefDeclaration(this);
|
||||
referenceStore.processReferences(requestor);
|
||||
referenceStore.processReferences(requestor);
|
||||
getAbstractDeclarator().acceptElement( requestor );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
|
@ -166,6 +166,9 @@ public class ASTVariable extends ASTSymbol implements IASTVariable
|
|||
initializerClause.acceptElement(requestor);
|
||||
if( constructorExpression != null )
|
||||
constructorExpression.acceptElement(requestor);
|
||||
if( getAbstractDeclaration() != null )
|
||||
getAbstractDeclaration().acceptElement(requestor);
|
||||
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
|
||||
|
|
|
@ -483,7 +483,11 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
symbol = (IContainerSymbol)symbol.lookup( t.getImage() );
|
||||
else
|
||||
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 )
|
||||
{
|
||||
|
@ -687,18 +691,24 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
/* (non-Javadoc)
|
||||
* @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
|
||||
return null;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createArrayModifier(org.eclipse.cdt.core.parser.ast.IASTExpression)
|
||||
*/
|
||||
public IASTArrayModifier createArrayModifier(IASTExpression exp)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
List references = new ArrayList();
|
||||
List newTypeIds = new ArrayList();
|
||||
if( typeIds != null )
|
||||
{
|
||||
Iterator iter =typeIds.iterator();
|
||||
while( iter.hasNext() )
|
||||
{
|
||||
ITokenDuple duple = (ITokenDuple)iter.next();
|
||||
if( duple != null )
|
||||
{
|
||||
lookupQualifiedName( scopeToSymbol( scope ), duple, references, false );
|
||||
newTypeIds.add( duple.toString() );
|
||||
}
|
||||
}
|
||||
}
|
||||
return new ASTExceptionSpecification( newTypeIds, references );
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @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());
|
||||
else
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -14,6 +14,7 @@ import java.util.ArrayList;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
|
||||
import org.eclipse.cdt.core.parser.ITokenDuple;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification;
|
||||
|
||||
|
@ -42,4 +43,25 @@ public class ASTExceptionSpecification implements IASTExceptionSpecification
|
|||
{
|
||||
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)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.IASTAbstractDeclaration;
|
||||
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.IASTClassSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
|
||||
|
@ -163,19 +162,11 @@ public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory
|
|||
/* (non-Javadoc)
|
||||
* @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 );
|
||||
}
|
||||
|
||||
/* (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)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createConstructorMemberInitializer(org.eclipse.cdt.core.parser.ITokenDuple, org.eclipse.cdt.core.parser.ast.IASTExpression)
|
||||
*/
|
||||
|
|
Loading…
Add table
Reference in a new issue