mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Code streamlining.
This commit is contained in:
parent
1dc9ba63a5
commit
e0111b55dc
1 changed files with 18 additions and 24 deletions
|
@ -19,15 +19,9 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*/
|
*/
|
||||||
public class CPPASTNamespaceAlias extends ASTNode implements ICPPASTNamespaceAlias {
|
public class CPPASTNamespaceAlias extends ASTNode implements ICPPASTNamespaceAlias {
|
||||||
|
|
||||||
private IASTName alias;
|
private IASTName alias;
|
||||||
private IASTName qualifiedName;
|
private IASTName qualifiedName;
|
||||||
|
|
||||||
|
|
||||||
public CPPASTNamespaceAlias() {
|
|
||||||
// default constructor
|
|
||||||
}
|
|
||||||
|
|
||||||
public CPPASTNamespaceAlias(IASTName alias, IASTName qualifiedName) {
|
public CPPASTNamespaceAlias(IASTName alias, IASTName qualifiedName) {
|
||||||
setAlias(alias);
|
setAlias(alias);
|
||||||
setMappingName(qualifiedName);
|
setMappingName(qualifiedName);
|
||||||
|
@ -38,9 +32,9 @@ public class CPPASTNamespaceAlias extends ASTNode implements ICPPASTNamespaceAli
|
||||||
}
|
}
|
||||||
|
|
||||||
public CPPASTNamespaceAlias copy(CopyStyle style) {
|
public CPPASTNamespaceAlias copy(CopyStyle style) {
|
||||||
CPPASTNamespaceAlias copy = new CPPASTNamespaceAlias();
|
CPPASTNamespaceAlias copy = new CPPASTNamespaceAlias(
|
||||||
copy.setAlias(alias == null ? null : alias.copy(style));
|
alias == null ? null : alias.copy(style),
|
||||||
copy.setMappingName(qualifiedName == null ? null : qualifiedName.copy(style));
|
qualifiedName == null ? null : qualifiedName.copy(style));
|
||||||
copy.setOffsetAndLength(this);
|
copy.setOffsetAndLength(this);
|
||||||
if (style == CopyStyle.withLocations) {
|
if (style == CopyStyle.withLocations) {
|
||||||
copy.setCopyLocation(this);
|
copy.setCopyLocation(this);
|
||||||
|
@ -75,31 +69,31 @@ public class CPPASTNamespaceAlias extends ASTNode implements ICPPASTNamespaceAli
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept(ASTVisitor action) {
|
||||||
if( action.shouldVisitDeclarations ){
|
if (action.shouldVisitDeclarations) {
|
||||||
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( alias != null ) if( !alias.accept( action ) ) return false;
|
if (alias != null && !alias.accept(action)) return false;
|
||||||
if( qualifiedName != null ) if( !qualifiedName.accept( action ) ) return false;
|
if (qualifiedName != null && !qualifiedName.accept(action)) return false;
|
||||||
|
|
||||||
if( action.shouldVisitDeclarations ){
|
if (action.shouldVisitDeclarations) {
|
||||||
switch( action.leave( this ) ){
|
switch (action.leave(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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRoleForName(IASTName n) {
|
public int getRoleForName(IASTName n) {
|
||||||
if( alias == n ) return r_definition;
|
if (alias == n) return r_definition;
|
||||||
if( qualifiedName == n ) return r_reference;
|
if (qualifiedName == n) return r_reference;
|
||||||
return r_unclear;
|
return r_unclear;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue