1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-07 08:15:48 +02:00

Add IASTFunction.setHasFunctionBody()/IASTFunction.getHasFunctionBody()

for the sake of the outline view.
This commit is contained in:
John Camelon 2003-07-22 18:32:40 +00:00
parent 4da2df9363
commit 1db528a01b
3 changed files with 36 additions and 2 deletions

View file

@ -26,6 +26,11 @@ public interface IASTFunction extends IASTScope, IASTOffsetableNamedElement, IAS
public IASTAbstractDeclaration getReturnType();
public Iterator getParameters();
public IASTExceptionSpecification getExceptionSpec();
public IASTExceptionSpecification getExceptionSpec();
/**
* @param b
*/
public void setHasFunctionBody(boolean b);
public boolean hasFunctionBody();
}

View file

@ -18,8 +18,10 @@ import java.util.NoSuchElementException;
import org.eclipse.cdt.core.parser.IQuickParseCallback;
import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException;
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
import org.eclipse.cdt.core.parser.ast.IASTFunction;
import org.eclipse.cdt.core.parser.ast.IASTInclusion;
import org.eclipse.cdt.core.parser.ast.IASTMacro;
import org.eclipse.cdt.core.parser.ast.IASTMethod;
import org.eclipse.cdt.core.parser.ast.IASTOffsetableElement;
@ -39,6 +41,20 @@ public class QuickParseCallback extends NullSourceElementRequestor implements IQ
return macros.iterator();
}
public void exitMethodBody( IASTMethod method )
{
method.setHasFunctionBody( true );
}
public void exitFunctionBody( IASTFunction function )
{
function.setHasFunctionBody( true );
}
public void exitCompilationUnit( IASTCompilationUnit compilationUnit )
{
this.compilationUnit = compilationUnit;

View file

@ -21,7 +21,7 @@ import org.eclipse.cdt.core.parser.ast.IASTFunction;
import org.eclipse.cdt.core.parser.ast.IASTQualifiedNameElement;
import org.eclipse.cdt.core.parser.ast.IASTScope;
import org.eclipse.cdt.core.parser.ast.IASTTemplate;
import org.eclipse.cdt.internal.core.parser.ast.*;
import org.eclipse.cdt.internal.core.parser.ast.ASTQualifiedNamedElement;
import org.eclipse.cdt.internal.core.parser.ast.NamedOffsets;
/**
@ -52,6 +52,7 @@ public class ASTFunction extends ASTDeclaration implements IASTFunction
qualifiedName = new ASTQualifiedNamedElement( scope, name );
}
private boolean hasFunctionBody = false;
private final IASTQualifiedNameElement qualifiedName;
private final IASTTemplate ownerTemplateDeclaration;
private NamedOffsets offsets = new NamedOffsets();
@ -198,4 +199,16 @@ public class ASTFunction extends ASTDeclaration implements IASTFunction
{
requestor.exitFunctionBody( this );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFunction#setHasFunctionBody(boolean)
*/
public void setHasFunctionBody(boolean b) {
hasFunctionBody = true;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFunction#hasFunctionBody()
*/
public boolean hasFunctionBody() {
return hasFunctionBody;
}
}