mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
CORE
Updated AST to better represent pointers to functions/methods. Implemented typedef declaration/x-ref infrastructure. TESTS Updated QuickParseASTTests for pointer to function updates. Updated CompleteParseASTTests for typedef work.
This commit is contained in:
parent
3d7a522e3e
commit
57c348fffa
27 changed files with 382 additions and 614 deletions
|
@ -1,3 +1,7 @@
|
|||
2003-07-29 John Camelon
|
||||
Updated QuickParseASTTests for pointer to function updates.
|
||||
Updated CompleteParseASTTests for typedef work.
|
||||
|
||||
2003-07-28 Victor Mozgin
|
||||
Moved testBug39546() from ASTFailedTests.java to QuickParseASTTests.java.
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ import org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration;
|
|||
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTFunction;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTPointerToFunction;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTVariable;
|
||||
import org.eclipse.cdt.core.parser.tests.BaseASTTest;
|
||||
|
@ -323,7 +322,7 @@ public class ASTFailedTests extends BaseASTTest
|
|||
{
|
||||
try
|
||||
{
|
||||
IASTPointerToFunction p2f = (IASTPointerToFunction)assertSoleDeclaration("extern int (* import) (void) __attribute__((dllimport));");
|
||||
IASTDeclaration d = assertSoleDeclaration("extern int (* import) (void) __attribute__((dllimport));");
|
||||
fail( "We should not reach this point");
|
||||
}
|
||||
catch( ClassCastException cce )
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
|
|||
import org.eclipse.cdt.core.parser.ast.IASTFunction;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier;
|
||||
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;
|
||||
|
@ -120,6 +121,12 @@ public class BaseASTTest extends TestCase
|
|||
assertEquals( ((IASTSimpleTypeSpecifier)function.getReturnType().getTypeSpecifier()).getType(), type );
|
||||
}
|
||||
|
||||
protected void assertSimpleType(IASTTypedefDeclaration variable, IASTSimpleTypeSpecifier.Type type)
|
||||
{
|
||||
assertEquals( ((IASTSimpleTypeSpecifier)variable.getAbstractDeclarator().getTypeSpecifier()).getType(), type );
|
||||
}
|
||||
|
||||
|
||||
protected void assertSimpleType(IASTVariable variable, IASTSimpleTypeSpecifier.Type type)
|
||||
{
|
||||
assertEquals( ((IASTSimpleTypeSpecifier)variable.getAbstractDeclaration().getTypeSpecifier()).getType(), type );
|
||||
|
|
|
@ -48,8 +48,6 @@ import org.eclipse.cdt.core.parser.ast.IASTMethod;
|
|||
import org.eclipse.cdt.core.parser.ast.IASTMethodReference;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTNamespaceReference;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTPointerToFunction;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTPointerToMethod;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTReference;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTScope;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier;
|
||||
|
@ -380,20 +378,6 @@ public class CompleteParseASTTest extends TestCase
|
|||
this.compilationUnit = popScope();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptPointerToFunction(org.eclipse.cdt.core.parser.ast.IASTPointerToFunction)
|
||||
*/
|
||||
public void acceptPointerToFunction(IASTPointerToFunction function)
|
||||
{
|
||||
getCurrentScope().addDeclaration(function);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptPointerToMethod(org.eclipse.cdt.core.parser.ast.IASTPointerToMethod)
|
||||
*/
|
||||
public void acceptPointerToMethod(IASTPointerToMethod method)
|
||||
{
|
||||
getCurrentScope().addDeclaration(method); }
|
||||
|
||||
|
||||
private Stack scopes = new Stack();
|
||||
|
@ -796,11 +780,26 @@ public class CompleteParseASTTest extends TestCase
|
|||
assertEquals( callback.getReferences().size(), 2 );
|
||||
}
|
||||
|
||||
// public void testSimpleTypedef() throws Exception
|
||||
// {
|
||||
// IASTTypedefDeclaration typedef = (IASTTypedefDeclaration)parse( "typedef int myInt;").getDeclarations().next();
|
||||
// assertEquals( typedef.getName(), "myInt");
|
||||
// }
|
||||
public void testSimpleTypedef() throws Exception
|
||||
{
|
||||
Iterator iter = parse( "typedef int myInt;\n myInt var;").getDeclarations();
|
||||
IASTTypedefDeclaration typedef = (IASTTypedefDeclaration)iter.next();
|
||||
assertEquals( typedef.getName(), "myInt");
|
||||
assertEquals( ((IASTSimpleTypeSpecifier)typedef.getAbstractDeclarator().getTypeSpecifier()).getType(), IASTSimpleTypeSpecifier.Type.INT );
|
||||
IASTVariable v = (IASTVariable)iter.next();
|
||||
assertEquals( v.getName(), "var");
|
||||
assertEquals( callback.getReferences().size(), 1 );
|
||||
}
|
||||
|
||||
public void testComplexTypedef() throws Exception
|
||||
{
|
||||
Iterator declarations = parse( "class A{ }; typedef A ** A_DOUBLEPTR;").getDeclarations();
|
||||
IASTClassSpecifier classA = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)declarations.next()).getTypeSpecifier();
|
||||
IASTTypedefDeclaration typedef = (IASTTypedefDeclaration)declarations.next();
|
||||
assertEquals( ((IASTSimpleTypeSpecifier)typedef.getAbstractDeclarator().getTypeSpecifier()).getTypeSpecifier(), classA );
|
||||
assertEquals( callback.getReferences().size(), 1 );
|
||||
}
|
||||
|
||||
|
||||
protected void assertQualifiedName(String [] fromAST, String [] theTruth)
|
||||
{
|
||||
|
|
|
@ -35,8 +35,6 @@ import org.eclipse.cdt.core.parser.ast.IASTMacro;
|
|||
import org.eclipse.cdt.core.parser.ast.IASTMethod;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTPointerToFunction;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTPointerToMethod;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation;
|
||||
|
@ -433,6 +431,7 @@ public class QuickParseASTTests extends BaseASTTest
|
|||
parse("typedef void (boo) ( void ); ");
|
||||
parse("typedef void boo (void); ");
|
||||
}
|
||||
|
||||
public void testBug36769B() throws Exception {
|
||||
parse("class X { operator int(); } \n");
|
||||
parse("class X { operator int*(); } \n");
|
||||
|
@ -1495,24 +1494,22 @@ public class QuickParseASTTests extends BaseASTTest
|
|||
code.write( "static void * (* const orig_malloc_hook)(const char *file, int line, size_t size);\n");
|
||||
|
||||
Iterator declarations = parse( code.toString() ).getDeclarations();
|
||||
IASTPointerToFunction p2f = (IASTPointerToFunction)declarations.next();
|
||||
assertSimpleReturnType( p2f, IASTSimpleTypeSpecifier.Type.VOID );
|
||||
assertEquals( p2f.getName(), "name");
|
||||
assertEquals( p2f.getPointerOperator(), ASTPointerOperator.POINTER);
|
||||
Iterator parameters = p2f.getParameters();
|
||||
IASTVariable p2f = (IASTVariable)declarations.next();
|
||||
assertSimpleType( p2f, IASTSimpleTypeSpecifier.Type.VOID );
|
||||
assertEquals( p2f.getName(), "name" );
|
||||
Iterator parameters = p2f.getAbstractDeclaration().getParameters();
|
||||
IASTParameterDeclaration parm = (IASTParameterDeclaration)parameters.next();
|
||||
assertFalse( parameters.hasNext() );
|
||||
assertParameterSimpleType( parm, IASTSimpleTypeSpecifier.Type.VOID );
|
||||
assertEquals( parm.getName(), "" );
|
||||
|
||||
p2f = (IASTPointerToFunction)declarations.next();
|
||||
assertSimpleReturnType( p2f, IASTSimpleTypeSpecifier.Type.VOID );
|
||||
p2f = (IASTVariable)declarations.next();
|
||||
assertSimpleType( p2f, IASTSimpleTypeSpecifier.Type.VOID );
|
||||
assertTrue( p2f.isStatic() );
|
||||
Iterator rtPo = p2f.getReturnType().getPointerOperators();
|
||||
Iterator rtPo = p2f.getAbstractDeclaration().getPointerOperators();
|
||||
assertEquals( rtPo.next(), ASTPointerOperator.POINTER );
|
||||
assertFalse( rtPo.hasNext() );
|
||||
assertEquals( p2f.getPointerOperator(), ASTPointerOperator.CONST_POINTER);
|
||||
parameters = p2f.getParameters();
|
||||
parameters = p2f.getAbstractDeclaration().getParameters();
|
||||
parm = (IASTParameterDeclaration)parameters.next();
|
||||
assertParameterSimpleType( parm, IASTSimpleTypeSpecifier.Type.CHAR );
|
||||
assertEquals( parm.getName(), "file" );
|
||||
|
@ -1529,13 +1526,12 @@ public class QuickParseASTTests extends BaseASTTest
|
|||
|
||||
public void testBug36600() throws Exception
|
||||
{
|
||||
IASTPointerToFunction p2f = (IASTPointerToFunction)parse( "enum mad_flow (*input_func)(void *, struct mad_stream *);").getDeclarations().next();
|
||||
IASTElaboratedTypeSpecifier elab = (IASTElaboratedTypeSpecifier)p2f.getReturnType().getTypeSpecifier();
|
||||
IASTVariable p2f = (IASTVariable)parse( "enum mad_flow (*input_func)(void *, struct mad_stream *);").getDeclarations().next();
|
||||
IASTElaboratedTypeSpecifier elab = (IASTElaboratedTypeSpecifier)p2f.getAbstractDeclaration().getTypeSpecifier();
|
||||
assertEquals( elab.getName(), "mad_flow");
|
||||
assertEquals( elab.getClassKind(), ASTClassKind.ENUM );
|
||||
assertEquals( p2f.getPointerOperator(), ASTPointerOperator.POINTER );
|
||||
assertEquals( p2f.getName(), "input_func");
|
||||
Iterator parms = p2f.getParameters();
|
||||
Iterator parms = p2f.getAbstractDeclaration().getParameters();
|
||||
IASTParameterDeclaration parm = (IASTParameterDeclaration)parms.next();
|
||||
assertEquals( parm.getName(), "" );
|
||||
assertEquals( parm.getPointerOperators().next(), ASTPointerOperator.POINTER);
|
||||
|
@ -1635,11 +1631,11 @@ public class QuickParseASTTests extends BaseASTTest
|
|||
|
||||
public void testPointersToMemberFunctions() throws Exception
|
||||
{
|
||||
IASTPointerToMethod p2m = (IASTPointerToMethod)parse("void (A::*name)(void);").getDeclarations().next();
|
||||
assertSimpleReturnType( p2m, IASTSimpleTypeSpecifier.Type.VOID );
|
||||
IASTVariable p2m = (IASTVariable)parse("void (A::*name)(void);").getDeclarations().next();
|
||||
assertSimpleType( p2m, IASTSimpleTypeSpecifier.Type.VOID );
|
||||
assertEquals( p2m.getName(), "A::name");
|
||||
assertEquals( p2m.getPointerOperator(), ASTPointerOperator.POINTER);
|
||||
Iterator parameters = p2m.getParameters();
|
||||
assertEquals( p2m.getAbstractDeclaration().getPointerToFunctionOperator(), ASTPointerOperator.POINTER);
|
||||
Iterator parameters = p2m.getAbstractDeclaration().getParameters();
|
||||
IASTParameterDeclaration parm = (IASTParameterDeclaration)parameters.next();
|
||||
assertFalse( parameters.hasNext() );
|
||||
assertParameterSimpleType( parm, IASTSimpleTypeSpecifier.Type.VOID );
|
||||
|
@ -1721,4 +1717,38 @@ public class QuickParseASTTests extends BaseASTTest
|
|||
parse("signed char c = (signed char) 0xffffffff;");
|
||||
assertTrue( quickParseCallback.getCompilationUnit().getDeclarations().hasNext() );
|
||||
}
|
||||
|
||||
public void testIndirectDeclarators() throws Exception
|
||||
{
|
||||
IASTVariable v = (IASTVariable)parse( "void (*x)( int );").getDeclarations().next();
|
||||
assertEquals( v.getName(), "x");
|
||||
assertSimpleType( v, IASTSimpleTypeSpecifier.Type.VOID );
|
||||
assertParameterSimpleType( (IASTParameterDeclaration)v.getAbstractDeclaration().getParameters().next(), IASTSimpleTypeSpecifier.Type.INT );
|
||||
assertEquals( v.getAbstractDeclaration().getPointerToFunctionOperator(), ASTPointerOperator.POINTER );
|
||||
|
||||
v = (IASTVariable)parse( "const int * (* const something)( const int * const * const );").getDeclarations().next();
|
||||
assertEquals( v.getName(), "something");
|
||||
assertEquals( v.getAbstractDeclaration().getPointerToFunctionOperator(), ASTPointerOperator.CONST_POINTER);
|
||||
assertTrue( v.getAbstractDeclaration().isConst() );
|
||||
assertSimpleType( v, IASTSimpleTypeSpecifier.Type.INT );
|
||||
assertEquals( v.getAbstractDeclaration().getPointerOperators().next(), ASTPointerOperator.POINTER );
|
||||
IASTParameterDeclaration parm = (IASTParameterDeclaration)v.getAbstractDeclaration().getParameters().next();
|
||||
assertParameterSimpleType( parm, IASTSimpleTypeSpecifier.Type.INT );
|
||||
Iterator pointerOps = parm.getPointerOperators();
|
||||
assertEquals( pointerOps.next(), ASTPointerOperator.CONST_POINTER );
|
||||
assertEquals( pointerOps.next(), ASTPointerOperator.CONST_POINTER );
|
||||
assertFalse( pointerOps.hasNext() );
|
||||
|
||||
IASTTypedefDeclaration typedef = (IASTTypedefDeclaration)parse( "typedef void (*life)(int);").getDeclarations().next();
|
||||
assertEquals( typedef.getName(), "life");
|
||||
assertSimpleType( typedef, IASTSimpleTypeSpecifier.Type.VOID );
|
||||
assertParameterSimpleType( (IASTParameterDeclaration)typedef.getAbstractDeclarator().getParameters().next(), IASTSimpleTypeSpecifier.Type.INT );
|
||||
|
||||
IASTFunction f = (IASTFunction)parse( "void (f)(void);").getDeclarations().next();
|
||||
assertEquals( f.getName(), "f");
|
||||
|
||||
typedef = (IASTTypedefDeclaration)parse( "typedef void (life)(int);").getDeclarations().next();
|
||||
assertEquals( typedef.getName(), "life");
|
||||
|
||||
}
|
||||
}
|
|
@ -28,8 +28,6 @@ import org.eclipse.cdt.core.parser.ast.IASTMethod;
|
|||
import org.eclipse.cdt.core.parser.ast.IASTMethodReference;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTNamespaceReference;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTPointerToFunction;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTPointerToMethod;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation;
|
||||
|
@ -892,22 +890,11 @@ public class DOMBuilder implements ISourceElementRequestor
|
|||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptPointerToFunction(org.eclipse.cdt.core.parser.ast.IASTPointerToFunction)
|
||||
*/
|
||||
public void acceptPointerToFunction(IASTPointerToFunction function)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptPointerToMethod(org.eclipse.cdt.core.parser.ast.IASTPointerToMethod)
|
||||
*/
|
||||
public void acceptPointerToMethod(IASTPointerToMethod method)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptTypedefReference(org.eclipse.cdt.core.parser.ast.IASTTypedefReference)
|
||||
*/
|
||||
|
|
|
@ -318,7 +318,7 @@ public class Util {
|
|||
} else if (existingExternalFiles.contains(externalFile)) {
|
||||
return externalFile;
|
||||
} else {
|
||||
//TODO: BOG do we need to add something here?
|
||||
//TODO: BOG do we need to add something here? ANSWER YES!
|
||||
/*
|
||||
if (JavaModelManager.ZIP_ACCESS_VERBOSE) {
|
||||
System.out.println("(" + Thread.currentThread() + ") [JavaModel.getTarget(...)] Checking existence of " + path.toString()); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
|
|
@ -35,8 +35,6 @@ import org.eclipse.cdt.core.parser.ast.IASTMethod;
|
|||
import org.eclipse.cdt.core.parser.ast.IASTMethodReference;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTNamespaceReference;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTPointerToFunction;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTPointerToMethod;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTemplateSpecialization;
|
||||
|
@ -351,20 +349,7 @@ public class SourceIndexerRequestor implements ISourceElementRequestor, IIndexCo
|
|||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptPointerToFunction(org.eclipse.cdt.core.parser.ast.IASTPointerToFunction)
|
||||
*/
|
||||
public void acceptPointerToFunction(IASTPointerToFunction function) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptPointerToMethod(org.eclipse.cdt.core.parser.ast.IASTPointerToMethod)
|
||||
*/
|
||||
public void acceptPointerToMethod(IASTPointerToMethod method) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptTypedefReference(org.eclipse.cdt.core.parser.ast.IASTTypedefReference)
|
||||
*/
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2003-07-29 John Camelon
|
||||
Updated AST to better represent pointers to functions/methods.
|
||||
Implemented typedef declaration/x-ref infrastructure.
|
||||
|
||||
2003-07-29 Victor Mozgin
|
||||
Fixed PR 39546 : Parser fails on 'signed' casts.
|
||||
|
||||
|
|
|
@ -28,8 +28,6 @@ import org.eclipse.cdt.core.parser.ast.IASTMethod;
|
|||
import org.eclipse.cdt.core.parser.ast.IASTMethodReference;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTNamespaceReference;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTPointerToFunction;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTPointerToMethod;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTemplateSpecialization;
|
||||
|
@ -95,13 +93,5 @@ public interface ISourceElementRequestor {
|
|||
public void exitInclusion( IASTInclusion inclusion );
|
||||
public void exitCompilationUnit( IASTCompilationUnit compilationUnit );
|
||||
|
||||
/**
|
||||
* @param function
|
||||
*/
|
||||
public void acceptPointerToFunction(IASTPointerToFunction function);
|
||||
|
||||
/**
|
||||
* @param method
|
||||
*/
|
||||
public void acceptPointerToMethod(IASTPointerToMethod method);
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ public interface IASTAbstractDeclaration extends IASTTypeSpecifierOwner
|
|||
public boolean isConst();
|
||||
public Iterator getPointerOperators();
|
||||
public Iterator getArrayModifiers();
|
||||
|
||||
public Iterator getParameters();
|
||||
public ASTPointerOperator getPointerToFunctionOperator();
|
||||
|
||||
}
|
||||
|
|
|
@ -139,7 +139,7 @@ public interface IASTFactory
|
|||
boolean isConst,
|
||||
IASTTypeSpecifier typeSpecifier,
|
||||
List pointerOperators,
|
||||
List arrayModifiers);
|
||||
List arrayModifiers, List parameters, ASTPointerOperator pointerOperator);
|
||||
public IASTMethod createMethod(
|
||||
IASTScope scope,
|
||||
String name,
|
||||
|
@ -166,7 +166,7 @@ public interface IASTFactory
|
|||
|
||||
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 IASTParameterDeclaration createParameterDeclaration( boolean isConst, IASTTypeSpecifier getTypeSpecifier, List pointerOperators, List arrayModifiers, String parameterName, IASTInitializerClause initializerClause );
|
||||
public IASTParameterDeclaration createParameterDeclaration( boolean isConst, IASTTypeSpecifier getTypeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp, String parameterName, IASTInitializerClause initializerClause );
|
||||
|
||||
public IASTTemplateDeclaration createTemplateDeclaration( IASTScope scope, List templateParameters, boolean exported, int startingOffset );
|
||||
|
||||
|
@ -176,42 +176,8 @@ public interface IASTFactory
|
|||
|
||||
public IASTTemplateSpecialization createTemplateSpecialization(IASTScope scope, int startingOffset);
|
||||
|
||||
public IASTTypedefDeclaration createTypedef( IASTScope scope, String name, IASTAbstractDeclaration mapping, int startingOffset, int nameOffset );
|
||||
public IASTTypedefDeclaration createTypedef( IASTScope scope, String name, IASTAbstractDeclaration mapping, int startingOffset, int nameOffset ) throws ASTSemanticException;
|
||||
|
||||
public IASTAbstractTypeSpecifierDeclaration createTypeSpecDeclaration( IASTScope scope, IASTTypeSpecifier typeSpecifier, IASTTemplate template, int startingOffset, int endingOffset);
|
||||
|
||||
public IASTPointerToFunction createPointerToFunction(
|
||||
IASTScope scope,
|
||||
String name,
|
||||
List parameters,
|
||||
IASTAbstractDeclaration returnType,
|
||||
IASTExceptionSpecification exception,
|
||||
boolean isInline,
|
||||
boolean isFriend,
|
||||
boolean isStatic,
|
||||
int startOffset,
|
||||
int nameOffset,
|
||||
IASTTemplate ownerTemplate, ASTPointerOperator pointerOperator);
|
||||
|
||||
public IASTPointerToMethod createPointerToMethod(
|
||||
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, ASTPointerOperator pointerOperator);
|
||||
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2002,2003 Rational Software Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.core.parser.ast;
|
||||
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public interface IASTPointerToFunction extends IASTFunction, IASTPointerOperatorOwner
|
||||
{
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2002,2003 Rational Software Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.core.parser.ast;
|
||||
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public interface IASTPointerToMethod extends IASTMethod, IASTPointerOperatorOwner
|
||||
{
|
||||
}
|
|
@ -14,19 +14,16 @@ import java.util.Collections;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.parser.IToken;
|
||||
import org.eclipse.cdt.core.parser.ITokenDuple;
|
||||
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
|
||||
import org.eclipse.cdt.core.parser.ast.ASTPointerOperator;
|
||||
import org.eclipse.cdt.core.parser.ast.ASTSemanticException;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTFactory;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTField;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTFunction;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTMethod;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTPointerToFunction;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTPointerToMethod;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTScope;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTemplate;
|
||||
|
@ -318,63 +315,113 @@ public class DeclarationWrapper implements IDeclaratorOwner
|
|||
boolean hasInnerDeclarator = ( declarator.getOwnedDeclarator() != null );
|
||||
|
||||
if( hasInnerDeclarator )
|
||||
{
|
||||
ITokenDuple innerPointerName = declarator.getOwnedDeclarator().getPointerOperatorNameDuple();
|
||||
if( innerPointerName != null && innerPointerName.getLastToken().getType() == IToken.tCOLONCOLON )
|
||||
return createP2MethodASTNode(declarator);
|
||||
else
|
||||
return createP2FunctionASTNode( declarator );
|
||||
}
|
||||
return createIndirectDeclaration( declarator );
|
||||
|
||||
if (isTypedef())
|
||||
return createTypedef(declarator);
|
||||
return createTypedef(declarator, false);
|
||||
|
||||
if (isWithinClass )
|
||||
{
|
||||
if( isFunction)
|
||||
return createMethodASTNode(declarator);
|
||||
return createMethodASTNode(declarator, false);
|
||||
else
|
||||
return createFieldASTNode(declarator);
|
||||
return createFieldASTNode(declarator, false );
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isFunction)
|
||||
return createFunctionASTNode(declarator);
|
||||
return createFunctionASTNode(declarator, false);
|
||||
else
|
||||
return createVariableASTNode(declarator);
|
||||
return createVariableASTNode(declarator, false);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param declarator
|
||||
* @return
|
||||
*/
|
||||
private IASTTypedefDeclaration createTypedef(Declarator declarator)
|
||||
private IASTDeclaration createIndirectDeclaration(Declarator declarator) throws ASTSemanticException
|
||||
{
|
||||
if( declarator.getOwnedDeclarator().getOwnedDeclarator() == null )
|
||||
{
|
||||
|
||||
Declarator d = declarator.getOwnedDeclarator();
|
||||
Iterator i = d.getPtrOps().iterator();
|
||||
if( !i.hasNext() )
|
||||
{
|
||||
boolean isWithinClass = scope instanceof IASTClassSpecifier;
|
||||
boolean isFunction = (declarator.getParameters().size() != 0);
|
||||
if (isTypedef())
|
||||
return createTypedef(declarator, true);
|
||||
|
||||
if (isWithinClass )
|
||||
{
|
||||
if( isFunction)
|
||||
return createMethodASTNode(declarator, true);
|
||||
else
|
||||
return createFieldASTNode(declarator, true );
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isFunction)
|
||||
return createFunctionASTNode(declarator, true);
|
||||
else
|
||||
return createVariableASTNode(declarator, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
List convertedParms = createParameterList( declarator.getParameters() );
|
||||
IASTAbstractDeclaration abs = astFactory.createAbstractDeclaration(
|
||||
constt, getTypeSpecifier(), declarator.getPtrOps(), declarator.getArrayModifiers(), convertedParms,
|
||||
(ASTPointerOperator)i.next() );
|
||||
String name = ( d.getPointerOperatorNameDuple() != null ) ? d.getPointerOperatorNameDuple().toString() + d.getName() : d.getName();
|
||||
if( typedef )
|
||||
return astFactory.createTypedef(
|
||||
scope,
|
||||
name,
|
||||
abs, getStartingOffset(), d.getNameStartOffset() );
|
||||
else
|
||||
return astFactory.createVariable( scope, name, auto, d.getInitializerClause(), d.getBitFieldExpression(), abs, mutable, extern, register, staticc, getStartingOffset(), d.getNameStartOffset() );
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ASTSemanticException();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param declarator
|
||||
* @return
|
||||
*/
|
||||
private IASTTypedefDeclaration createTypedef(Declarator declarator, boolean nested ) throws ASTSemanticException
|
||||
{
|
||||
return astFactory.createTypedef(
|
||||
scope,
|
||||
declarator.getName(),
|
||||
nested ? declarator.getOwnedDeclarator().getName() : declarator.getName(),
|
||||
astFactory.createAbstractDeclaration(
|
||||
constt,
|
||||
getTypeSpecifier(),
|
||||
declarator.getPtrOps(),
|
||||
declarator.getArrayModifiers()), startingOffset, declarator.getNameStartOffset());
|
||||
declarator.getArrayModifiers(), null, null), startingOffset, declarator.getNameStartOffset());
|
||||
}
|
||||
/**
|
||||
* @param declarator
|
||||
* @return
|
||||
*/
|
||||
private IASTMethod createMethodASTNode(Declarator declarator) throws ASTSemanticException
|
||||
private IASTMethod createMethodASTNode(Declarator declarator, boolean nested) throws ASTSemanticException
|
||||
{
|
||||
return astFactory
|
||||
.createMethod(
|
||||
scope,
|
||||
declarator.getName(),
|
||||
nested ? declarator.getOwnedDeclarator().getName() : declarator.getName(),
|
||||
createParameterList(declarator.getParameters()),
|
||||
astFactory.createAbstractDeclaration(
|
||||
constt,
|
||||
getTypeSpecifier(),
|
||||
declarator.getPtrOps(),
|
||||
declarator.getArrayModifiers()),
|
||||
declarator.getArrayModifiers(), null, null),
|
||||
declarator.getExceptionSpecification(),
|
||||
inline,
|
||||
friend,
|
||||
|
@ -396,17 +443,17 @@ public class DeclarationWrapper implements IDeclaratorOwner
|
|||
* @param declarator
|
||||
* @return
|
||||
*/
|
||||
private IASTFunction createFunctionASTNode(Declarator declarator) throws ASTSemanticException
|
||||
private IASTFunction createFunctionASTNode(Declarator declarator, boolean nested) throws ASTSemanticException
|
||||
{
|
||||
return astFactory.createFunction(
|
||||
scope,
|
||||
declarator.getName(),
|
||||
nested ? declarator.getOwnedDeclarator().getName() : declarator.getName(),
|
||||
createParameterList(declarator.getParameters()),
|
||||
astFactory.createAbstractDeclaration(
|
||||
constt,
|
||||
getTypeSpecifier(),
|
||||
declarator.getPtrOps(),
|
||||
declarator.getArrayModifiers()),
|
||||
declarator.getArrayModifiers(), null, null),
|
||||
declarator.getExceptionSpecification(),
|
||||
inline,
|
||||
friend,
|
||||
|
@ -419,11 +466,11 @@ public class DeclarationWrapper implements IDeclaratorOwner
|
|||
* @param declarator
|
||||
* @return
|
||||
*/
|
||||
private IASTField createFieldASTNode(Declarator declarator) throws ASTSemanticException
|
||||
private IASTField createFieldASTNode(Declarator declarator, boolean nested) throws ASTSemanticException
|
||||
{
|
||||
return astFactory.createField(
|
||||
scope,
|
||||
declarator.getName(),
|
||||
nested ? declarator.getOwnedDeclarator().getName() : declarator.getName(),
|
||||
auto,
|
||||
declarator.getInitializerClause(),
|
||||
declarator.getBitFieldExpression(),
|
||||
|
@ -431,7 +478,7 @@ public class DeclarationWrapper implements IDeclaratorOwner
|
|||
constt,
|
||||
getTypeSpecifier(),
|
||||
declarator.getPtrOps(),
|
||||
declarator.getArrayModifiers()),
|
||||
declarator.getArrayModifiers(), null, null),
|
||||
mutable,
|
||||
extern,
|
||||
register,
|
||||
|
@ -457,10 +504,10 @@ public class DeclarationWrapper implements IDeclaratorOwner
|
|||
wrapper.getTypeSpecifier(),
|
||||
declarator.getPtrOps(),
|
||||
declarator.getArrayModifiers(),
|
||||
declarator.getName() == null
|
||||
null,
|
||||
null, declarator.getName() == null
|
||||
? ""
|
||||
: declarator.getName(),
|
||||
declarator.getInitializerClause()));
|
||||
: declarator.getName(), declarator.getInitializerClause()));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
@ -469,11 +516,11 @@ public class DeclarationWrapper implements IDeclaratorOwner
|
|||
* @param declarator
|
||||
* @return
|
||||
*/
|
||||
private IASTVariable createVariableASTNode(Declarator declarator) throws ASTSemanticException
|
||||
private IASTVariable createVariableASTNode(Declarator declarator, boolean nested ) throws ASTSemanticException
|
||||
{
|
||||
return astFactory.createVariable(
|
||||
scope,
|
||||
declarator.getName(),
|
||||
nested ? declarator.getOwnedDeclarator().getName() : declarator.getName(),
|
||||
isAuto(),
|
||||
declarator.getInitializerClause(),
|
||||
declarator.getBitFieldExpression(),
|
||||
|
@ -481,7 +528,7 @@ public class DeclarationWrapper implements IDeclaratorOwner
|
|||
constt,
|
||||
getTypeSpecifier(),
|
||||
declarator.getPtrOps(),
|
||||
declarator.getArrayModifiers()),
|
||||
declarator.getArrayModifiers(), null, null),
|
||||
mutable,
|
||||
extern,
|
||||
register,
|
||||
|
@ -490,67 +537,6 @@ public class DeclarationWrapper implements IDeclaratorOwner
|
|||
declarator.getNameStartOffset());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param declarator
|
||||
* @return
|
||||
*/
|
||||
private IASTPointerToMethod createP2MethodASTNode(Declarator declarator)
|
||||
{
|
||||
|
||||
return astFactory
|
||||
.createPointerToMethod(
|
||||
scope,
|
||||
declarator.getOwnedDeclarator().getPointerOperatorNameDuple().toString().trim() +
|
||||
declarator.getOwnedDeclarator().getName().trim(),
|
||||
createParameterList(declarator.getParameters()),
|
||||
astFactory.createAbstractDeclaration(
|
||||
constt,
|
||||
getTypeSpecifier(),
|
||||
declarator.getPtrOps(),
|
||||
declarator.getArrayModifiers()),
|
||||
declarator.getExceptionSpecification(),
|
||||
inline,
|
||||
friend,
|
||||
staticc,
|
||||
startingOffset,
|
||||
declarator.getOwnedDeclarator().getNameStartOffset(),
|
||||
templateDeclaration,
|
||||
declarator.isConst(),
|
||||
declarator.isVolatile(),
|
||||
false,
|
||||
// isConstructor
|
||||
false, // isDestructor
|
||||
virtual,
|
||||
explicit,
|
||||
declarator.isPureVirtual(),
|
||||
((scope instanceof IASTClassSpecifier )? ((IASTClassSpecifier)scope).getCurrentVisibilityMode() : ASTAccessVisibility.PUBLIC )
|
||||
, (ASTPointerOperator)declarator.getOwnedDeclarator().getPtrOps().get(0));
|
||||
}
|
||||
/**
|
||||
* @param declarator
|
||||
* @return
|
||||
*/
|
||||
private IASTPointerToFunction createP2FunctionASTNode(Declarator declarator)
|
||||
{
|
||||
return astFactory.createPointerToFunction(
|
||||
scope,
|
||||
declarator.getOwnedDeclarator().getName(),
|
||||
createParameterList(declarator.getParameters()),
|
||||
astFactory.createAbstractDeclaration(
|
||||
constt,
|
||||
getTypeSpecifier(),
|
||||
declarator.getPtrOps(),
|
||||
declarator.getArrayModifiers()),
|
||||
declarator.getExceptionSpecification(),
|
||||
inline,
|
||||
friend,
|
||||
staticc,
|
||||
startingOffset,
|
||||
declarator.getOwnedDeclarator().getNameStartOffset(),
|
||||
templateDeclaration, (ASTPointerOperator)declarator.getOwnedDeclarator().getPtrOps().get(0));
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.internal.core.parser.IDeclaratorOwner#getDeclarationWrapper()
|
||||
*/
|
||||
|
|
|
@ -20,8 +20,6 @@ import org.eclipse.cdt.core.parser.ast.IASTMethod;
|
|||
import org.eclipse.cdt.core.parser.ast.IASTMethodReference;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTNamespaceReference;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTPointerToFunction;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTPointerToMethod;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTemplateSpecialization;
|
||||
|
@ -333,23 +331,8 @@ public class NullSourceElementRequestor implements ISourceElementRequestor
|
|||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptPointerToFunction(org.eclipse.cdt.core.parser.ast.IASTPointerToFunction)
|
||||
*/
|
||||
public void acceptPointerToFunction(IASTPointerToFunction function)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptPointerToMethod(org.eclipse.cdt.core.parser.ast.IASTPointerToMethod)
|
||||
*/
|
||||
public void acceptPointerToMethod(IASTPointerToMethod method)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptTypedefReference(org.eclipse.cdt.core.parser.ast.IASTTypedefReference)
|
||||
|
|
|
@ -595,10 +595,10 @@ public class Parser implements IParser
|
|||
wrapper.getTypeSpecifier(),
|
||||
declarator.getPtrOps(),
|
||||
declarator.getArrayModifiers(),
|
||||
declarator.getName() == null
|
||||
null,
|
||||
null, declarator.getName() == null
|
||||
? ""
|
||||
: declarator.getName(),
|
||||
declarator.getInitializerClause()),
|
||||
: declarator.getName(), declarator.getInitializerClause()),
|
||||
null));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ package org.eclipse.cdt.internal.core.parser.ast;
|
|||
import java.util.Iterator;
|
||||
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.IASTTypeSpecifier;
|
||||
|
||||
|
@ -22,22 +23,26 @@ import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
|
|||
*/
|
||||
public class ASTAbstractDeclaration implements IASTAbstractDeclaration
|
||||
{
|
||||
private final List parms;
|
||||
private final boolean isConst;
|
||||
private final IASTTypeSpecifier typeSpecifier;
|
||||
private final List pointerOperators;
|
||||
private final List arrayModifiers;
|
||||
private final ASTPointerOperator pointerOperator;
|
||||
/**
|
||||
* @param isConst
|
||||
* @param typeSpecifier
|
||||
* @param pointerOperators
|
||||
* @param arrayModifiers
|
||||
*/
|
||||
public ASTAbstractDeclaration(boolean isConst, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers)
|
||||
public ASTAbstractDeclaration(boolean isConst, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp )
|
||||
{
|
||||
this.isConst = isConst;
|
||||
this.typeSpecifier = typeSpecifier;
|
||||
this.pointerOperators = pointerOperators;
|
||||
this.arrayModifiers = arrayModifiers;
|
||||
this.parms = parameters;
|
||||
this.pointerOperator = pointerOp;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration#isConst()
|
||||
|
@ -67,4 +72,18 @@ public class ASTAbstractDeclaration implements IASTAbstractDeclaration
|
|||
{
|
||||
return arrayModifiers.iterator();
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration#getParameters()
|
||||
*/
|
||||
public Iterator getParameters()
|
||||
{
|
||||
return parms.iterator();
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration#getPointerToFunctionOperator()
|
||||
*/
|
||||
public ASTPointerOperator getPointerToFunctionOperator()
|
||||
{
|
||||
return pointerOperator;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
***********************************************************************/
|
||||
package org.eclipse.cdt.internal.core.parser.ast;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ast.ASTPointerOperator;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTInitializerClause;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
|
||||
|
@ -21,12 +21,9 @@ import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
|
|||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public class ASTParameterDeclaration implements IASTParameterDeclaration
|
||||
public class ASTParameterDeclaration extends ASTAbstractDeclaration implements IASTParameterDeclaration
|
||||
{
|
||||
private final boolean isConst;
|
||||
private final IASTTypeSpecifier typeSpecifier;
|
||||
private final List pointerOperators;
|
||||
private final List arrayModifiers;
|
||||
|
||||
private final String parameterName;
|
||||
private final IASTInitializerClause initializerClause;
|
||||
/**
|
||||
|
@ -37,12 +34,9 @@ public class ASTParameterDeclaration implements IASTParameterDeclaration
|
|||
* @param parameterName
|
||||
* @param initializerClause
|
||||
*/
|
||||
public ASTParameterDeclaration(boolean isConst, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, String parameterName, IASTInitializerClause initializerClause)
|
||||
public ASTParameterDeclaration(boolean isConst, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp, String parameterName, IASTInitializerClause initializerClause)
|
||||
{
|
||||
this.isConst = isConst;
|
||||
this.typeSpecifier = typeSpecifier;
|
||||
this.pointerOperators = pointerOperators;
|
||||
this.arrayModifiers = arrayModifiers;
|
||||
super( isConst, typeSpecifier, pointerOperators, arrayModifiers, parameters, pointerOp );
|
||||
this.parameterName = parameterName;
|
||||
this.initializerClause = initializerClause;
|
||||
}
|
||||
|
@ -60,32 +54,4 @@ public class ASTParameterDeclaration implements IASTParameterDeclaration
|
|||
{
|
||||
return initializerClause;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration#isConst()
|
||||
*/
|
||||
public boolean isConst()
|
||||
{
|
||||
return isConst;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration#getTypeSpecifier()
|
||||
*/
|
||||
public IASTTypeSpecifier getTypeSpecifier()
|
||||
{
|
||||
return typeSpecifier;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration#getPointerOperators()
|
||||
*/
|
||||
public Iterator getPointerOperators()
|
||||
{
|
||||
return pointerOperators.iterator();
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration#getArrayModifiers()
|
||||
*/
|
||||
public Iterator getArrayModifiers()
|
||||
{
|
||||
return arrayModifiers.iterator();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ package org.eclipse.cdt.internal.core.parser.ast;
|
|||
|
||||
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.IASTInclusion;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTInitializerClause;
|
||||
|
@ -48,14 +49,14 @@ public class BaseASTFactory {
|
|||
return inclusion;
|
||||
}
|
||||
|
||||
public IASTAbstractDeclaration createAbstractDeclaration(boolean isConst, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers)
|
||||
public IASTAbstractDeclaration createAbstractDeclaration(boolean isConst, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOperator)
|
||||
{
|
||||
return new ASTAbstractDeclaration( isConst, typeSpecifier, pointerOperators, arrayModifiers );
|
||||
return new ASTAbstractDeclaration( isConst, typeSpecifier, pointerOperators, arrayModifiers, parameters, pointerOperator );
|
||||
}
|
||||
|
||||
public IASTParameterDeclaration createParameterDeclaration(boolean isConst, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, String parameterName, IASTInitializerClause initializerClause)
|
||||
public IASTParameterDeclaration createParameterDeclaration(boolean isConst, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp, String parameterName, IASTInitializerClause initializerClause)
|
||||
{
|
||||
return new ASTParameterDeclaration( isConst, typeSpecifier, pointerOperators, arrayModifiers, parameterName, initializerClause );
|
||||
return new ASTParameterDeclaration( isConst, typeSpecifier, pointerOperators, arrayModifiers, parameters, pointerOp, parameterName, initializerClause );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -10,121 +10,137 @@
|
|||
***********************************************************************/
|
||||
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.IASTAbstractDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTScope;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration;
|
||||
import org.eclipse.cdt.internal.core.parser.ast.ASTQualifiedNamedElement;
|
||||
import org.eclipse.cdt.internal.core.parser.ast.NamedOffsets;
|
||||
import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public class ASTTypedef implements IASTTypedefDeclaration
|
||||
public class ASTTypedef extends ASTSymbol implements IASTTypedefDeclaration
|
||||
{
|
||||
|
||||
private final IASTAbstractDeclaration mapping;
|
||||
private NamedOffsets offsets = new NamedOffsets();
|
||||
private final ASTQualifiedNamedElement qualifiedName;
|
||||
private final ASTReferenceStore referenceStore;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param newSymbol
|
||||
* @param mapping
|
||||
* @param startingOffset
|
||||
* @param nameOffset
|
||||
* @param references
|
||||
*/
|
||||
public ASTTypedef()
|
||||
public ASTTypedef(ISymbol newSymbol, IASTAbstractDeclaration mapping, int startingOffset, int nameOffset, List references)
|
||||
{
|
||||
super();
|
||||
// TODO Auto-generated constructor stub
|
||||
super( newSymbol );
|
||||
this.mapping = mapping;
|
||||
this.referenceStore = new ASTReferenceStore( references );
|
||||
this.qualifiedName = new ASTQualifiedNamedElement( getOwnerScope(), newSymbol.getName());
|
||||
setStartingOffset(startingOffset);
|
||||
setNameOffset(nameOffset);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getName()
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration#getName()
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
return getSymbol().getName();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration#getAbstractDeclarator()
|
||||
*/
|
||||
public IASTAbstractDeclaration getAbstractDeclarator()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameOffset()
|
||||
*/
|
||||
public int getNameOffset()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameOffset(int)
|
||||
*/
|
||||
public void setNameOffset(int o)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTQualifiedNameElement#getFullyQualifiedName()
|
||||
*/
|
||||
public String[] getFullyQualifiedName()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTScopedElement#getOwnerScope()
|
||||
*/
|
||||
public IASTScope getOwnerScope()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
return mapping;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
|
||||
*/
|
||||
public void acceptElement(ISourceElementRequestor requestor)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
requestor.acceptTypedefDeclaration(this);
|
||||
referenceStore.processReferences(requestor);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
|
||||
*/
|
||||
public void enterScope(ISourceElementRequestor requestor)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
|
||||
*/
|
||||
public void exitScope(ISourceElementRequestor requestor)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameOffset()
|
||||
*/
|
||||
public int getNameOffset()
|
||||
{
|
||||
return offsets.getNameOffset();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameOffset(int)
|
||||
*/
|
||||
public void setNameOffset(int o)
|
||||
{
|
||||
offsets.setNameOffset(o);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
|
||||
*/
|
||||
public void setStartingOffset(int o)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
offsets.setStartingOffset(o);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
|
||||
*/
|
||||
public void setEndingOffset(int o)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
offsets.setEndingOffset(o);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingOffset()
|
||||
*/
|
||||
public int getStartingOffset()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
return offsets.getStartingOffset();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingOffset()
|
||||
*/
|
||||
public int getEndingOffset()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
return offsets.getEndingOffset();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTQualifiedNameElement#getFullyQualifiedName()
|
||||
*/
|
||||
public String[] getFullyQualifiedName()
|
||||
{
|
||||
return qualifiedName.getFullyQualifiedName();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
/**********************************************************************
|
||||
* 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 org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate;
|
||||
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTypedefReference;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public class ASTTypedefReference
|
||||
extends ASTReference
|
||||
implements IASTTypedefReference
|
||||
{
|
||||
private final IASTTypedefDeclaration referencedItem;
|
||||
/**
|
||||
* @param offset
|
||||
* @param name
|
||||
*/
|
||||
public ASTTypedefReference(int offset, String name, IASTTypedefDeclaration referencedItem )
|
||||
{
|
||||
super(offset, name);
|
||||
this.referencedItem = referencedItem;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTReference#getReferencedElement()
|
||||
*/
|
||||
public ISourceElementCallbackDelegate getReferencedElement()
|
||||
{
|
||||
return referencedItem;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
|
||||
*/
|
||||
public void acceptElement(ISourceElementRequestor requestor)
|
||||
{
|
||||
requestor.acceptTypedefReference(this);
|
||||
}
|
||||
/* (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)
|
||||
{
|
||||
}
|
||||
}
|
|
@ -38,8 +38,6 @@ import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification;
|
|||
import org.eclipse.cdt.core.parser.ast.IASTMethod;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTPointerToFunction;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTPointerToMethod;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTReference;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTScope;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier;
|
||||
|
@ -432,6 +430,10 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
{
|
||||
return new ASTClassReference( offset, string, (IASTClassSpecifier)symbol.getASTExtension().getPrimaryDeclaration() );
|
||||
}
|
||||
else if( symbol.getTypeInfo().checkBit( TypeInfo.isTypedef ))
|
||||
{
|
||||
return new ASTTypedefReference( offset, string, (IASTTypedefDeclaration)symbol.getASTExtension().getPrimaryDeclaration());
|
||||
}
|
||||
else if( symbol.getType() == TypeInfo.t_enumeration )
|
||||
return new ASTEnumerationReference( offset, string, (IASTEnumerationSpecifier)symbol.getASTExtension().getPrimaryDeclaration() );
|
||||
else if( symbol.getType() == TypeInfo.t_function )
|
||||
|
@ -1137,10 +1139,36 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
String name,
|
||||
IASTAbstractDeclaration mapping,
|
||||
int startingOffset,
|
||||
int nameOffset)
|
||||
int nameOffset) throws ASTSemanticException
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return new ASTTypedef();
|
||||
IContainerSymbol containerSymbol = scopeToSymbol(scope);
|
||||
ISymbol newSymbol = pst.newSymbol( name, TypeInfo.t_type);
|
||||
newSymbol.getTypeInfo().setBit( true,TypeInfo.isTypedef );
|
||||
|
||||
List references = new ArrayList();
|
||||
if( mapping.getTypeSpecifier() instanceof ASTSimpleTypeSpecifier )
|
||||
{
|
||||
references.addAll( ((ASTSimpleTypeSpecifier)mapping.getTypeSpecifier()).getReferences() );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
containerSymbol.addSymbol( newSymbol );
|
||||
}
|
||||
catch (ParserSymbolTableException e)
|
||||
{
|
||||
throw new ASTSemanticException();
|
||||
}
|
||||
ASTTypedef d = new ASTTypedef( newSymbol, mapping, startingOffset, nameOffset, references );
|
||||
try
|
||||
{
|
||||
attachSymbolExtension(newSymbol, d );
|
||||
}
|
||||
catch (ExtensionException e1)
|
||||
{
|
||||
throw new ASTSemanticException();
|
||||
}
|
||||
return d;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createTypeSpecDeclaration(org.eclipse.cdt.core.parser.ast.IASTScope, org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier, org.eclipse.cdt.core.parser.ast.IASTTemplate, int, int)
|
||||
|
@ -1154,54 +1182,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
{
|
||||
return new ASTAbstractTypeSpecifierDeclaration( scopeToSymbol(scope), typeSpecifier, template, startingOffset, endingOffset);
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createPointerToFunction(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.IASTTemplate, org.eclipse.cdt.core.parser.ast.ASTPointerOperator)
|
||||
*/
|
||||
public IASTPointerToFunction createPointerToFunction(
|
||||
IASTScope scope,
|
||||
String name,
|
||||
List parameters,
|
||||
IASTAbstractDeclaration returnType,
|
||||
IASTExceptionSpecification exception,
|
||||
boolean isInline,
|
||||
boolean isFriend,
|
||||
boolean isStatic,
|
||||
int startOffset,
|
||||
int nameOffset,
|
||||
IASTTemplate ownerTemplate,
|
||||
ASTPointerOperator pointerOperator)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createPointerToMethod(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.IASTTemplate, boolean, boolean, boolean, boolean, boolean, boolean, boolean, org.eclipse.cdt.core.parser.ast.ASTAccessVisibility, org.eclipse.cdt.core.parser.ast.ASTPointerOperator)
|
||||
*/
|
||||
public IASTPointerToMethod createPointerToMethod(
|
||||
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,
|
||||
ASTPointerOperator pointerOperator)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
protected ParserSymbolTable pst = new ParserSymbolTable();
|
||||
}
|
||||
|
|
|
@ -1,72 +0,0 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2002,2003 Rational Software Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.internal.core.parser.ast.quick;
|
||||
|
||||
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.IASTExceptionSpecification;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTPointerToFunction;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTScope;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTemplate;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public class ASTPointerToFunction
|
||||
extends ASTFunction
|
||||
implements IASTPointerToFunction
|
||||
{
|
||||
|
||||
private final ASTPointerOperator pointerOperator;
|
||||
|
||||
/**
|
||||
* @param scope
|
||||
* @param name
|
||||
* @param parameters
|
||||
* @param returnType
|
||||
* @param exception
|
||||
* @param isInline
|
||||
* @param isFriend
|
||||
* @param isStatic
|
||||
* @param startOffset
|
||||
* @param nameOffset
|
||||
* @param ownerTemplate
|
||||
*/
|
||||
public ASTPointerToFunction(IASTScope scope, String name, List parameters, IASTAbstractDeclaration returnType, IASTExceptionSpecification exception, boolean isInline, boolean isFriend, boolean isStatic, int startOffset, int nameOffset, IASTTemplate ownerTemplate, ASTPointerOperator pointerOperator)
|
||||
{
|
||||
super(
|
||||
scope,
|
||||
name,
|
||||
parameters,
|
||||
returnType,
|
||||
exception,
|
||||
isInline,
|
||||
isFriend,
|
||||
isStatic,
|
||||
startOffset,
|
||||
nameOffset,
|
||||
ownerTemplate);
|
||||
this.pointerOperator = pointerOperator;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTPointerOperatorOwner#getPointerOperator()
|
||||
*/
|
||||
public ASTPointerOperator getPointerOperator()
|
||||
{
|
||||
return pointerOperator;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,87 +0,0 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2002,2003 Rational Software Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.internal.core.parser.ast.quick;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
|
||||
import org.eclipse.cdt.core.parser.ast.ASTPointerOperator;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTPointerToMethod;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTScope;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTemplate;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public class ASTPointerToMethod
|
||||
extends ASTMethod
|
||||
implements IASTPointerToMethod
|
||||
{
|
||||
|
||||
private final ASTPointerOperator pointerOperator;
|
||||
|
||||
/**
|
||||
* @param scope
|
||||
* @param name
|
||||
* @param parameters
|
||||
* @param returnType
|
||||
* @param exception
|
||||
* @param isInline
|
||||
* @param isFriend
|
||||
* @param isStatic
|
||||
* @param startOffset
|
||||
* @param nameOffset
|
||||
* @param ownerTemplate
|
||||
* @param isConst
|
||||
* @param isVolatile
|
||||
* @param isConstructor
|
||||
* @param isDestructor
|
||||
* @param isVirtual
|
||||
* @param isExplicit
|
||||
* @param isPureVirtual
|
||||
* @param visibility
|
||||
*/
|
||||
public ASTPointerToMethod(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, ASTPointerOperator pointerOperator)
|
||||
{
|
||||
super(
|
||||
scope,
|
||||
name,
|
||||
parameters,
|
||||
returnType,
|
||||
exception,
|
||||
isInline,
|
||||
isFriend,
|
||||
isStatic,
|
||||
startOffset,
|
||||
nameOffset,
|
||||
ownerTemplate,
|
||||
isConst,
|
||||
isVolatile,
|
||||
isConstructor,
|
||||
isDestructor,
|
||||
isVirtual,
|
||||
isExplicit,
|
||||
isPureVirtual,
|
||||
visibility);
|
||||
this.pointerOperator = pointerOperator;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTPointerOperatorOwner#getPointerOperator()
|
||||
*/
|
||||
public ASTPointerOperator getPointerOperator()
|
||||
{
|
||||
return pointerOperator;
|
||||
}
|
||||
}
|
|
@ -15,7 +15,6 @@ import java.util.List;
|
|||
import org.eclipse.cdt.core.parser.ITokenDuple;
|
||||
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
|
||||
import org.eclipse.cdt.core.parser.ast.ASTClassKind;
|
||||
import org.eclipse.cdt.core.parser.ast.ASTPointerOperator;
|
||||
import org.eclipse.cdt.core.parser.ast.ASTSemanticException;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
|
||||
|
@ -37,8 +36,6 @@ import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification;
|
|||
import org.eclipse.cdt.core.parser.ast.IASTMethod;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTPointerToFunction;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTPointerToMethod;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTScope;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTemplate;
|
||||
|
@ -288,19 +285,5 @@ public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory
|
|||
return new ASTAbstractTypeSpecifierDeclaration( scope, typeSpecifier, template, startingOffset, endingOffset );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createPointerToFunction(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.IASTTemplate)
|
||||
*/
|
||||
public IASTPointerToFunction createPointerToFunction(IASTScope scope, String name, List parameters, IASTAbstractDeclaration returnType, IASTExceptionSpecification exception, boolean isInline, boolean isFriend, boolean isStatic, int startOffset, int nameOffset, IASTTemplate ownerTemplate, ASTPointerOperator pointerOperator)
|
||||
{
|
||||
return new ASTPointerToFunction( scope, name, parameters, returnType, exception, isInline, isFriend, isStatic, startOffset, nameOffset, ownerTemplate, pointerOperator);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createPointerToMethod(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.IASTTemplate, boolean, boolean, boolean, boolean, boolean, boolean, boolean, org.eclipse.cdt.core.parser.ast.ASTAccessVisibility)
|
||||
*/
|
||||
public IASTPointerToMethod createPointerToMethod(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, ASTPointerOperator pointerOperator)
|
||||
{
|
||||
return new ASTPointerToMethod(scope, name, parameters, returnType, exception, isInline, isFriend, isStatic, startOffset, nameOffset, ownerTemplate, isConst, isVolatile, isConstructor, isDestructor, isVirtual, isExplicit, isPureVirtual, visibility, pointerOperator);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,8 +75,6 @@ public class MatchLocator implements ISourceElementRequestor, ICSearchConstants
|
|||
public void acceptTypedefDeclaration(IASTTypedefDeclaration typedef) { }
|
||||
|
||||
public void acceptAbstractTypeSpecDeclaration(IASTAbstractTypeSpecifierDeclaration abstractDeclaration) {}
|
||||
public void acceptPointerToFunction(IASTPointerToFunction function) {}
|
||||
public void acceptPointerToMethod(IASTPointerToMethod method) { }
|
||||
public void acceptTypedefReference( IASTTypedefReference reference ) { }
|
||||
|
||||
public void enterLinkageSpecification(IASTLinkageSpecification linkageSpec) { }
|
||||
|
|
Loading…
Add table
Reference in a new issue