1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-06 09:16:02 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2009-10-06 05:58:08 +00:00
parent dbec91987b
commit 1c2270f0cb
5 changed files with 34 additions and 42 deletions

View file

@ -26,20 +26,18 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
/**
* @author jcamelon
*/
public class CASTFunctionDefinition extends ASTNode implements
IASTFunctionDefinition, IASTAmbiguityParent {
public class CASTFunctionDefinition extends ASTNode implements IASTFunctionDefinition, IASTAmbiguityParent {
private IASTDeclSpecifier declSpecifier;
private IASTFunctionDeclarator declarator;
private IASTStatement bodyStatement;
private ICFunctionScope scope;
public CASTFunctionDefinition() {
}
public CASTFunctionDefinition(IASTDeclSpecifier declSpecifier,
IASTFunctionDeclarator declarator, IASTStatement bodyStatement) {
public CASTFunctionDefinition(IASTDeclSpecifier declSpecifier, IASTFunctionDeclarator declarator,
IASTStatement bodyStatement) {
setDeclSpecifier(declSpecifier);
setDeclarator(declarator);
setBody(bodyStatement);
@ -49,10 +47,10 @@ public class CASTFunctionDefinition extends ASTNode implements
CASTFunctionDefinition copy = new CASTFunctionDefinition();
copy.setDeclSpecifier(declSpecifier == null ? null : declSpecifier.copy());
if(declarator != null) {
if (declarator != null) {
IASTDeclarator outer = CVisitor.findOutermostDeclarator(declarator);
outer = outer.copy();
copy.setDeclarator((IASTFunctionDeclarator)CVisitor.findTypeRelevantDeclarator(outer));
copy.setDeclarator((IASTFunctionDeclarator) CVisitor.findTypeRelevantDeclarator(outer));
}
copy.setBody(bodyStatement == null ? null : bodyStatement.copy());
@ -101,41 +99,40 @@ public class CASTFunctionDefinition extends ASTNode implements
}
public IScope getScope() {
if( scope == null )
scope = new CFunctionScope( this );
if (scope == null)
scope = new CFunctionScope(this);
return scope;
}
@Override
public boolean accept( ASTVisitor action ){
if( action.shouldVisitDeclarations ){
switch( action.visit( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
public boolean accept(ASTVisitor action) {
if (action.shouldVisitDeclarations) {
switch (action.visit(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
if( declSpecifier != null ) if( !declSpecifier.accept( action ) ) return false;
if (declSpecifier != null && !declSpecifier.accept(action)) return false;
final IASTDeclarator outerDtor= CVisitor.findOutermostDeclarator(declarator);
if( outerDtor != null ) if( !outerDtor.accept( action ) ) return false;
if( bodyStatement != null ) if( !bodyStatement.accept( action ) ) return false;
if (outerDtor != null && !outerDtor.accept(action)) return false;
if (bodyStatement != null && !bodyStatement.accept(action)) return false;
if( action.shouldVisitDeclarations ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
if (action.shouldVisitDeclarations) {
switch (action.leave(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
return true;
}
public void replace(IASTNode child, IASTNode other) {
if( bodyStatement == child )
{
other.setPropertyInParent( bodyStatement.getPropertyInParent() );
other.setParent( bodyStatement.getParent() );
if (bodyStatement == child) {
other.setPropertyInParent(bodyStatement.getPropertyInParent());
other.setParent(bodyStatement.getParent());
bodyStatement = (IASTStatement) other;
}
}

View file

@ -208,14 +208,14 @@ public class CPPASTFieldReference extends ASTNode implements
IBinding[] bindings = CPPSemantics.findBindingsForContentAssist(n, isPrefix);
List<IBinding> filtered = new ArrayList<IBinding>();
for (int i = 0; i < bindings.length; i++) {
if (bindings[i] instanceof ICPPMethod) {
ICPPMethod method = (ICPPMethod) bindings[i];
for (IBinding binding : bindings) {
if (binding instanceof ICPPMethod) {
ICPPMethod method = (ICPPMethod) binding;
if (method.isImplicit()) {
continue;
}
}
filtered.add(bindings[i]);
filtered.add(binding);
}
return filtered.toArray(new IBinding[filtered.size()]);

View file

@ -217,8 +217,7 @@ public class CPPFunction extends PlatformObject implements ICPPFunction, ICPPInt
final IBinding binding= name.resolveBinding();
if (binding instanceof IParameter) {
result[i]= (IParameter) binding;
}
else {
} else {
result[i] = new CPPParameter.CPPParameterProblem(p, IProblemBinding.SEMANTIC_INVALID_TYPE,
name.toCharArray());
}

View file

@ -99,7 +99,7 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer
List<ICompletionProposal> proposals = new ArrayList<ICompletionProposal>();
if(inPreprocessorDirective(context)) {
if (inPreprocessorDirective(context)) {
if (!inPreprocessorKeyword(context)) {
// add only macros
if (prefix.length() == 0) {
@ -278,12 +278,8 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer
}
}
protected void handleBinding(IBinding binding,
CContentAssistInvocationContext cContext,
String prefix,
IASTCompletionContext astContext,
List<ICompletionProposal> proposals) {
protected void handleBinding(IBinding binding, CContentAssistInvocationContext cContext, String prefix,
IASTCompletionContext astContext, List<ICompletionProposal> proposals) {
if ((binding instanceof CPPImplicitFunction
|| binding instanceof CPPImplicitFunctionTemplate
|| binding instanceof CPPImplicitTypedef