1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-06 17:26:01 +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 * @author jcamelon
*/ */
public class CASTFunctionDefinition extends ASTNode implements public class CASTFunctionDefinition extends ASTNode implements IASTFunctionDefinition, IASTAmbiguityParent {
IASTFunctionDefinition, IASTAmbiguityParent {
private IASTDeclSpecifier declSpecifier; private IASTDeclSpecifier declSpecifier;
private IASTFunctionDeclarator declarator; private IASTFunctionDeclarator declarator;
private IASTStatement bodyStatement; private IASTStatement bodyStatement;
private ICFunctionScope scope; private ICFunctionScope scope;
public CASTFunctionDefinition() { public CASTFunctionDefinition() {
} }
public CASTFunctionDefinition(IASTDeclSpecifier declSpecifier, public CASTFunctionDefinition(IASTDeclSpecifier declSpecifier, IASTFunctionDeclarator declarator,
IASTFunctionDeclarator declarator, IASTStatement bodyStatement) { IASTStatement bodyStatement) {
setDeclSpecifier(declSpecifier); setDeclSpecifier(declSpecifier);
setDeclarator(declarator); setDeclarator(declarator);
setBody(bodyStatement); setBody(bodyStatement);
@ -116,10 +114,10 @@ public class CASTFunctionDefinition extends ASTNode implements
} }
} }
if( declSpecifier != null ) if( !declSpecifier.accept( action ) ) return false; if (declSpecifier != null && !declSpecifier.accept(action)) return false;
final IASTDeclarator outerDtor= CVisitor.findOutermostDeclarator(declarator); final IASTDeclarator outerDtor= CVisitor.findOutermostDeclarator(declarator);
if( outerDtor != null ) if( !outerDtor.accept( action ) ) return false; if (outerDtor != null && !outerDtor.accept(action)) return false;
if( bodyStatement != null ) if( !bodyStatement.accept( action ) ) return false; if (bodyStatement != null && !bodyStatement.accept(action)) return false;
if (action.shouldVisitDeclarations) { if (action.shouldVisitDeclarations) {
switch (action.leave(this)) { switch (action.leave(this)) {
@ -132,8 +130,7 @@ public class CASTFunctionDefinition extends ASTNode implements
} }
public void replace(IASTNode child, IASTNode other) { public void replace(IASTNode child, IASTNode other) {
if( bodyStatement == child ) if (bodyStatement == child) {
{
other.setPropertyInParent(bodyStatement.getPropertyInParent()); other.setPropertyInParent(bodyStatement.getPropertyInParent());
other.setParent(bodyStatement.getParent()); other.setParent(bodyStatement.getParent());
bodyStatement = (IASTStatement) other; bodyStatement = (IASTStatement) other;

View file

@ -208,14 +208,14 @@ public class CPPASTFieldReference extends ASTNode implements
IBinding[] bindings = CPPSemantics.findBindingsForContentAssist(n, isPrefix); IBinding[] bindings = CPPSemantics.findBindingsForContentAssist(n, isPrefix);
List<IBinding> filtered = new ArrayList<IBinding>(); List<IBinding> filtered = new ArrayList<IBinding>();
for (int i = 0; i < bindings.length; i++) { for (IBinding binding : bindings) {
if (bindings[i] instanceof ICPPMethod) { if (binding instanceof ICPPMethod) {
ICPPMethod method = (ICPPMethod) bindings[i]; ICPPMethod method = (ICPPMethod) binding;
if (method.isImplicit()) { if (method.isImplicit()) {
continue; continue;
} }
} }
filtered.add(bindings[i]); filtered.add(binding);
} }
return filtered.toArray(new IBinding[filtered.size()]); 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(); final IBinding binding= name.resolveBinding();
if (binding instanceof IParameter) { if (binding instanceof IParameter) {
result[i]= (IParameter) binding; result[i]= (IParameter) binding;
} } else {
else {
result[i] = new CPPParameter.CPPParameterProblem(p, IProblemBinding.SEMANTIC_INVALID_TYPE, result[i] = new CPPParameter.CPPParameterProblem(p, IProblemBinding.SEMANTIC_INVALID_TYPE,
name.toCharArray()); name.toCharArray());
} }

View file

@ -278,12 +278,8 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer
} }
} }
protected void handleBinding(IBinding binding, protected void handleBinding(IBinding binding, CContentAssistInvocationContext cContext, String prefix,
CContentAssistInvocationContext cContext, IASTCompletionContext astContext, List<ICompletionProposal> proposals) {
String prefix,
IASTCompletionContext astContext,
List<ICompletionProposal> proposals) {
if ((binding instanceof CPPImplicitFunction if ((binding instanceof CPPImplicitFunction
|| binding instanceof CPPImplicitFunctionTemplate || binding instanceof CPPImplicitFunctionTemplate
|| binding instanceof CPPImplicitTypedef || binding instanceof CPPImplicitTypedef