mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-03 14:25:37 +02:00
CORE
Fixed Bug 43013 : IASTParameterDeclaration does not derive from IASTOffsetableNamedElement
This commit is contained in:
parent
bd9cb0bd51
commit
9d95cfa455
9 changed files with 127 additions and 13 deletions
|
@ -1,3 +1,6 @@
|
|||
2003-09-12 John Camelon
|
||||
Fixed Bug 43013 : IASTParameterDeclaration does not derive from IASTOffsetableNamedElement
|
||||
|
||||
2003-09-12 Andrew Niefer
|
||||
Fixed some NPEs in ParserSymbolTable.getFlatTypeInfo
|
||||
Added some comments and created some constants to help clarify ranking of conversion sequences
|
||||
|
|
|
@ -177,7 +177,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, IASTExpression constructorExpression, ASTAccessVisibility visibility) throws ASTSemanticException;
|
||||
|
||||
public IASTParameterDeclaration createParameterDeclaration( boolean isConst, boolean isVolatile, IASTTypeSpecifier getTypeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp, String parameterName, IASTInitializerClause initializerClause );
|
||||
public IASTParameterDeclaration createParameterDeclaration( boolean isConst, boolean isVolatile, IASTTypeSpecifier getTypeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp, String parameterName, IASTInitializerClause initializerClause, int startingOffset, int endingOffset, int nameOffset );
|
||||
|
||||
public IASTTemplateDeclaration createTemplateDeclaration( IASTScope scope, List templateParameters, boolean exported, int startingOffset );
|
||||
|
||||
|
|
|
@ -14,9 +14,7 @@ package org.eclipse.cdt.core.parser.ast;
|
|||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public interface IASTParameterDeclaration extends IASTAbstractDeclaration
|
||||
public interface IASTParameterDeclaration extends IASTAbstractDeclaration, IASTOffsetableNamedElement
|
||||
{
|
||||
public String getName();
|
||||
public IASTInitializerClause getDefaultValue();
|
||||
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier.Type;
|
|||
*/
|
||||
public class DeclarationWrapper implements IDeclaratorOwner
|
||||
{
|
||||
private int endOffset;
|
||||
private ITokenDuple name;
|
||||
private Type simpleType =
|
||||
IASTSimpleTypeSpecifier.Type.UNSPECIFIED;
|
||||
|
@ -514,7 +515,7 @@ public class DeclarationWrapper implements IDeclaratorOwner
|
|||
declarator.getArrayModifiers(),
|
||||
null, null, declarator.getName() == null
|
||||
? ""
|
||||
: declarator.getName(), declarator.getInitializerClause()));
|
||||
: declarator.getName(), declarator.getInitializerClause(), wrapper.getStartingOffset(), wrapper.getEndOffset(), declarator.getNameStartOffset()));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
@ -649,4 +650,19 @@ public class DeclarationWrapper implements IDeclaratorOwner
|
|||
{
|
||||
return templateDeclaration;
|
||||
}
|
||||
/**
|
||||
* @param i
|
||||
*/
|
||||
public void setEndingOffset(int i)
|
||||
{
|
||||
endOffset = i;
|
||||
}
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public int getEndOffset()
|
||||
{
|
||||
return endOffset;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -605,7 +605,7 @@ public class Parser implements IParser
|
|||
declarator.getArrayModifiers(),
|
||||
null, null, declarator.getName() == null
|
||||
? ""
|
||||
: declarator.getName(), declarator.getInitializerClause()),
|
||||
: declarator.getName(), declarator.getInitializerClause(), wrapper.getStartingOffset(), wrapper.getEndOffset(), declarator.getNameStartOffset()),
|
||||
null));
|
||||
}
|
||||
}
|
||||
|
@ -1078,6 +1078,9 @@ public class Parser implements IParser
|
|||
if (LT(1) != IToken.tSEMI)
|
||||
initDeclarator(sdw, false, SimpleDeclarationStrategy.TRY_FUNCTION );
|
||||
|
||||
if( lastToken != null )
|
||||
sdw.setEndingOffset( lastToken.getEndOffset() );
|
||||
|
||||
if (current == LA(1))
|
||||
throw backtrack;
|
||||
collection.addParameter(sdw);
|
||||
|
|
|
@ -19,6 +19,7 @@ import org.eclipse.cdt.core.parser.ast.IASTInitializerClause;
|
|||
import org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
|
||||
import org.eclipse.cdt.internal.core.parser.ast.ASTAbstractDeclaration;
|
||||
import org.eclipse.cdt.internal.core.parser.ast.NamedOffsets;
|
||||
import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
|
||||
|
||||
/**
|
||||
|
@ -30,6 +31,7 @@ public class ASTParameterDeclaration extends ASTSymbol implements IASTParameterD
|
|||
private final ASTAbstractDeclaration abstractDeclaration;
|
||||
private final String parameterName;
|
||||
private final IASTInitializerClause initializerClause;
|
||||
private final NamedOffsets offsets = new NamedOffsets();
|
||||
/**
|
||||
* @param isConst
|
||||
* @param typeSpecifier
|
||||
|
@ -38,12 +40,15 @@ public class ASTParameterDeclaration extends ASTSymbol implements IASTParameterD
|
|||
* @param parameterName
|
||||
* @param initializerClause
|
||||
*/
|
||||
public ASTParameterDeclaration(ISymbol symbol, boolean isConst, boolean isVolatile, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp, String parameterName, IASTInitializerClause initializerClause)
|
||||
public ASTParameterDeclaration(ISymbol symbol, boolean isConst, boolean isVolatile, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp, String parameterName, IASTInitializerClause initializerClause, int startingOffset, int endingOffset, int nameOffset)
|
||||
{
|
||||
super( symbol );
|
||||
abstractDeclaration = new ASTAbstractDeclaration( isConst, isVolatile, typeSpecifier, pointerOperators, arrayModifiers, parameters, pointerOp );
|
||||
this.parameterName = parameterName;
|
||||
this.initializerClause = initializerClause;
|
||||
setStartingOffset(startingOffset);
|
||||
setEndingOffset(endingOffset);
|
||||
setNameOffset(nameOffset);
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration#getName()
|
||||
|
@ -128,6 +133,48 @@ public class ASTParameterDeclaration extends ASTSymbol implements IASTParameterD
|
|||
{
|
||||
|
||||
}
|
||||
/* (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)
|
||||
{
|
||||
offsets.setStartingOffset(o);
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
|
||||
*/
|
||||
public void setEndingOffset(int o)
|
||||
{
|
||||
offsets.setEndingOffset(o);
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingOffset()
|
||||
*/
|
||||
public int getStartingOffset()
|
||||
{
|
||||
return offsets.getStartingOffset();
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingOffset()
|
||||
*/
|
||||
public int getEndingOffset()
|
||||
{
|
||||
return offsets.getEndingOffset();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1929,8 +1929,8 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
return false;
|
||||
}
|
||||
|
||||
public IASTParameterDeclaration createParameterDeclaration(boolean isConst, boolean isVolatile, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp, String parameterName, IASTInitializerClause initializerClause)
|
||||
public IASTParameterDeclaration createParameterDeclaration(boolean isConst, boolean isVolatile, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp, String parameterName, IASTInitializerClause initializerClause, int startingOffset, int endingOffset, int nameOffset)
|
||||
{
|
||||
return new ASTParameterDeclaration( null, isConst, isVolatile, typeSpecifier, pointerOperators, arrayModifiers, parameters, pointerOp, parameterName, initializerClause );
|
||||
return new ASTParameterDeclaration( null, isConst, isVolatile, typeSpecifier, pointerOperators, arrayModifiers, parameters, pointerOp, parameterName, initializerClause, startingOffset, endingOffset, nameOffset );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ import org.eclipse.cdt.core.parser.ast.IASTInitializerClause;
|
|||
import org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
|
||||
import org.eclipse.cdt.internal.core.parser.ast.ASTAbstractDeclaration;
|
||||
import org.eclipse.cdt.internal.core.parser.ast.NamedOffsets;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
|
@ -24,7 +25,7 @@ import org.eclipse.cdt.internal.core.parser.ast.ASTAbstractDeclaration;
|
|||
*/
|
||||
public class ASTParameterDeclaration extends ASTAbstractDeclaration implements IASTParameterDeclaration
|
||||
{
|
||||
|
||||
private final NamedOffsets offsets = new NamedOffsets();
|
||||
private final String parameterName;
|
||||
private final IASTInitializerClause initializerClause;
|
||||
/**
|
||||
|
@ -35,11 +36,14 @@ public class ASTParameterDeclaration extends ASTAbstractDeclaration implements I
|
|||
* @param parameterName
|
||||
* @param initializerClause
|
||||
*/
|
||||
public ASTParameterDeclaration(boolean isConst, boolean isVolatile, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp, String parameterName, IASTInitializerClause initializerClause)
|
||||
public ASTParameterDeclaration(boolean isConst, boolean isVolatile, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp, String parameterName, IASTInitializerClause initializerClause, int startingOffset, int endingOffset, int nameOffset)
|
||||
{
|
||||
super( isConst, isVolatile, typeSpecifier, pointerOperators, arrayModifiers, parameters, pointerOp );
|
||||
this.parameterName = parameterName;
|
||||
this.initializerClause = initializerClause;
|
||||
setStartingOffset( startingOffset );
|
||||
setEndingOffset( endingOffset );
|
||||
setNameOffset( nameOffset );
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration#getName()
|
||||
|
@ -55,4 +59,47 @@ public class ASTParameterDeclaration extends ASTAbstractDeclaration implements I
|
|||
{
|
||||
return initializerClause;
|
||||
}
|
||||
|
||||
/* (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)
|
||||
{
|
||||
offsets.setStartingOffset(o);
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
|
||||
*/
|
||||
public void setEndingOffset(int o)
|
||||
{
|
||||
offsets.setEndingOffset(o);
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingOffset()
|
||||
*/
|
||||
public int getStartingOffset()
|
||||
{
|
||||
return offsets.getStartingOffset();
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingOffset()
|
||||
*/
|
||||
public int getEndingOffset()
|
||||
{
|
||||
return offsets.getEndingOffset();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -292,8 +292,8 @@ public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory
|
|||
return true; // we have no information to say that it is not
|
||||
}
|
||||
|
||||
public IASTParameterDeclaration createParameterDeclaration(boolean isConst, boolean isVolatile, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp, String parameterName, IASTInitializerClause initializerClause)
|
||||
public IASTParameterDeclaration createParameterDeclaration(boolean isConst, boolean isVolatile, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp, String parameterName, IASTInitializerClause initializerClause, int startingOffset, int endingOffset, int nameOffset)
|
||||
{
|
||||
return new ASTParameterDeclaration( isConst, isVolatile, typeSpecifier, pointerOperators, arrayModifiers, parameters, pointerOp, parameterName, initializerClause );
|
||||
return new ASTParameterDeclaration( isConst, isVolatile, typeSpecifier, pointerOperators, arrayModifiers, parameters, pointerOp, parameterName, initializerClause, startingOffset, endingOffset, nameOffset );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue