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