mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Cosmetics.
This commit is contained in:
parent
c40a860ba3
commit
723ed9f912
20 changed files with 154 additions and 230 deletions
|
@ -17,7 +17,6 @@ package org.eclipse.cdt.core.dom.ast;
|
|||
* @noimplement This interface is not intended to be implemented by clients.
|
||||
*/
|
||||
public interface IASTCompoundStatement extends IASTStatement {
|
||||
|
||||
/**
|
||||
* <code>NESTED_STATEMENT</code> represents the relationship between an
|
||||
* <code>IASTCompoundStatement</code> and its nested
|
||||
|
|
|
@ -6,11 +6,10 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
|
||||
/**
|
||||
* Initializer with equals sign (copy initialization) as in <code>int x= 0;</code>.
|
||||
* @since 5.2
|
||||
|
@ -21,7 +20,6 @@ package org.eclipse.cdt.core.dom.ast;
|
|||
public interface IASTEqualsInitializer extends IASTInitializer {
|
||||
ASTNodeProperty INITIALIZER = new ASTNodeProperty(
|
||||
"IASTEqualsInitializer - INITIALIZER [IASTInitializerClause]"); //$NON-NLS-1$
|
||||
|
||||
|
||||
/**
|
||||
* Returns the expression or braced initializer list of this initializer.
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Doug Schaefer (IBM) - Initial API and implementation
|
||||
* Doug Schaefer (IBM) - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
|
@ -18,7 +18,6 @@ package org.eclipse.cdt.core.dom.ast;
|
|||
* @noimplement This interface is not intended to be implemented by clients.
|
||||
*/
|
||||
public interface IASTFieldDeclarator extends IASTDeclarator {
|
||||
|
||||
/**
|
||||
* <code>FIELD_SIZE</code> represents the relationship between a
|
||||
* <code>IASTFieldDeclarator</code> and its <code>IASTExpression</code>.
|
||||
|
@ -27,15 +26,14 @@ public interface IASTFieldDeclarator extends IASTDeclarator {
|
|||
"IASTFieldDeclarator.FIELD_SIZE - BitField Size of IASTFieldDeclarator"); //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* This returns the number of bits if this is a bit field. If it is not a
|
||||
* bit field, it returns null.
|
||||
* Returns the number of bits if this is a bit field, otherwise {@code null}.
|
||||
*
|
||||
* @return size of bit field or null.
|
||||
*/
|
||||
public IASTExpression getBitFieldSize();
|
||||
|
||||
/**
|
||||
* Set the bitfield size.
|
||||
* Sets the bitfield size.
|
||||
*
|
||||
* @param size
|
||||
* <code>IASTExpression</code>
|
||||
|
|
|
@ -41,8 +41,7 @@ public interface IASTFunctionDefinition extends IASTDeclaration {
|
|||
"IASTFunctionDefinition.FUNCTION_BODY - Function Body for IASTFunctionDefinition"); //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Get the decl specifier for the function.
|
||||
*
|
||||
* Returns the decl specifier for the function.
|
||||
*/
|
||||
public IASTDeclSpecifier getDeclSpecifier();
|
||||
|
||||
|
@ -54,7 +53,7 @@ public interface IASTFunctionDefinition extends IASTDeclaration {
|
|||
public void setDeclSpecifier(IASTDeclSpecifier declSpec);
|
||||
|
||||
/**
|
||||
* Get the function declarator of the function.
|
||||
* Returns the function declarator of the function.
|
||||
* Note, that the function declarator may contain nested declarators and may also nest within
|
||||
* another declarator. In the latter case this function definition is always the parent of the
|
||||
* outermost declarator.
|
||||
|
@ -66,7 +65,7 @@ public interface IASTFunctionDefinition extends IASTDeclaration {
|
|||
public IASTFunctionDeclarator getDeclarator();
|
||||
|
||||
/**
|
||||
* Set the declarator for the function.
|
||||
* Sets the declarator for the function.
|
||||
* Note, that the function declarator may contain nested declarators and may also nest within
|
||||
* another declarator. In the latter case this function definition is set to be the parent of the
|
||||
* outermost declarator.
|
||||
|
@ -79,14 +78,14 @@ public interface IASTFunctionDefinition extends IASTDeclaration {
|
|||
public void setDeclarator(IASTFunctionDeclarator declarator);
|
||||
|
||||
/**
|
||||
* Get the body of the function. This is usually a compound statement but
|
||||
* Returns the body of the function. This is usually a compound statement but
|
||||
* C++ also has a function try block.
|
||||
*
|
||||
*/
|
||||
public IASTStatement getBody();
|
||||
|
||||
/**
|
||||
* Set the body of the function.
|
||||
* Sets the body of the function.
|
||||
*
|
||||
* @param statement
|
||||
*/
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Doug Schaefer (IBM) - Initial API and implementation
|
||||
* Doug Schaefer (IBM) - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
|
@ -17,11 +17,10 @@ package org.eclipse.cdt.core.dom.ast;
|
|||
* @noimplement This interface is not intended to be implemented by clients.
|
||||
*/
|
||||
public interface IASTInitializer extends IASTNode {
|
||||
|
||||
/**
|
||||
* Constant.
|
||||
*/
|
||||
public final static IASTInitializer[] EMPTY_INITIALIZER_ARRAY = new IASTInitializer[0];
|
||||
public final static IASTInitializer[] EMPTY_INITIALIZER_ARRAY = {};
|
||||
|
||||
/**
|
||||
* @since 5.1
|
||||
|
|
|
@ -36,7 +36,6 @@ public interface IASTInitializerList extends IASTInitializer, IASTInitializerCla
|
|||
*/
|
||||
public IASTInitializerClause[] getClauses();
|
||||
|
||||
|
||||
/**
|
||||
* Add an initializer clause to the initializer list. Depending on how the AST is created the
|
||||
* initializer may be <code>null</code>. A <code>null</code> initializer will not be returned
|
||||
|
|
|
@ -39,21 +39,21 @@ public interface IASTParameterDeclaration extends IASTNode {
|
|||
"IASTParameterDeclaration.DECLARATOR - IASTDeclarator for IASTParameterDeclaration"); //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Get the decl specifier.
|
||||
* Returns the decl specifier.
|
||||
*
|
||||
* @return <code>IASTDeclSpecifier</code>
|
||||
*/
|
||||
public IASTDeclSpecifier getDeclSpecifier();
|
||||
|
||||
/**
|
||||
* Get the declarator.
|
||||
* Returns the declarator.
|
||||
*
|
||||
* @return <code>IASTDeclarator</code>
|
||||
*/
|
||||
public IASTDeclarator getDeclarator();
|
||||
|
||||
/**
|
||||
* Set the decl specifier.
|
||||
* Sets the decl specifier.
|
||||
*
|
||||
* @param declSpec
|
||||
* <code>IASTDeclSpecifier</code>.
|
||||
|
@ -61,7 +61,7 @@ public interface IASTParameterDeclaration extends IASTNode {
|
|||
public void setDeclSpecifier(IASTDeclSpecifier declSpec);
|
||||
|
||||
/**
|
||||
* Set the declarator.
|
||||
* Sets the declarator.
|
||||
*
|
||||
* @param declarator
|
||||
* <code>IASTDeclarator</code>
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Doug Schaefer (IBM) - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Doug Schaefer (IBM) - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
|
@ -19,7 +19,7 @@ package org.eclipse.cdt.core.dom.ast;
|
|||
* @noimplement This interface is not intended to be implemented by clients.
|
||||
*/
|
||||
public interface IParameter extends IVariable {
|
||||
public static final IParameter [] EMPTY_PARAMETER_ARRAY = new IParameter[0];
|
||||
public static final IParameter [] EMPTY_PARAMETER_ARRAY = {};
|
||||
|
||||
/**
|
||||
* Inherited from {@link IVariable}, always returns <code>null</code>.
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
* IBM - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast.gnu.c;
|
||||
|
||||
|
@ -23,7 +23,6 @@ import org.eclipse.cdt.core.dom.ast.IASTName;
|
|||
* @noimplement This interface is not intended to be implemented by clients.
|
||||
*/
|
||||
public interface ICASTKnRFunctionDeclarator extends IASTFunctionDeclarator {
|
||||
|
||||
/**
|
||||
* <code>PARAMETER_NAME</code> refers to the names qualified in a K&R C
|
||||
* function definition.
|
||||
|
@ -31,21 +30,6 @@ public interface ICASTKnRFunctionDeclarator extends IASTFunctionDeclarator {
|
|||
public static final ASTNodeProperty PARAMETER_NAME = new ASTNodeProperty(
|
||||
"ICASTKnRFunctionDeclarator.PARAMETER_NAME - K&R Parameter Name"); //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Overwrite the parameter names. TODO - this should change to add
|
||||
*
|
||||
* @param names
|
||||
* <code>IASTName []</code>
|
||||
*/
|
||||
public void setParameterNames(IASTName[] names);
|
||||
|
||||
/**
|
||||
* Get parameter names.
|
||||
*
|
||||
* @return <code>IASTName []</code>
|
||||
*/
|
||||
public IASTName[] getParameterNames();
|
||||
|
||||
/**
|
||||
* <code>FUNCTION_PARAMETER</code> represents the relationship between an
|
||||
* K&R function declarator and the full parameter declarations.
|
||||
|
@ -54,7 +38,22 @@ public interface ICASTKnRFunctionDeclarator extends IASTFunctionDeclarator {
|
|||
"ICASTKnRFunctionDeclarator.FUNCTION_PARAMETER - Full K&R Parameter Declaration"); //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Overrwrite the parameter lists.
|
||||
* Sets the parameter names. TODO - this should change to add
|
||||
*
|
||||
* @param names
|
||||
* <code>IASTName []</code>
|
||||
*/
|
||||
public void setParameterNames(IASTName[] names);
|
||||
|
||||
/**
|
||||
* Returns parameter names.
|
||||
*
|
||||
* @return <code>IASTName []</code>
|
||||
*/
|
||||
public IASTName[] getParameterNames();
|
||||
|
||||
/**
|
||||
* Sets the parameter lists.
|
||||
*
|
||||
* @param decls
|
||||
* TODO - replace w/zadd
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* John Camelon (IBM Rational Software) - Initial API and implementation
|
||||
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* John Camelon (IBM Rational Software) - Initial API and implementation
|
||||
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||
|
||||
|
@ -28,9 +28,8 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
|||
/**
|
||||
* Binary expression for c
|
||||
*/
|
||||
public class CASTBinaryExpression extends ASTNode implements
|
||||
IASTBinaryExpression, IASTAmbiguityParent {
|
||||
|
||||
public class CASTBinaryExpression extends ASTNode
|
||||
implements IASTBinaryExpression, IASTAmbiguityParent {
|
||||
private int op;
|
||||
private IASTExpression operand1;
|
||||
private IASTExpression operand2;
|
||||
|
@ -112,13 +111,13 @@ public class CASTBinaryExpression extends ASTNode implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean accept( ASTVisitor action ){
|
||||
public boolean accept(ASTVisitor action) {
|
||||
if (operand1 instanceof IASTBinaryExpression || operand2 instanceof IASTBinaryExpression) {
|
||||
return acceptWithoutRecursion(this, action);
|
||||
}
|
||||
|
||||
if( action.shouldVisitExpressions ){
|
||||
switch( action.visit( this ) ){
|
||||
if (action.shouldVisitExpressions) {
|
||||
switch (action.visit(this)) {
|
||||
case ASTVisitor.PROCESS_ABORT : return false;
|
||||
case ASTVisitor.PROCESS_SKIP : return true;
|
||||
default : break;
|
||||
|
@ -153,7 +152,7 @@ public class CASTBinaryExpression extends ASTNode implements
|
|||
if (stack.fState == 0) {
|
||||
if (action.shouldVisitExpressions) {
|
||||
switch (action.visit(expr)) {
|
||||
case ASTVisitor.PROCESS_ABORT :
|
||||
case ASTVisitor.PROCESS_ABORT:
|
||||
return false;
|
||||
case ASTVisitor.PROCESS_SKIP:
|
||||
stack= stack.fNext;
|
||||
|
@ -197,16 +196,14 @@ public class CASTBinaryExpression extends ASTNode implements
|
|||
|
||||
@Override
|
||||
public void replace(IASTNode child, IASTNode other) {
|
||||
if( child == operand1 )
|
||||
{
|
||||
other.setPropertyInParent( child.getPropertyInParent() );
|
||||
other.setParent( child.getParent() );
|
||||
if (child == operand1) {
|
||||
other.setPropertyInParent(child.getPropertyInParent());
|
||||
other.setParent(child.getParent());
|
||||
operand1 = (IASTExpression) other;
|
||||
}
|
||||
if( child == operand2)
|
||||
{
|
||||
other.setPropertyInParent( child.getPropertyInParent() );
|
||||
other.setParent( child.getParent() );
|
||||
if (child == operand2) {
|
||||
other.setPropertyInParent(child.getPropertyInParent());
|
||||
other.setParent(child.getParent());
|
||||
operand2 = (IASTExpression) other;
|
||||
}
|
||||
}
|
||||
|
@ -220,34 +217,36 @@ public class CASTBinaryExpression extends ASTNode implements
|
|||
if (type != null) {
|
||||
return type;
|
||||
}
|
||||
switch (op) {
|
||||
case op_lessEqual:
|
||||
case op_lessThan:
|
||||
case op_greaterEqual:
|
||||
case op_greaterThan:
|
||||
case op_logicalAnd:
|
||||
case op_logicalOr:
|
||||
case op_equals:
|
||||
case op_notequals:
|
||||
return new CBasicType(Kind.eInt, 0, this);
|
||||
case IASTBinaryExpression.op_plus:
|
||||
if (t1 instanceof IArrayType) {
|
||||
return arrayTypeToPointerType((ICArrayType) t1);
|
||||
} else if (t2 instanceof IPointerType) {
|
||||
return t2;
|
||||
} else if (t2 instanceof IArrayType) {
|
||||
return arrayTypeToPointerType((ICArrayType) t2);
|
||||
}
|
||||
break;
|
||||
|
||||
case IASTBinaryExpression.op_minus:
|
||||
if (t2 instanceof IPointerType || t2 instanceof IArrayType) {
|
||||
if (t1 instanceof IPointerType || t1 instanceof IArrayType) {
|
||||
return CVisitor.getPtrDiffType(this);
|
||||
}
|
||||
return t1;
|
||||
switch (op) {
|
||||
case op_lessEqual:
|
||||
case op_lessThan:
|
||||
case op_greaterEqual:
|
||||
case op_greaterThan:
|
||||
case op_logicalAnd:
|
||||
case op_logicalOr:
|
||||
case op_equals:
|
||||
case op_notequals:
|
||||
return new CBasicType(Kind.eInt, 0, this);
|
||||
|
||||
case IASTBinaryExpression.op_plus:
|
||||
if (t1 instanceof IArrayType) {
|
||||
return arrayTypeToPointerType((ICArrayType) t1);
|
||||
} else if (t2 instanceof IPointerType) {
|
||||
return t2;
|
||||
} else if (t2 instanceof IArrayType) {
|
||||
return arrayTypeToPointerType((ICArrayType) t2);
|
||||
}
|
||||
break;
|
||||
|
||||
case IASTBinaryExpression.op_minus:
|
||||
if (t2 instanceof IPointerType || t2 instanceof IArrayType) {
|
||||
if (t1 instanceof IPointerType || t1 instanceof IArrayType) {
|
||||
return CVisitor.getPtrDiffType(this);
|
||||
}
|
||||
break;
|
||||
return t1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return t1;
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||
|
||||
|
@ -25,8 +25,8 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
|||
* @author jcamelon
|
||||
*/
|
||||
public class CASTCompoundStatement extends ASTNode implements IASTCompoundStatement, IASTAmbiguityParent {
|
||||
private IASTStatement [] statements = null;
|
||||
private IScope scope = null;
|
||||
private IASTStatement[] statements;
|
||||
private IScope scope;
|
||||
|
||||
@Override
|
||||
public CASTCompoundStatement copy() {
|
||||
|
@ -69,20 +69,20 @@ public class CASTCompoundStatement extends ASTNode implements IASTCompoundStatem
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean accept(ASTVisitor action){
|
||||
if (action.shouldVisitStatements){
|
||||
switch (action.visit(this)){
|
||||
public boolean accept(ASTVisitor action) {
|
||||
if (action.shouldVisitStatements) {
|
||||
switch (action.visit(this)) {
|
||||
case ASTVisitor.PROCESS_ABORT: return false;
|
||||
case ASTVisitor.PROCESS_SKIP: return true;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
IASTStatement [] s = getStatements();
|
||||
IASTStatement[] s = getStatements();
|
||||
for (int i = 0; i < s.length; i++) {
|
||||
if (!s[i].accept(action)) return false;
|
||||
}
|
||||
if (action.shouldVisitStatements){
|
||||
switch (action.leave(this)){
|
||||
if (action.shouldVisitStatements) {
|
||||
switch (action.leave(this)) {
|
||||
case ASTVisitor.PROCESS_ABORT: return false;
|
||||
case ASTVisitor.PROCESS_SKIP: return true;
|
||||
default: break;
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* John Camelon (IBM Rational Software) - Initial API and implementation
|
||||
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* John Camelon (IBM Rational Software) - Initial API and implementation
|
||||
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||
|
||||
|
@ -23,10 +23,8 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
|||
* A declaration statement.
|
||||
*/
|
||||
public class CASTDeclarationStatement extends ASTNode implements IASTDeclarationStatement, IASTAmbiguityParent {
|
||||
|
||||
private IASTDeclaration declaration;
|
||||
|
||||
|
||||
public CASTDeclarationStatement() {
|
||||
}
|
||||
|
||||
|
@ -34,12 +32,11 @@ public class CASTDeclarationStatement extends ASTNode implements IASTDeclaration
|
|||
setDeclaration(declaration);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public CASTDeclarationStatement copy() {
|
||||
return copy(CopyStyle.withoutLocations);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public CASTDeclarationStatement copy(CopyStyle style) {
|
||||
CASTDeclarationStatement copy = new CASTDeclarationStatement();
|
||||
|
@ -67,20 +64,20 @@ public class CASTDeclarationStatement extends ASTNode implements IASTDeclaration
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean accept( ASTVisitor action ){
|
||||
if( action.shouldVisitStatements ){
|
||||
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.shouldVisitStatements) {
|
||||
switch (action.visit(this)) {
|
||||
case ASTVisitor.PROCESS_ABORT: return false;
|
||||
case ASTVisitor.PROCESS_SKIP: return true;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
if( declaration != null ) if( !declaration.accept( action ) ) return false;
|
||||
if( action.shouldVisitStatements ){
|
||||
switch( action.leave( this ) ){
|
||||
case ASTVisitor.PROCESS_ABORT : return false;
|
||||
case ASTVisitor.PROCESS_SKIP : return true;
|
||||
default : break;
|
||||
if (declaration != null && !declaration.accept(action)) return false;
|
||||
if (action.shouldVisitStatements) {
|
||||
switch (action.leave(this)) {
|
||||
case ASTVisitor.PROCESS_ABORT: return false;
|
||||
case ASTVisitor.PROCESS_SKIP: return true;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -35,10 +35,8 @@ import org.eclipse.cdt.internal.core.dom.parser.ProblemType;
|
|||
* ID Expression in C.
|
||||
*/
|
||||
public class CASTIdExpression extends ASTNode implements IASTIdExpression, IASTCompletionContext {
|
||||
|
||||
private IASTName name;
|
||||
|
||||
|
||||
public CASTIdExpression() {
|
||||
}
|
||||
|
||||
|
@ -77,22 +75,22 @@ public class CASTIdExpression extends ASTNode implements IASTIdExpression, IASTC
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean accept( ASTVisitor action ){
|
||||
if( action.shouldVisitExpressions ){
|
||||
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.shouldVisitExpressions) {
|
||||
switch (action.visit(this)) {
|
||||
case ASTVisitor.PROCESS_ABORT: return false;
|
||||
case ASTVisitor.PROCESS_SKIP: return true;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
if( name != null ) if( !name.accept( action ) ) return false;
|
||||
if (name != null && !name.accept(action)) return false;
|
||||
|
||||
if( action.shouldVisitExpressions ){
|
||||
switch( action.leave( this ) ){
|
||||
case ASTVisitor.PROCESS_ABORT : return false;
|
||||
case ASTVisitor.PROCESS_SKIP : return true;
|
||||
default : break;
|
||||
if (action.shouldVisitExpressions) {
|
||||
switch (action.leave(this)) {
|
||||
case ASTVisitor.PROCESS_ABORT: return false;
|
||||
case ASTVisitor.PROCESS_SKIP: return true;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -100,7 +98,7 @@ public class CASTIdExpression extends ASTNode implements IASTIdExpression, IASTC
|
|||
|
||||
@Override
|
||||
public int getRoleForName(IASTName n) {
|
||||
if( n == name ) return r_reference;
|
||||
if (n == name) return r_reference;
|
||||
return r_unclear;
|
||||
}
|
||||
|
||||
|
@ -136,7 +134,6 @@ public class CASTIdExpression extends ASTNode implements IASTIdExpression, IASTC
|
|||
return ValueCategory.LVALUE;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IBinding[] findBindings(IASTName n, boolean isPrefix) {
|
||||
IBinding[] bindings = CVisitor.findBindingsForContentAssist(n, isPrefix);
|
||||
|
|
|
@ -105,7 +105,6 @@ public class CASTName extends ASTNode implements IASTName, IASTCompletionContext
|
|||
this.binding = binding;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (name == EMPTY_CHAR_ARRAY)
|
||||
|
@ -154,7 +153,6 @@ public class CASTName extends ASTNode implements IASTName, IASTCompletionContext
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getRoleOfName(boolean allowResolution) {
|
||||
IASTNode parent = getParent();
|
||||
|
@ -248,6 +246,7 @@ public class CASTName extends ASTNode implements IASTName, IASTCompletionContext
|
|||
bindings[i] = null;
|
||||
}
|
||||
break;
|
||||
|
||||
case ICompositeType.k_union:
|
||||
if (kind != IASTElaboratedTypeSpecifier.k_union) {
|
||||
bindings[i] = null;
|
||||
|
@ -258,13 +257,14 @@ public class CASTName extends ASTNode implements IASTName, IASTCompletionContext
|
|||
bindings[i]= null;
|
||||
}
|
||||
}
|
||||
return ArrayUtil.removeNulls(IBinding.class, bindings);
|
||||
return ArrayUtil.removeNulls(bindings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTName getLastName() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isQualified() {
|
||||
return false;
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* John Camelon (IBM Rational Software) - Initial API and implementation
|
||||
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* John Camelon (IBM Rational Software) - Initial API and implementation
|
||||
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||
|
||||
|
@ -20,9 +20,7 @@ import org.eclipse.cdt.core.dom.ast.IASTReturnStatement;
|
|||
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
||||
|
||||
public class CASTReturnStatement extends ASTNode implements
|
||||
IASTReturnStatement, IASTAmbiguityParent {
|
||||
|
||||
public class CASTReturnStatement extends ASTNode implements IASTReturnStatement, IASTAmbiguityParent {
|
||||
private IASTExpression retValue;
|
||||
|
||||
public CASTReturnStatement() {
|
||||
|
@ -39,8 +37,8 @@ public class CASTReturnStatement extends ASTNode implements
|
|||
|
||||
@Override
|
||||
public CASTReturnStatement copy(CopyStyle style) {
|
||||
CASTReturnStatement copy = new CASTReturnStatement(retValue == null ? null
|
||||
: retValue.copy(style));
|
||||
CASTReturnStatement copy =
|
||||
new CASTReturnStatement(retValue == null ? null : retValue.copy(style));
|
||||
copy.setOffsetAndLength(this);
|
||||
if (style == CopyStyle.withLocations) {
|
||||
copy.setCopyLocation(this);
|
||||
|
@ -78,20 +76,20 @@ public class CASTReturnStatement extends ASTNode implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean accept( ASTVisitor action ){
|
||||
if( action.shouldVisitStatements ){
|
||||
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.shouldVisitStatements) {
|
||||
switch (action.visit(this)) {
|
||||
case ASTVisitor.PROCESS_ABORT: return false;
|
||||
case ASTVisitor.PROCESS_SKIP: return true;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
if( retValue != null ) if( !retValue.accept( action ) ) return false;
|
||||
if( action.shouldVisitStatements ){
|
||||
switch( action.leave( this ) ){
|
||||
case ASTVisitor.PROCESS_ABORT : return false;
|
||||
case ASTVisitor.PROCESS_SKIP : return true;
|
||||
default : break;
|
||||
if (retValue != null && !retValue.accept(action)) return false;
|
||||
if (action.shouldVisitStatements) {
|
||||
switch (action.leave(this)) {
|
||||
case ASTVisitor.PROCESS_ABORT: return false;
|
||||
case ASTVisitor.PROCESS_SKIP: return true;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -99,10 +97,9 @@ public class CASTReturnStatement extends ASTNode implements
|
|||
|
||||
@Override
|
||||
public void replace(IASTNode child, IASTNode other) {
|
||||
if( child == retValue )
|
||||
{
|
||||
other.setPropertyInParent( child.getPropertyInParent() );
|
||||
other.setParent( child.getParent() );
|
||||
if (child == retValue) {
|
||||
other.setPropertyInParent(child.getPropertyInParent());
|
||||
other.setParent(child.getParent());
|
||||
retValue = (IASTExpression) other;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||
|
||||
|
@ -50,12 +50,6 @@ public class CParameter extends PlatformObject implements IParameter {
|
|||
this.declarations = new IASTName[] { parameterName };
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.core.dom.ast.IVariable#getType()
|
||||
*/
|
||||
|
||||
@Override
|
||||
public IType getType() {
|
||||
if (type == null && declarations[0].getParent() instanceof IASTDeclarator)
|
||||
|
@ -102,11 +96,6 @@ public class CParameter extends PlatformObject implements IParameter {
|
|||
return CVisitor.EMPTY_CHAR_ARRAY;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.core.dom.ast.IBinding#getScope()
|
||||
*/
|
||||
@Override
|
||||
public IScope getScope() {
|
||||
// IASTParameterDeclaration or IASTSimpleDeclaration
|
||||
|
@ -138,41 +127,21 @@ public class CParameter extends PlatformObject implements IParameter {
|
|||
declarations = ArrayUtil.append(IASTName.class, declarations, name);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.core.dom.ast.IVariable#isStatic()
|
||||
*/
|
||||
@Override
|
||||
public boolean isStatic() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.core.dom.ast.IVariable#isExtern()
|
||||
*/
|
||||
@Override
|
||||
public boolean isExtern() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.core.dom.ast.IVariable#isAuto()
|
||||
*/
|
||||
@Override
|
||||
public boolean isAuto() {
|
||||
return hasStorageClass(IASTDeclSpecifier.sc_auto);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.core.dom.ast.IVariable#isRegister()
|
||||
*/
|
||||
@Override
|
||||
public boolean isRegister() {
|
||||
return hasStorageClass(IASTDeclSpecifier.sc_register);
|
||||
|
@ -216,4 +185,9 @@ public class CParameter extends PlatformObject implements IParameter {
|
|||
public IValue getInitialValue() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getName();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -167,7 +167,6 @@ public abstract class CPPASTNameBase extends ASTNode implements IASTName {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public final String toString() {
|
||||
|
|
|
@ -73,7 +73,7 @@ public class NewClassWizardUtil {
|
|||
ICElement curr = element;
|
||||
while (curr != null && !foundSourceRoot) {
|
||||
if (curr instanceof ICContainer && folder == null) {
|
||||
folder = (ICContainer)curr;
|
||||
folder = (ICContainer) curr;
|
||||
}
|
||||
foundSourceRoot = (curr instanceof ISourceRoot);
|
||||
curr = curr.getParent();
|
||||
|
@ -118,31 +118,6 @@ public class NewClassWizardUtil {
|
|||
return null;
|
||||
}
|
||||
|
||||
//XXX Remove
|
||||
// /**
|
||||
// * Returns the parent source folder for the given resource. If the given
|
||||
// * resource is already a source folder, the corresponding C element is returned.
|
||||
// *
|
||||
// * @param resource the resource
|
||||
// * @return the source folder
|
||||
// */
|
||||
// public static ICContainer getSourceFolder(IResource resource) {
|
||||
// if (resource != null && resource.exists()) {
|
||||
// int resType = resource.getType();
|
||||
// if (resType == IResource.PROJECT || resType == IResource.FOLDER) {
|
||||
// ICElement elem = CoreModel.getDefault().create(resource.getFullPath());
|
||||
// if (elem != null) {
|
||||
// ICContainer sourceFolder = getSourceFolder(elem);
|
||||
// if (sourceFolder != null)
|
||||
// return sourceFolder;
|
||||
// }
|
||||
// } else {
|
||||
// return getSourceFolder(resource.getParent());
|
||||
// }
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Checks if a given resource is under a source root.
|
||||
*
|
||||
|
|
|
@ -30,5 +30,4 @@ public class C99Parameter extends C99Variable implements IParameter, ITypeable {
|
|||
param.setStatic(var.isStatic());
|
||||
return param;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,8 +23,6 @@ import org.eclipse.core.runtime.PlatformObject;
|
|||
|
||||
@SuppressWarnings("restriction")
|
||||
public class C99Variable extends PlatformObject implements IC99Binding, IVariable, ITypeable {
|
||||
|
||||
|
||||
private boolean isAuto;
|
||||
private boolean isExtern;
|
||||
private boolean isRegister;
|
||||
|
@ -36,14 +34,12 @@ public class C99Variable extends PlatformObject implements IC99Binding, IVariabl
|
|||
private IScope scope;
|
||||
|
||||
public C99Variable() {
|
||||
|
||||
}
|
||||
|
||||
public C99Variable(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
public void setType(IType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
@ -51,7 +47,6 @@ public class C99Variable extends PlatformObject implements IC99Binding, IVariabl
|
|||
public IType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
public void setAuto(boolean auto) {
|
||||
this.isAuto = auto;
|
||||
|
@ -60,7 +55,6 @@ public class C99Variable extends PlatformObject implements IC99Binding, IVariabl
|
|||
public boolean isAuto() {
|
||||
return isAuto;
|
||||
}
|
||||
|
||||
|
||||
public void setExtern(boolean extern) {
|
||||
this.isExtern = extern;
|
||||
|
@ -69,7 +63,6 @@ public class C99Variable extends PlatformObject implements IC99Binding, IVariabl
|
|||
public boolean isExtern() {
|
||||
return isExtern;
|
||||
}
|
||||
|
||||
|
||||
public void setRegister(boolean isRegister) {
|
||||
this.isRegister = isRegister;
|
||||
|
@ -78,7 +71,6 @@ public class C99Variable extends PlatformObject implements IC99Binding, IVariabl
|
|||
public boolean isRegister() {
|
||||
return isRegister;
|
||||
}
|
||||
|
||||
|
||||
public void setStatic(boolean isStatic) {
|
||||
this.isStatic = isStatic;
|
||||
|
@ -88,7 +80,6 @@ public class C99Variable extends PlatformObject implements IC99Binding, IVariabl
|
|||
return isStatic;
|
||||
}
|
||||
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
@ -123,4 +114,9 @@ public class C99Variable extends PlatformObject implements IC99Binding, IVariabl
|
|||
public IValue getInitialValue() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getName();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue