mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-04 23:05:47 +02:00
@Override annotations.
This commit is contained in:
parent
6da58da8f8
commit
76e962ee9b
4 changed files with 97 additions and 69 deletions
|
@ -6,8 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* John Camelon (IBM) - Initial API and implementation
|
* John Camelon (IBM) - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.dom.ast.cpp;
|
package org.eclipse.cdt.core.dom.ast.cpp;
|
||||||
|
|
||||||
|
@ -22,10 +22,8 @@ import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
*/
|
*/
|
||||||
public interface ICPPASTCompositeTypeSpecifier extends IASTCompositeTypeSpecifier, ICPPASTDeclSpecifier {
|
public interface ICPPASTCompositeTypeSpecifier extends IASTCompositeTypeSpecifier, ICPPASTDeclSpecifier {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <code>k_class</code> C++ introduces the class concept for composite
|
* <code>k_class</code> C++ introduces the class concept for composite types.
|
||||||
* types.
|
|
||||||
*/
|
*/
|
||||||
public static final int k_class = IASTCompositeTypeSpecifier.k_last + 1;
|
public static final int k_class = IASTCompositeTypeSpecifier.k_last + 1;
|
||||||
|
|
||||||
|
@ -52,15 +50,14 @@ public interface ICPPASTCompositeTypeSpecifier extends IASTCompositeTypeSpecifie
|
||||||
*
|
*
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
*/
|
*/
|
||||||
public static interface ICPPASTBaseSpecifier extends IASTNode, IASTNameOwner, ICPPASTPackExpandable {
|
public static interface ICPPASTBaseSpecifier extends IASTNode, IASTNameOwner, ICPPASTPackExpandable {
|
||||||
public static final ICPPASTBaseSpecifier[] EMPTY_BASESPECIFIER_ARRAY = new ICPPASTBaseSpecifier[0];
|
public static final ICPPASTBaseSpecifier[] EMPTY_BASESPECIFIER_ARRAY = {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Relation between base specifier and its name.
|
* Relation between base specifier and its name.
|
||||||
*/
|
*/
|
||||||
public static final ASTNodeProperty NAME = new ASTNodeProperty(
|
public static final ASTNodeProperty NAME = new ASTNodeProperty(
|
||||||
"ICPPASTBaseSpecifier.NAME - Name of base class"); //$NON-NLS-1$
|
"ICPPASTBaseSpecifier.NAME - Name of base class"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
|
||||||
public static final int v_public = 1;
|
public static final int v_public = 1;
|
||||||
public static final int v_protected = 2;
|
public static final int v_protected = 2;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* John Camelon (IBM) - Initial API and implementation
|
* John Camelon (IBM) - Initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.dom.ast.cpp;
|
package org.eclipse.cdt.core.dom.ast.cpp;
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@ import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
*/
|
*/
|
||||||
public interface ICPPASTVisibilityLabel extends IASTDeclaration {
|
public interface ICPPASTVisibilityLabel extends IASTDeclaration {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <code>v_public</code> == public:
|
* <code>v_public</code> == public:
|
||||||
*/
|
*/
|
||||||
|
@ -37,28 +36,28 @@ public interface ICPPASTVisibilityLabel extends IASTDeclaration {
|
||||||
public static final int v_private = 3;
|
public static final int v_private = 3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the visibility.
|
* Returns the visibility.
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public int getVisibility();
|
public int getVisibility();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set visibility.
|
* Sets visibility.
|
||||||
*
|
*
|
||||||
* @param visibility
|
* @param visibility one of v_public, v_protected, v_private
|
||||||
* int
|
|
||||||
*/
|
*/
|
||||||
public void setVisibility(int visibility);
|
public void setVisibility(int visibility);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 5.1
|
* @since 5.1
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public ICPPASTVisibilityLabel copy();
|
public ICPPASTVisibilityLabel copy();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 5.3
|
* @since 5.3
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public ICPPASTVisibilityLabel copy(CopyStyle style);
|
public ICPPASTVisibilityLabel copy(CopyStyle style);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* John Camelon (IBM Rational Software) - Initial API and implementation
|
* John Camelon (IBM Rational Software) - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
@ -27,13 +27,12 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
||||||
*/
|
*/
|
||||||
public class CASTCompositeTypeSpecifier extends CASTBaseDeclSpecifier implements
|
public class CASTCompositeTypeSpecifier extends CASTBaseDeclSpecifier implements
|
||||||
ICASTCompositeTypeSpecifier, IASTAmbiguityParent {
|
ICASTCompositeTypeSpecifier, IASTAmbiguityParent {
|
||||||
|
|
||||||
private int fKey;
|
private int fKey;
|
||||||
private IASTName fName;
|
private IASTName fName;
|
||||||
private IASTDeclaration[] fActiveDeclarations= null;
|
private IASTDeclaration[] fActiveDeclarations;
|
||||||
private IASTDeclaration [] fAllDeclarations = null;
|
private IASTDeclaration[] fAllDeclarations;
|
||||||
private int fDeclarationsPos=-1;
|
private int fDeclarationsPos = -1;
|
||||||
private IScope fScope = null;
|
private IScope fScope;
|
||||||
|
|
||||||
public CASTCompositeTypeSpecifier() {
|
public CASTCompositeTypeSpecifier() {
|
||||||
}
|
}
|
||||||
|
@ -43,10 +42,12 @@ public class CASTCompositeTypeSpecifier extends CASTBaseDeclSpecifier implements
|
||||||
setName(name);
|
setName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public CASTCompositeTypeSpecifier copy() {
|
public CASTCompositeTypeSpecifier copy() {
|
||||||
return copy(CopyStyle.withoutLocations);
|
return copy(CopyStyle.withoutLocations);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public CASTCompositeTypeSpecifier copy(CopyStyle style) {
|
public CASTCompositeTypeSpecifier copy(CopyStyle style) {
|
||||||
CASTCompositeTypeSpecifier copy = new CASTCompositeTypeSpecifier();
|
CASTCompositeTypeSpecifier copy = new CASTCompositeTypeSpecifier();
|
||||||
copyCompositeTypeSpecifier(copy, style);
|
copyCompositeTypeSpecifier(copy, style);
|
||||||
|
@ -60,24 +61,28 @@ public class CASTCompositeTypeSpecifier extends CASTBaseDeclSpecifier implements
|
||||||
copyBaseDeclSpec(copy);
|
copyBaseDeclSpec(copy);
|
||||||
copy.setKey(fKey);
|
copy.setKey(fKey);
|
||||||
copy.setName(fName == null ? null : fName.copy(style));
|
copy.setName(fName == null ? null : fName.copy(style));
|
||||||
for(IASTDeclaration member : getMembers())
|
for (IASTDeclaration member : getMembers())
|
||||||
copy.addMemberDeclaration(member == null ? null : member.copy(style));
|
copy.addMemberDeclaration(member == null ? null : member.copy(style));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getKey() {
|
@Override
|
||||||
|
public int getKey() {
|
||||||
return fKey;
|
return fKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setKey(int key) {
|
@Override
|
||||||
|
public void setKey(int key) {
|
||||||
assertNotFrozen();
|
assertNotFrozen();
|
||||||
this.fKey = key;
|
this.fKey = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTName getName() {
|
@Override
|
||||||
|
public IASTName getName() {
|
||||||
return fName;
|
return fName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(IASTName name) {
|
@Override
|
||||||
|
public void setName(IASTName name) {
|
||||||
assertNotFrozen();
|
assertNotFrozen();
|
||||||
this.fName = name;
|
this.fName = name;
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
|
@ -86,51 +91,57 @@ public class CASTCompositeTypeSpecifier extends CASTBaseDeclSpecifier implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IASTDeclaration[] getMembers() {
|
public IASTDeclaration[] getMembers() {
|
||||||
IASTDeclaration[] active= fActiveDeclarations;
|
IASTDeclaration[] active= fActiveDeclarations;
|
||||||
if (active == null) {
|
if (active == null) {
|
||||||
active = ASTQueries.extractActiveDeclarations(fAllDeclarations, fDeclarationsPos+1);
|
active = ASTQueries.extractActiveDeclarations(fAllDeclarations, fDeclarationsPos + 1);
|
||||||
fActiveDeclarations= active;
|
fActiveDeclarations= active;
|
||||||
}
|
}
|
||||||
return active;
|
return active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final IASTDeclaration[] getDeclarations(boolean includeInactive) {
|
public final IASTDeclaration[] getDeclarations(boolean includeInactive) {
|
||||||
if (includeInactive) {
|
if (includeInactive) {
|
||||||
fAllDeclarations= (IASTDeclaration[]) ArrayUtil.removeNullsAfter(IASTDeclaration.class, fAllDeclarations, fDeclarationsPos);
|
fAllDeclarations= ArrayUtil.trimAt(IASTDeclaration.class, fAllDeclarations,
|
||||||
|
fDeclarationsPos);
|
||||||
return fAllDeclarations;
|
return fAllDeclarations;
|
||||||
}
|
}
|
||||||
return getMembers();
|
return getMembers();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addMemberDeclaration(IASTDeclaration declaration) {
|
@Override
|
||||||
|
public void addMemberDeclaration(IASTDeclaration declaration) {
|
||||||
assertNotFrozen();
|
assertNotFrozen();
|
||||||
if (declaration != null) {
|
if (declaration != null) {
|
||||||
declaration.setParent(this);
|
declaration.setParent(this);
|
||||||
declaration.setPropertyInParent(MEMBER_DECLARATION);
|
declaration.setPropertyInParent(MEMBER_DECLARATION);
|
||||||
fAllDeclarations = (IASTDeclaration[]) ArrayUtil.append(IASTDeclaration.class, fAllDeclarations,
|
fAllDeclarations = ArrayUtil.appendAt(IASTDeclaration.class, fAllDeclarations,
|
||||||
++fDeclarationsPos, declaration);
|
++fDeclarationsPos, declaration);
|
||||||
fActiveDeclarations= null;
|
fActiveDeclarations= null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addDeclaration(IASTDeclaration declaration) {
|
@Override
|
||||||
|
public void addDeclaration(IASTDeclaration declaration) {
|
||||||
addMemberDeclaration(declaration);
|
addMemberDeclaration(declaration);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IScope getScope() {
|
@Override
|
||||||
if( fScope == null )
|
public IScope getScope() {
|
||||||
fScope = new CCompositeTypeScope( this );
|
if (fScope == null)
|
||||||
|
fScope = new CCompositeTypeScope(this);
|
||||||
return fScope;
|
return fScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept(ASTVisitor action){
|
||||||
if (action.shouldVisitDeclSpecifiers) {
|
if (action.shouldVisitDeclSpecifiers) {
|
||||||
switch (action.visit(this)) {
|
switch (action.visit(this)) {
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fName != null && !fName.accept(action))
|
if (fName != null && !fName.accept(action))
|
||||||
|
@ -138,7 +149,8 @@ public class CASTCompositeTypeSpecifier extends CASTBaseDeclSpecifier implements
|
||||||
|
|
||||||
IASTDeclaration[] decls= getDeclarations(action.includeInactiveNodes);
|
IASTDeclaration[] decls= getDeclarations(action.includeInactiveNodes);
|
||||||
for (int i = 0; i < decls.length; i++) {
|
for (int i = 0; i < decls.length; i++) {
|
||||||
if (!decls[i].accept(action)) return false;
|
if (!decls[i].accept(action))
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action.shouldVisitDeclSpecifiers) {
|
if (action.shouldVisitDeclSpecifiers) {
|
||||||
|
@ -151,13 +163,15 @@ public class CASTCompositeTypeSpecifier extends CASTBaseDeclSpecifier implements
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getRoleForName(IASTName n) {
|
public int getRoleForName(IASTName n) {
|
||||||
if( n == this.fName )
|
if (n == this.fName)
|
||||||
return r_definition;
|
return r_definition;
|
||||||
return r_unclear;
|
return r_unclear;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void replace(IASTNode child, IASTNode other) {
|
@Override
|
||||||
|
public void replace(IASTNode child, IASTNode other) {
|
||||||
assert child.isActive() == other.isActive();
|
assert child.isActive() == other.isActive();
|
||||||
for (int i = 0; i <= fDeclarationsPos; ++i) {
|
for (int i = 0; i <= fDeclarationsPos; ++i) {
|
||||||
if (fAllDeclarations[i] == child) {
|
if (fAllDeclarations[i] == child) {
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* John Camelon (IBM) - Initial API and implementation
|
* John Camelon (IBM) - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
@ -27,17 +27,15 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
||||||
*/
|
*/
|
||||||
public class CPPASTCompositeTypeSpecifier extends CPPASTBaseDeclSpecifier
|
public class CPPASTCompositeTypeSpecifier extends CPPASTBaseDeclSpecifier
|
||||||
implements ICPPASTCompositeTypeSpecifier, IASTAmbiguityParent {
|
implements ICPPASTCompositeTypeSpecifier, IASTAmbiguityParent {
|
||||||
|
|
||||||
private int fKey;
|
private int fKey;
|
||||||
private IASTName fName;
|
private IASTName fName;
|
||||||
private CPPClassScope fScope;
|
private CPPClassScope fScope;
|
||||||
private IASTDeclaration[] fAllDeclarations;
|
private IASTDeclaration[] fAllDeclarations;
|
||||||
private IASTDeclaration[] fActiveDeclarations;
|
private IASTDeclaration[] fActiveDeclarations;
|
||||||
private int fDeclarationsPos=-1;
|
private int fDeclarationsPos = -1;
|
||||||
private ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier[] baseSpecs = null;
|
private ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier[] baseSpecs;
|
||||||
private int baseSpecsPos = -1;
|
private int baseSpecsPos = -1;
|
||||||
private boolean fAmbiguitiesResolved= false;
|
private boolean fAmbiguitiesResolved;
|
||||||
|
|
||||||
|
|
||||||
public CPPASTCompositeTypeSpecifier() {
|
public CPPASTCompositeTypeSpecifier() {
|
||||||
}
|
}
|
||||||
|
@ -54,13 +52,15 @@ public class CPPASTCompositeTypeSpecifier extends CPPASTBaseDeclSpecifier
|
||||||
fAmbiguitiesResolved= true;
|
fAmbiguitiesResolved= true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public CPPASTCompositeTypeSpecifier copy() {
|
public CPPASTCompositeTypeSpecifier copy() {
|
||||||
return copy(CopyStyle.withoutLocations);
|
return copy(CopyStyle.withoutLocations);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public CPPASTCompositeTypeSpecifier copy(CopyStyle style) {
|
public CPPASTCompositeTypeSpecifier copy(CopyStyle style) {
|
||||||
CPPASTCompositeTypeSpecifier copy = new CPPASTCompositeTypeSpecifier(fKey, fName == null
|
CPPASTCompositeTypeSpecifier copy =
|
||||||
? null : fName.copy(style));
|
new CPPASTCompositeTypeSpecifier(fKey, fName == null ? null : fName.copy(style));
|
||||||
copyBaseDeclSpec(copy);
|
copyBaseDeclSpec(copy);
|
||||||
for (IASTDeclaration member : getMembers())
|
for (IASTDeclaration member : getMembers())
|
||||||
copy.addMemberDeclaration(member == null ? null : member.copy(style));
|
copy.addMemberDeclaration(member == null ? null : member.copy(style));
|
||||||
|
@ -73,35 +73,43 @@ public class CPPASTCompositeTypeSpecifier extends CPPASTBaseDeclSpecifier
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICPPASTBaseSpecifier[] getBaseSpecifiers() {
|
@Override
|
||||||
if( baseSpecs == null ) return ICPPASTBaseSpecifier.EMPTY_BASESPECIFIER_ARRAY;
|
public ICPPASTBaseSpecifier[] getBaseSpecifiers() {
|
||||||
baseSpecs = (ICPPASTBaseSpecifier[]) ArrayUtil.removeNullsAfter( ICPPASTBaseSpecifier.class, baseSpecs, baseSpecsPos );
|
if (baseSpecs == null)
|
||||||
|
return ICPPASTBaseSpecifier.EMPTY_BASESPECIFIER_ARRAY;
|
||||||
|
baseSpecs = ArrayUtil.trimAt(ICPPASTBaseSpecifier.class, baseSpecs, baseSpecsPos);
|
||||||
return baseSpecs;
|
return baseSpecs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addBaseSpecifier(ICPPASTBaseSpecifier baseSpec) {
|
@Override
|
||||||
|
public void addBaseSpecifier(ICPPASTBaseSpecifier baseSpec) {
|
||||||
assertNotFrozen();
|
assertNotFrozen();
|
||||||
if (baseSpec != null) {
|
if (baseSpec != null) {
|
||||||
baseSpec.setParent(this);
|
baseSpec.setParent(this);
|
||||||
baseSpec.setPropertyInParent(BASE_SPECIFIER);
|
baseSpec.setPropertyInParent(BASE_SPECIFIER);
|
||||||
baseSpecs = (ICPPASTBaseSpecifier[]) ArrayUtil.append( ICPPASTBaseSpecifier.class, baseSpecs, ++baseSpecsPos, baseSpec );
|
baseSpecs = ArrayUtil.appendAt(ICPPASTBaseSpecifier.class, baseSpecs, ++baseSpecsPos,
|
||||||
|
baseSpec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getKey() {
|
@Override
|
||||||
|
public int getKey() {
|
||||||
return fKey;
|
return fKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setKey(int key) {
|
@Override
|
||||||
|
public void setKey(int key) {
|
||||||
assertNotFrozen();
|
assertNotFrozen();
|
||||||
fKey = key;
|
fKey = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTName getName() {
|
@Override
|
||||||
|
public IASTName getName() {
|
||||||
return fName;
|
return fName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(IASTName name) {
|
@Override
|
||||||
|
public void setName(IASTName name) {
|
||||||
assertNotFrozen();
|
assertNotFrozen();
|
||||||
this.fName = name;
|
this.fName = name;
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
|
@ -110,23 +118,27 @@ public class CPPASTCompositeTypeSpecifier extends CPPASTBaseDeclSpecifier
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IASTDeclaration[] getMembers() {
|
public IASTDeclaration[] getMembers() {
|
||||||
IASTDeclaration[] active= fActiveDeclarations;
|
IASTDeclaration[] active= fActiveDeclarations;
|
||||||
if (active == null) {
|
if (active == null) {
|
||||||
active = ASTQueries.extractActiveDeclarations(fAllDeclarations, fDeclarationsPos+1);
|
active = ASTQueries.extractActiveDeclarations(fAllDeclarations, fDeclarationsPos + 1);
|
||||||
fActiveDeclarations= active;
|
fActiveDeclarations= active;
|
||||||
}
|
}
|
||||||
return active;
|
return active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final IASTDeclaration[] getDeclarations(boolean includeInactive) {
|
public final IASTDeclaration[] getDeclarations(boolean includeInactive) {
|
||||||
if (includeInactive) {
|
if (includeInactive) {
|
||||||
fAllDeclarations= (IASTDeclaration[]) ArrayUtil.removeNullsAfter(IASTDeclaration.class, fAllDeclarations, fDeclarationsPos);
|
fAllDeclarations= ArrayUtil.trimAt(IASTDeclaration.class, fAllDeclarations,
|
||||||
|
fDeclarationsPos);
|
||||||
return fAllDeclarations;
|
return fAllDeclarations;
|
||||||
}
|
}
|
||||||
return getMembers();
|
return getMembers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void addMemberDeclaration(IASTDeclaration decl) {
|
public void addMemberDeclaration(IASTDeclaration decl) {
|
||||||
if (decl == null)
|
if (decl == null)
|
||||||
return;
|
return;
|
||||||
|
@ -138,15 +150,17 @@ public class CPPASTCompositeTypeSpecifier extends CPPASTBaseDeclSpecifier
|
||||||
assertNotFrozen();
|
assertNotFrozen();
|
||||||
decl.setParent(this);
|
decl.setParent(this);
|
||||||
decl.setPropertyInParent(decl instanceof ICPPASTVisibilityLabel ? VISIBILITY_LABEL : MEMBER_DECLARATION);
|
decl.setPropertyInParent(decl instanceof ICPPASTVisibilityLabel ? VISIBILITY_LABEL : MEMBER_DECLARATION);
|
||||||
fAllDeclarations = (IASTDeclaration[]) ArrayUtil.append(IASTDeclaration.class, fAllDeclarations,
|
fAllDeclarations = ArrayUtil.appendAt(IASTDeclaration.class, fAllDeclarations,
|
||||||
++fDeclarationsPos, decl);
|
++fDeclarationsPos, decl);
|
||||||
fActiveDeclarations= null;
|
fActiveDeclarations= null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void addDeclaration(IASTDeclaration decl) {
|
@Override
|
||||||
|
public final void addDeclaration(IASTDeclaration decl) {
|
||||||
addMemberDeclaration(decl);
|
addMemberDeclaration(decl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICPPClassScope getScope() {
|
public ICPPClassScope getScope() {
|
||||||
if (fScope == null) {
|
if (fScope == null) {
|
||||||
fScope = new CPPClassScope(this);
|
fScope = new CPPClassScope(this);
|
||||||
|
@ -172,12 +186,14 @@ public class CPPASTCompositeTypeSpecifier extends CPPASTBaseDeclSpecifier
|
||||||
|
|
||||||
ICPPASTBaseSpecifier[] bases = getBaseSpecifiers();
|
ICPPASTBaseSpecifier[] bases = getBaseSpecifiers();
|
||||||
for (int i = 0; i < bases.length; i++) {
|
for (int i = 0; i < bases.length; i++) {
|
||||||
if (!bases[i].accept(action)) return false;
|
if (!bases[i].accept(action))
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
IASTDeclaration[] decls = getDeclarations(action.includeInactiveNodes);
|
IASTDeclaration[] decls = getDeclarations(action.includeInactiveNodes);
|
||||||
for (int i = 0; i < decls.length; i++) {
|
for (int i = 0; i < decls.length; i++) {
|
||||||
if (!decls[i].accept(action)) return false;
|
if (!decls[i].accept(action))
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action.shouldVisitDeclSpecifiers && action.leave(this) == ASTVisitor.PROCESS_ABORT)
|
if (action.shouldVisitDeclSpecifiers && action.leave(this) == ASTVisitor.PROCESS_ABORT)
|
||||||
|
@ -186,12 +202,14 @@ public class CPPASTCompositeTypeSpecifier extends CPPASTBaseDeclSpecifier
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getRoleForName(IASTName name) {
|
public int getRoleForName(IASTName name) {
|
||||||
if( name == this.fName )
|
if (name == this.fName)
|
||||||
return r_definition;
|
return r_definition;
|
||||||
return r_unclear;
|
return r_unclear;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void replace(IASTNode child, IASTNode other) {
|
public void replace(IASTNode child, IASTNode other) {
|
||||||
assert child.isActive() == other.isActive();
|
assert child.isActive() == other.isActive();
|
||||||
for (int i = 0; i <= fDeclarationsPos; ++i) {
|
for (int i = 0; i <= fDeclarationsPos; ++i) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue