1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

bug #206952, add constructor methods to AST node classes, set() methods now call setParent() and setPropertyInParent()

This commit is contained in:
Mike Kucera 2007-11-06 16:02:08 +00:00
parent 5ec0f9d046
commit a83d0a7ac9
147 changed files with 2362 additions and 3570 deletions

View file

@ -21,8 +21,8 @@ public interface IASTExpressionStatement extends IASTStatement {
* <code>EXPRESSION</code> is the relationship between an
* <code>IASTExpressionStatement</code> and an <code>IASTExpression</code>.
*/
public static final ASTNodeProperty EXPFRESSION = new ASTNodeProperty(
"IASTExpressionStatement.IASTStatement - IASTExpression for IASTExpressionStatement"); //$NON-NLS-1$
public static final ASTNodeProperty EXPRESSION = new ASTNodeProperty(
"IASTExpressionStatement.EXPRESSION - IASTExpression for IASTExpressionStatement"); //$NON-NLS-1$
/**
* Get the expression in this statement.

View file

@ -9,6 +9,7 @@
* IBM Rational Software - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Ed Swartz (Nokia)
* Mike Kucera (IBM) - bug #206952
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser;
@ -37,7 +38,6 @@ import org.eclipse.cdt.core.dom.ast.IASTExpressionList;
import org.eclipse.cdt.core.dom.ast.IASTExpressionStatement;
import org.eclipse.cdt.core.dom.ast.IASTFieldDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression;
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
import org.eclipse.cdt.core.dom.ast.IASTGotoStatement;
import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
import org.eclipse.cdt.core.dom.ast.IASTIfStatement;
@ -48,7 +48,6 @@ import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTNullStatement;
import org.eclipse.cdt.core.dom.ast.IASTProblem;
import org.eclipse.cdt.core.dom.ast.IASTProblemExpression;
import org.eclipse.cdt.core.dom.ast.IASTProblemHolder;
import org.eclipse.cdt.core.dom.ast.IASTProblemStatement;
import org.eclipse.cdt.core.dom.ast.IASTReturnStatement;
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier;
@ -138,8 +137,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
}
}
protected final void throwBacktrack(int offset, int length)
throws BacktrackException {
protected final void throwBacktrack(int offset, int length) throws BacktrackException {
++backtrackCount;
backtrack.initialize(offset, (length < 0) ? 0 : length);
throw backtrack;
@ -149,11 +147,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
protected ASTCompletionNode completionNode;
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.internal.core.dom.parser.ISourceCodeParser#getCompletionNode()
*/
public IASTCompletionNode getCompletionNode() {
return completionNode;
}
@ -558,25 +552,19 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
int startingOffset = consume(IToken.tLBRACE).getOffset();
((ASTNode) result).setOffset(startingOffset);
result.setPropertyInParent(IASTFunctionDefinition.FUNCTION_BODY);
//result.setPropertyInParent(IASTFunctionDefinition.FUNCTION_BODY);
while (LT(1) != IToken.tRBRACE && LT(1) != IToken.tEOC) {
int checkToken = LA(1).hashCode();
try {
IASTStatement s = statement();
result.addStatement(s);
s.setParent(result);
s.setPropertyInParent(IASTCompoundStatement.NESTED_STATEMENT);
} catch (BacktrackException b) {
IASTProblem p = failParse(b);
IASTProblemStatement ps = createProblemStatement();
ps.setProblem(p);
((ASTNode) ps).setOffsetAndLength(((ASTNode) p).getOffset(),
((ASTNode) p).getLength());
p.setParent(ps);
p.setPropertyInParent(IASTProblemHolder.PROBLEM);
result.addStatement(ps);
ps.setParent(result);
ps.setPropertyInParent(IASTCompoundStatement.NESTED_STATEMENT);
if (LA(1).hashCode() == checkToken)
failParseWithErrorHandling();
}
@ -604,15 +592,12 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
* @throws EndOfFileException
* @throws BacktrackException
*/
protected IASTExpression compoundStatementExpression()
throws EndOfFileException, BacktrackException {
protected IASTExpression compoundStatementExpression() throws EndOfFileException, BacktrackException {
int startingOffset = consume().getOffset(); // tLPAREN always
IASTCompoundStatement compoundStatement = null;
if (mode == ParserMode.QUICK_PARSE
|| mode == ParserMode.STRUCTURAL_PARSE)
if (mode == ParserMode.QUICK_PARSE || mode == ParserMode.STRUCTURAL_PARSE)
skipOverCompoundStatement();
else if (mode == ParserMode.COMPLETION_PARSE
|| mode == ParserMode.SELECTION_PARSE) {
else if (mode == ParserMode.COMPLETION_PARSE || mode == ParserMode.SELECTION_PARSE) {
if (scanner.isOnTopContext())
compoundStatement();
else
@ -622,13 +607,9 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
int lastOffset = consume(IToken.tRPAREN).getEndOffset();
IGNUASTCompoundStatementExpression resultExpression = createCompoundStatementExpression();
((ASTNode) resultExpression).setOffsetAndLength(startingOffset,
lastOffset - startingOffset);
((ASTNode) resultExpression).setOffsetAndLength(startingOffset, lastOffset - startingOffset);
if (compoundStatement != null) {
resultExpression.setCompoundStatement(compoundStatement);
compoundStatement.setParent(resultExpression);
compoundStatement
.setPropertyInParent(IGNUASTCompoundStatementExpression.STATEMENT);
}
return resultExpression;
@ -639,8 +620,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
*/
protected abstract IGNUASTCompoundStatementExpression createCompoundStatementExpression();
protected IASTExpression expression() throws BacktrackException,
EndOfFileException {
protected IASTExpression expression() throws BacktrackException, EndOfFileException {
IToken la = LA(1);
int startingOffset = la.getOffset();
@ -658,18 +638,12 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
IASTExpressionList expressionList = createExpressionList();
((ASTNode) expressionList).setOffset(startingOffset);
expressionList.addExpression(assignmentExpression);
assignmentExpression.setParent(expressionList);
assignmentExpression
.setPropertyInParent(IASTExpressionList.NESTED_EXPRESSION);
int lastOffset = 0;
while (LT(1) == IToken.tCOMMA) {
consume();
IASTExpression secondExpression = assignmentExpression();
expressionList.addExpression(secondExpression);
secondExpression.setParent(expressionList);
secondExpression
.setPropertyInParent(IASTExpressionList.NESTED_EXPRESSION);
lastOffset = calculateEndOffset(secondExpression);
}
((ASTNode) expressionList).setLength(lastOffset - startingOffset);
@ -794,9 +768,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
* @param expression
* @throws BacktrackException
*/
protected IASTExpression andExpression() throws EndOfFileException,
BacktrackException {
protected IASTExpression andExpression() throws EndOfFileException, BacktrackException {
IASTExpression firstExpression = equalityExpression();
while (LT(1) == IToken.tAMPER) {
consume();
@ -841,11 +813,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
int o = ((ASTNode) firstExpression).getOffset();
((ASTNode) result).setOffsetAndLength(o, lastOffset - o);
result.setOperand1(firstExpression);
firstExpression.setParent(result);
firstExpression.setPropertyInParent(IASTBinaryExpression.OPERAND_ONE);
result.setOperand2(secondExpression);
secondExpression.setParent(result);
secondExpression.setPropertyInParent(IASTBinaryExpression.OPERAND_TWO);
return result;
}
@ -924,18 +892,9 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
IASTConditionalExpression result = createConditionalExpression();
result.setLogicalConditionExpression(firstExpression);
firstExpression.setParent(result);
firstExpression
.setPropertyInParent(IASTConditionalExpression.LOGICAL_CONDITION);
result.setPositiveResultExpression(secondExpression);
secondExpression.setParent(result);
secondExpression
.setPropertyInParent(IASTConditionalExpression.POSITIVE_RESULT);
if (thirdExpression != null) {
result.setNegativeResultExpression(thirdExpression);
thirdExpression.setParent(result);
thirdExpression
.setPropertyInParent(IASTConditionalExpression.NEGATIVE_RESULT);
((ASTNode) result).setOffsetAndLength(((ASTNode) firstExpression)
.getOffset(), calculateEndOffset(thirdExpression)
- ((ASTNode) firstExpression).getOffset());
@ -965,11 +924,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
IASTUnaryExpression result = createUnaryExpression();
((ASTNode) result).setOffsetAndLength(offset, lastOffset - offset);
result.setOperator(operator);
if (operand != null) {
result.setOperand(operand);
operand.setParent(result);
operand.setPropertyInParent(IASTUnaryExpression.OPERAND);
}
result.setOperand(operand);
return result;
}
@ -1069,25 +1024,19 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
protected IASTStatement handleFunctionBody() throws BacktrackException,
EndOfFileException {
if (mode == ParserMode.QUICK_PARSE
|| mode == ParserMode.STRUCTURAL_PARSE) {
if (mode == ParserMode.QUICK_PARSE || mode == ParserMode.STRUCTURAL_PARSE) {
IToken curr = LA(1);
IToken last = skipOverCompoundStatement();
IASTCompoundStatement cs = createCompoundStatement();
((ASTNode) cs).setOffsetAndLength(curr.getOffset(), last
.getEndOffset()
- curr.getOffset());
((ASTNode) cs).setOffsetAndLength(curr.getOffset(), last.getEndOffset() - curr.getOffset());
return cs;
} else if (mode == ParserMode.COMPLETION_PARSE
|| mode == ParserMode.SELECTION_PARSE) {
} else if (mode == ParserMode.COMPLETION_PARSE || mode == ParserMode.SELECTION_PARSE) {
if (scanner.isOnTopContext())
return functionBody();
IToken curr = LA(1);
IToken last = skipOverCompoundStatement();
IASTCompoundStatement cs = createCompoundStatement();
((ASTNode) cs).setOffsetAndLength(curr.getOffset(), last
.getEndOffset()
- curr.getOffset());
((ASTNode) cs).setOffsetAndLength(curr.getOffset(), last.getEndOffset() - curr.getOffset());
return cs;
} else if (mode == ParserMode.COMPLETE_PARSE)
return functionBody();
@ -1101,8 +1050,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
* @throws BacktrackException
* request a backtrack
*/
protected IASTStatement functionBody() throws EndOfFileException,
BacktrackException {
protected IASTStatement functionBody() throws EndOfFileException, BacktrackException {
return compoundStatement();
}
@ -1315,8 +1263,6 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
IASTEnumerationSpecifier result = createEnumerationSpecifier();
((ASTNode) result).setOffset(startOffset);
result.setName(name);
name.setParent(result);
name.setPropertyInParent(IASTEnumerationSpecifier.ENUMERATION_NAME);
consume(); // IToken.tLBRACE
enumLoop: while (true) {
@ -1350,19 +1296,10 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
((ASTNode) enumerator).setOffsetAndLength(
((ASTNode) enumeratorName).getOffset(), lastOffset
- ((ASTNode) enumeratorName).getOffset());
enumeratorName.setParent(enumerator);
enumeratorName
.setPropertyInParent(IASTEnumerationSpecifier.IASTEnumerator.ENUMERATOR_NAME);
if (initialValue != null) {
enumerator.setValue(initialValue);
initialValue.setParent(enumerator);
initialValue
.setPropertyInParent(IASTEnumerationSpecifier.IASTEnumerator.ENUMERATOR_VALUE);
}
result.addEnumerator(enumerator);
enumerator.setParent(result);
enumerator
.setPropertyInParent(IASTEnumerationSpecifier.ENUMERATOR);
break;
}
@ -1381,19 +1318,10 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
((ASTNode) enumerator).setOffsetAndLength(
((ASTNode) enumeratorName).getOffset(), lastOffset
- ((ASTNode) enumeratorName).getOffset());
enumeratorName.setParent(enumerator);
enumeratorName
.setPropertyInParent(IASTEnumerationSpecifier.IASTEnumerator.ENUMERATOR_NAME);
if (initialValue != null) {
enumerator.setValue(initialValue);
initialValue.setParent(enumerator);
initialValue
.setPropertyInParent(IASTEnumerationSpecifier.IASTEnumerator.ENUMERATOR_VALUE);
}
result.addEnumerator(enumerator);
enumerator.setParent(result);
enumerator
.setPropertyInParent(IASTEnumerationSpecifier.ENUMERATOR);
}
int lastOffset = consume().getEndOffset();
@ -1409,25 +1337,16 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
protected abstract IASTStatement statement() throws EndOfFileException,
BacktrackException;
/**
* @return
*/
protected abstract IASTEnumerator createEnumerator();
/**
* @return
*/
protected abstract IASTEnumerationSpecifier createEnumerationSpecifier();
/**
* @return
*/
protected abstract IASTName createName();
/**
* @param token
* @return
*/
protected abstract IASTName createName(IToken token);
/**
@ -1439,11 +1358,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
return cond;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.internal.core.parser2.ISourceCodeParser#encounteredError()
*/
public boolean encounteredError() {
return !parsePassed;
}
@ -1452,69 +1367,43 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
protected abstract IASTNamedTypeSpecifier createNamedTypeSpecifier();
/**
* @return
*/
protected abstract IASTDeclarationStatement createDeclarationStatement();
/**
* @return
*/
protected abstract IASTExpressionStatement createExpressionStatement();
/**
* @return
*/
protected abstract IASTLabelStatement createLabelStatement();
/**
* @return
*/
protected abstract IASTNullStatement createNullStatement();
/**
* @return
*/
protected abstract IASTGotoStatement createGoToStatement();
/**
* @return
*/
protected abstract IASTReturnStatement createReturnStatement();
/**
* @return
*/
protected abstract IASTContinueStatement createContinueStatement();
/**
* @return
*/
protected abstract IASTBreakStatement createBreakStatement();
/**
* @return
*/
protected abstract IASTDoStatement createDoStatement();
/**
* @return
*/
protected abstract IASTWhileStatement createWhileStatement();
/**
* @return
*/
protected abstract IASTIdExpression createIdExpression();
/**
* @return
*/
protected abstract IASTDefaultStatement createDefaultStatement();
/**
* @return
*/
protected abstract IASTCaseStatement createCaseStatement();
protected abstract IASTDeclaration declaration() throws BacktrackException,
@ -1553,41 +1442,25 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
return result;
}
/**
* @return
*/
protected abstract IASTASMDeclaration createASMDirective();
/**
* @param op
* @param typeId
* @param subExpression
* @param startingOffset
* @param lastOffset
* @return
*/
protected IASTExpression buildTypeIdUnaryExpression(int op,
IASTTypeId typeId, IASTExpression subExpression,
int startingOffset, int lastOffset) {
IASTCastExpression result = createCastExpression();
result.setOperator(op);
((ASTNode) result).setOffsetAndLength(startingOffset, lastOffset
- startingOffset);
((ASTNode) result).setOffsetAndLength(startingOffset, lastOffset - startingOffset);
result.setTypeId(typeId);
typeId.setParent(result);
typeId.setPropertyInParent(IASTCastExpression.TYPE_ID);
if (subExpression != null) { // which it can be in a completion
result.setOperand(subExpression);
subExpression.setParent(result);
subExpression.setPropertyInParent(IASTCastExpression.OPERAND);
}
return result;
}
/**
* @return
*/
protected abstract IASTCastExpression createCastExpression();
/**
@ -1614,10 +1487,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
expressionStatement = createExpressionStatement();
expressionStatement.setExpression(expression);
((ASTNode) expressionStatement).setOffsetAndLength(
mark.getOffset(), lastTokenOfExpression.getEndOffset()
- mark.getOffset());
expression.setParent(expressionStatement);
expression.setPropertyInParent(IASTExpressionStatement.EXPFRESSION);
mark.getOffset(), lastTokenOfExpression.getEndOffset() - mark.getOffset());
} catch (BacktrackException b) {
}
@ -1629,10 +1499,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
IASTDeclaration d = declaration();
ds = createDeclarationStatement();
ds.setDeclaration(d);
((ASTNode) ds).setOffsetAndLength(((ASTNode) d).getOffset(),
((ASTNode) d).getLength());
d.setParent(ds);
d.setPropertyInParent(IASTDeclarationStatement.DECLARATION);
((ASTNode) ds).setOffsetAndLength(((ASTNode) d).getOffset(), ((ASTNode) d).getLength());
} catch (BacktrackException b) {
savedBt = b;
backup(mark);
@ -1654,8 +1521,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
// resolve ambiguities
// A * B = C;
if (expressionStatement.getExpression() instanceof IASTBinaryExpression) {
IASTBinaryExpression exp = (IASTBinaryExpression) expressionStatement
.getExpression();
IASTBinaryExpression exp = (IASTBinaryExpression) expressionStatement.getExpression();
if (exp.getOperator() == IASTBinaryExpression.op_assign) {
IASTExpression lhs = exp.getOperand1();
if (lhs instanceof IASTBinaryExpression
@ -1736,12 +1602,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
IASTAmbiguousStatement statement = createAmbiguousStatement();
statement.addStatement(ds);
ds.setParent(statement);
ds.setPropertyInParent(IASTAmbiguousStatement.STATEMENT);
statement.addStatement(expressionStatement);
expressionStatement.setParent(statement);
expressionStatement
.setPropertyInParent(IASTAmbiguousStatement.STATEMENT);
((ASTNode) statement).setOffsetAndLength((ASTNode) ds);
return statement;
}
@ -1765,12 +1626,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
IASTName name = createName(labelName);
label_statement.setName(name);
name.setParent(label_statement);
name.setPropertyInParent(IASTLabelStatement.NAME);
label_statement.setNestedStatement( nestedStatement );
nestedStatement.setParent( label_statement );
nestedStatement.setPropertyInParent( IASTLabelStatement.NESTED_STATEMENT );
label_statement.setNestedStatement(nestedStatement);
return label_statement;
}
@ -1784,9 +1640,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
IToken t = consume(); // tSEMI
IASTNullStatement null_statement = createNullStatement();
((ASTNode) null_statement).setOffsetAndLength(t.getOffset(), t
.getEndOffset()
- t.getOffset());
((ASTNode) null_statement).setOffsetAndLength(t.getOffset(), t.getEndOffset() - t.getOffset());
return null_statement;
}
@ -1803,11 +1657,8 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
IASTName goto_label_name = createName(identifier);
IASTGotoStatement goto_statement = createGoToStatement();
((ASTNode) goto_statement).setOffsetAndLength(startOffset, lastOffset
- startOffset);
((ASTNode) goto_statement).setOffsetAndLength(startOffset, lastOffset - startOffset);
goto_statement.setName(goto_label_name);
goto_label_name.setParent(goto_statement);
goto_label_name.setPropertyInParent(IASTGotoStatement.NAME);
return goto_statement;
}
@ -1822,8 +1673,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
int lastOffset = consume(IToken.tSEMI).getEndOffset();
IASTBreakStatement break_statement = createBreakStatement();
((ASTNode) break_statement).setOffsetAndLength(startOffset, lastOffset
- startOffset);
((ASTNode) break_statement).setOffsetAndLength(startOffset, lastOffset - startOffset);
return break_statement;
}
@ -1838,8 +1688,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
int lastOffset = consume(IToken.tSEMI).getEndOffset();
IASTContinueStatement continue_statement = createContinueStatement();
((ASTNode) continue_statement).setOffsetAndLength(startOffset,
lastOffset - startOffset);
((ASTNode) continue_statement).setOffsetAndLength(startOffset, lastOffset - startOffset);
return continue_statement;
}
@ -1861,8 +1710,6 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
IASTName name = createName(LA(1));
IASTIdExpression idExpr = createIdExpression();
idExpr.setName(name);
name.setParent(idExpr);
name.setPropertyInParent(IASTIdExpression.ID_NAME);
result = idExpr;
break;
case IToken.tSEMI:
@ -1889,8 +1736,6 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
- startOffset);
if (result != null) {
return_statement.setReturnValue(result);
result.setParent(return_statement);
result.setPropertyInParent(IASTReturnStatement.RETURNVALUE);
}
return return_statement;
}
@ -1934,16 +1779,11 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
IASTDoStatement do_statement = createDoStatement();
((ASTNode) do_statement).setOffsetAndLength(startOffset, lastOffset
- startOffset);
((ASTNode) do_statement).setOffsetAndLength(startOffset, lastOffset - startOffset);
do_statement.setBody(do_body);
do_body.setParent(do_statement);
do_body.setPropertyInParent(IASTDoStatement.BODY);
if (do_condition != null) {
do_statement.setCondition(do_condition);
do_condition.setParent(do_statement);
do_condition.setPropertyInParent(IASTDoStatement.CONDITION);
}
return do_statement;
@ -1954,8 +1794,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
* @throws EndOfFileException
* @throws BacktrackException
*/
protected IASTStatement parseWhileStatement() throws EndOfFileException,
BacktrackException {
protected IASTStatement parseWhileStatement() throws EndOfFileException, BacktrackException {
int startOffset = consume().getOffset();
consume(IToken.tLPAREN);
IASTExpression while_condition = condition();
@ -1976,15 +1815,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
((ASTNode) while_statement).setOffsetAndLength(startOffset,
(while_body != null ? calculateEndOffset(while_body) : LA(1).getEndOffset()) - startOffset);
while_statement.setCondition(while_condition);
while_condition.setParent(while_statement);
while_condition
.setPropertyInParent(IASTWhileStatement.CONDITIONEXPRESSION);
if (while_body != null) {
while_statement.setBody(while_body);
while_body.setParent(while_statement);
while_body.setPropertyInParent(IASTWhileStatement.BODY);
}
while_statement.setBody(while_body);
return while_statement;
}
@ -2003,16 +1834,13 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
ASTNode r = ((ASTNode) current);
if (current.getElseClause() != null) {
ASTNode else_clause = ((ASTNode) current.getElseClause());
r.setLength(else_clause.getOffset() + else_clause.getLength()
- r.getOffset());
r.setLength(else_clause.getOffset() + else_clause.getLength() - r.getOffset());
} else {
ASTNode then_clause = (ASTNode) current.getThenClause();
if (then_clause != null)
r.setLength(then_clause.getOffset()
+ then_clause.getLength() - r.getOffset());
r.setLength(then_clause.getOffset() + then_clause.getLength() - r.getOffset());
}
if (current.getParent() != null
&& current.getParent() instanceof IASTIfStatement)
if (current.getParent() != null && current.getParent() instanceof IASTIfStatement)
current = (IASTIfStatement) current.getParent();
else
current = null;
@ -2029,8 +1857,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
* @throws EndOfFileException
* @throws BacktrackException
*/
protected IASTStatement parseCompoundStatement() throws EndOfFileException,
BacktrackException {
protected IASTStatement parseCompoundStatement() throws EndOfFileException, BacktrackException {
IASTCompoundStatement compound = compoundStatement();
return compound;
}
@ -2040,14 +1867,12 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
* @throws EndOfFileException
* @throws BacktrackException
*/
protected IASTStatement parseDefaultStatement() throws EndOfFileException,
BacktrackException {
protected IASTStatement parseDefaultStatement() throws EndOfFileException, BacktrackException {
int startOffset = consume().getOffset(); // t_default
int lastOffset = consume(IToken.tCOLON).getEndOffset();
IASTDefaultStatement df = createDefaultStatement();
((ASTNode) df)
.setOffsetAndLength(startOffset, lastOffset - startOffset);
((ASTNode) df).setOffsetAndLength(startOffset, lastOffset - startOffset);
return df;
}
@ -2056,8 +1881,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
* @throws EndOfFileException
* @throws BacktrackException
*/
protected IASTStatement parseCaseStatement() throws EndOfFileException,
BacktrackException {
protected IASTStatement parseCaseStatement() throws EndOfFileException, BacktrackException {
int startOffset = consume().getOffset(); // t_case
IASTExpression case_exp = constantExpression();
int lastOffset = 0;
@ -2071,31 +1895,19 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
}
IASTCaseStatement cs = createCaseStatement();
((ASTNode) cs)
.setOffsetAndLength(startOffset, lastOffset - startOffset);
((ASTNode) cs).setOffsetAndLength(startOffset, lastOffset - startOffset);
cs.setExpression(case_exp);
case_exp.setParent(cs);
case_exp.setPropertyInParent(IASTCaseStatement.EXPRESSION);
return cs;
}
/**
* @param declSpec
* @param declarators
* @return
*/
protected int figureEndOffset(IASTDeclSpecifier declSpec,
IASTDeclarator[] declarators) {
protected int figureEndOffset(IASTDeclSpecifier declSpec, IASTDeclarator[] declarators) {
if (declarators.length == 0)
return calculateEndOffset(declSpec);
return calculateEndOffset(declarators[declarators.length - 1]);
}
/**
* @param declSpecifier
* @param declarator
* @return
*/
protected int figureEndOffset(IASTDeclSpecifier declSpecifier,
IASTDeclarator declarator) {
if (declarator == null || ((ASTNode) declarator).getLength() == 0)
@ -2103,9 +1915,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
return calculateEndOffset(declarator);
}
/**
* @param token
*/
protected void throwBacktrack(IToken token) throws BacktrackException {
throwBacktrack(token.getOffset(), token.getLength());
}
@ -2125,8 +1935,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
if (typeIdWithParentheses)
consume(IToken.tLPAREN);
typeId = typeId(false);
if (typeId != null)
{
if (typeId != null) {
if (typeIdWithParentheses) {
switch (LT(1)) {
case IToken.tRPAREN:
@ -2181,8 +1990,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
protected abstract IASTAmbiguousExpression createAmbiguousExpression();
protected IASTExpression parseSizeofExpression() throws BacktrackException,
EndOfFileException {
protected IASTExpression parseSizeofExpression() throws BacktrackException, EndOfFileException {
int startingOffset = consume().getOffset(); // t_sizeof
int[] endoffset= new int[] {0};
IASTNode[] choice = parseTypeIdOrUnaryExpression(true, endoffset);
@ -2205,11 +2013,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
IASTUnaryExpression.op_sizeof, (IASTExpression) choice[1],
startingOffset, endoffset[0]);
ambExpr.addExpression(e1);
e1.setParent(ambExpr);
e1.setPropertyInParent(IASTAmbiguousExpression.SUBEXPRESSION);
ambExpr.addExpression(e2);
e2.setParent(ambExpr);
e2.setPropertyInParent(IASTAmbiguousExpression.SUBEXPRESSION);
((ASTNode) ambExpr).setOffsetAndLength((ASTNode) e2);
return ambExpr;
default:

View file

@ -20,17 +20,19 @@ import org.eclipse.cdt.core.dom.ast.IASTASMDeclaration;
public class CASTASMDeclaration extends CASTNode implements IASTASMDeclaration {
char [] assembly = null;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTASMDeclaration#getAssembly()
*/
public String getAssembly() {
public CASTASMDeclaration() {
}
public CASTASMDeclaration(String assembly) {
setAssembly(assembly);
}
public String getAssembly() {
if( assembly == null ) return ""; //$NON-NLS-1$
return new String( assembly );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTASMDeclaration#setAssembly(java.lang.String)
*/
public void setAssembly(String assembly) {
this.assembly = assembly.toCharArray();
}

View file

@ -26,6 +26,8 @@ public class CASTAmbiguousExpression extends CASTAmbiguity implements
public void addExpression(IASTExpression e) {
if (e != null) {
expressions = (IASTExpression[]) ArrayUtil.append( IASTExpression.class, expressions, ++expressionsPos, e );
e.setParent(this);
e.setPropertyInParent(SUBEXPRESSION);
}
}

View file

@ -25,6 +25,8 @@ public class CASTAmbiguousStatement extends CASTAmbiguity implements
public void addStatement(IASTStatement s) {
if (s != null) {
stmts = (IASTStatement[]) ArrayUtil.append( IASTStatement.class, stmts, ++stmtsPos, s );
s.setParent(this);
s.setPropertyInParent(STATEMENT);
}
}

View file

@ -15,18 +15,29 @@ import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
/**
* @author jcamelon
*/
public class CASTArrayDeclarator extends CASTDeclarator implements
IASTArrayDeclarator {
public class CASTArrayDeclarator extends CASTDeclarator implements IASTArrayDeclarator {
private IASTArrayModifier [] arrayMods = null;
private int arrayModsPos=-1;
public IASTArrayModifier[] getArrayModifiers() {
public CASTArrayDeclarator() {
}
public CASTArrayDeclarator(IASTName name, IASTInitializer initializer) {
super(name, initializer);
}
public CASTArrayDeclarator(IASTName name) {
super(name);
}
public IASTArrayModifier[] getArrayModifiers() {
if( arrayMods == null ) return IASTArrayModifier.EMPTY_ARRAY;
arrayMods = (IASTArrayModifier[]) ArrayUtil.removeNullsAfter( IASTArrayModifier.class, arrayMods, arrayModsPos );
return arrayMods;
@ -35,6 +46,8 @@ public class CASTArrayDeclarator extends CASTDeclarator implements
public void addArrayModifier(IASTArrayModifier arrayModifier) {
if (arrayModifier != null) {
arrayModifier.setParent(this);
arrayModifier.setPropertyInParent(ARRAY_MODIFIER);
arrayMods = (IASTArrayModifier[]) ArrayUtil.append( IASTArrayModifier.class, arrayMods, ++arrayModsPos, arrayModifier );
}
}

View file

@ -26,18 +26,25 @@ public class CASTArrayDesignator extends CASTNode implements
private IASTExpression exp;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.c.ICASTArrayDesignator#getSubscriptExpression()
*/
public CASTArrayDesignator() {
}
public CASTArrayDesignator(IASTExpression exp) {
setSubscriptExpression(exp);
}
public IASTExpression getSubscriptExpression() {
return exp;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.c.ICASTArrayDesignator#setSubscriptExpression(org.eclipse.cdt.core.dom.ast.IASTExpression)
*/
public void setSubscriptExpression(IASTExpression value) {
exp = value;
if(value != null) {
value.setParent(this);
value.setPropertyInParent(SUBSCRIPT_EXPRESSION);
}
}
public boolean accept( ASTVisitor action ){

View file

@ -23,18 +23,25 @@ public class CASTArrayModifier extends CASTNode implements IASTArrayModifier, IA
private IASTExpression exp;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTArrayModifier#getConstantExpression()
*/
public CASTArrayModifier() {
}
public CASTArrayModifier(IASTExpression exp) {
setConstantExpression(exp);
}
public IASTExpression getConstantExpression() {
return exp;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTArrayModifier#setConstantExpression(org.eclipse.cdt.core.dom.ast.IASTExpression)
*/
public void setConstantExpression(IASTExpression expression) {
this.exp = expression;
if(expression != null) {
expression.setParent(this);
expression.setPropertyInParent(CONSTANT_EXPRESSION);
}
}
public boolean accept( ASTVisitor action ){

View file

@ -26,32 +26,36 @@ public class CASTArrayRangeDesignator extends CASTNode implements
private IASTExpression floor, ceiling;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.c.gcc.IGCCASTArrayRangeDesignator#getRangeFloor()
*/
public IASTExpression getRangeFloor() {
public CASTArrayRangeDesignator() {
}
public CASTArrayRangeDesignator(IASTExpression floor, IASTExpression ceiling) {
setRangeFloor(floor);
setRangeCeiling(ceiling);
}
public IASTExpression getRangeFloor() {
return this.floor;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.c.gcc.IGCCASTArrayRangeDesignator#setRangeFloor(org.eclipse.cdt.core.dom.ast.IASTExpression)
*/
public void setRangeFloor(IASTExpression expression) {
floor =expression;
floor = expression;
if(expression != null) {
expression.setParent(this);
expression.setPropertyInParent(SUBSCRIPT_FLOOR_EXPRESSION);
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.c.gcc.IGCCASTArrayRangeDesignator#getRangeCeiling()
*/
public IASTExpression getRangeCeiling() {
return ceiling;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.c.gcc.IGCCASTArrayRangeDesignator#setRangeCeiling(org.eclipse.cdt.core.dom.ast.IASTExpression)
*/
public void setRangeCeiling(IASTExpression expression) {
ceiling = expression;
if(expression != null) {
expression.setParent(this);
expression.setPropertyInParent(SUBSCRIPT_CEILING_EXPRESSION);
}
}
public boolean accept( ASTVisitor action ){

View file

@ -27,12 +27,24 @@ public class CASTArraySubscriptExpression extends CASTNode implements
private IASTExpression array;
private IASTExpression subscript;
public IASTExpression getArrayExpression() {
public CASTArraySubscriptExpression() {
}
public CASTArraySubscriptExpression(IASTExpression array, IASTExpression subscript) {
setArrayExpression(array);
setSubscriptExpression(subscript);
}
public IASTExpression getArrayExpression() {
return array;
}
public void setArrayExpression(IASTExpression expression) {
array = expression;
if(expression != null) {
expression.setParent(this);
expression.setPropertyInParent(ARRAY);
}
}
public IASTExpression getSubscriptExpression() {
@ -41,6 +53,10 @@ public class CASTArraySubscriptExpression extends CASTNode implements
public void setSubscriptExpression(IASTExpression expression) {
this.subscript = expression;
if(expression != null) {
expression.setParent(this);
expression.setPropertyInParent(SUBSCRIPT);
}
}
public boolean accept( ASTVisitor action ){

View file

@ -24,7 +24,7 @@ public abstract class CASTBaseDeclSpecifier extends CASTNode implements ICASTDec
protected boolean isRestrict;
protected boolean isInline;
public boolean isRestrict() {
public boolean isRestrict() {
return isRestrict;
}
@ -44,37 +44,22 @@ public abstract class CASTBaseDeclSpecifier extends CASTNode implements ICASTDec
return isInline;
}
/**
* @param storageClass The storageClass to set.
*/
public void setStorageClass(int storageClass) {
this.storageClass = storageClass;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier#setConst(boolean)
*/
public void setConst(boolean value) {
this.isConst = value;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier#setVolatile(boolean)
*/
public void setVolatile(boolean value) {
this.isVolatile = value;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.c.ICASTDeclSpecifier#setRestrict(boolean)
*/
public void setRestrict(boolean value) {
this.isRestrict = value;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier#setInline(boolean)
*/
public void setInline(boolean value) {
this.isInline = value;
}

View file

@ -28,7 +28,16 @@ public class CASTBinaryExpression extends CASTNode implements
private IASTExpression operand1;
private IASTExpression operand2;
public int getOperator() {
public CASTBinaryExpression() {
}
public CASTBinaryExpression(int op, IASTExpression operand1, IASTExpression operand2) {
this.op = op;
setOperand1(operand1);
setOperand2(operand2);
}
public int getOperator() {
return op;
}
@ -40,16 +49,27 @@ public class CASTBinaryExpression extends CASTNode implements
return operand2;
}
/**
* @param op An op_X field from {@link IASTBinaryExpression}
*/
public void setOperator(int op) {
this.op = op;
}
public void setOperand1(IASTExpression expression) {
operand1 = expression;
operand1 = expression;
if (expression != null) {
expression.setParent(this);
expression.setPropertyInParent(OPERAND_ONE);
}
}
public void setOperand2(IASTExpression expression) {
operand2 = expression;
if (expression != null) {
expression.setParent(this);
expression.setPropertyInParent(OPERAND_TWO);
}
}
public boolean accept( ASTVisitor action ){

View file

@ -24,18 +24,24 @@ public class CASTCaseStatement extends CASTNode implements IASTCaseStatement, IA
private IASTExpression expression;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTCaseStatement#getExpression()
*/
public IASTExpression getExpression() {
public CASTCaseStatement() {
}
public CASTCaseStatement(IASTExpression expression) {
setExpression(expression);
}
public IASTExpression getExpression() {
return expression;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTCaseStatement#setExpression(org.eclipse.cdt.core.dom.ast.IASTExpression)
*/
public void setExpression(IASTExpression expression) {
this.expression = expression;
if (expression != null) {
expression.setParent(this);
expression.setPropertyInParent(EXPRESSION);
}
}
public boolean accept( ASTVisitor action ){

View file

@ -18,21 +18,27 @@ import org.eclipse.cdt.core.dom.ast.IASTTypeId;
/**
* @author jcamelon
*/
public class CASTCastExpression extends CASTUnaryExpression implements
IASTCastExpression {
public class CASTCastExpression extends CASTUnaryExpression implements IASTCastExpression {
private IASTTypeId typeId;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTUnaryTypeIdExpression#setTypeId(org.eclipse.cdt.core.dom.ast.IASTTypeId)
*/
public void setTypeId(IASTTypeId typeId) {
public CASTCastExpression() {
}
public CASTCastExpression(IASTTypeId typeId, IASTExpression operand) {
super(op_cast, operand);
setTypeId(typeId);
}
public void setTypeId(IASTTypeId typeId) {
this.typeId = typeId;
if (typeId != null) {
typeId.setParent(this);
typeId.setPropertyInParent(TYPE_ID);
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTUnaryTypeIdExpression#getTypeId()
*/
public IASTTypeId getTypeId() {
return typeId;
}

View file

@ -28,33 +28,33 @@ public class CASTCompositeTypeSpecifier extends CASTBaseDeclSpecifier implements
private int key;
private IASTName name;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier#getKey()
*/
public CASTCompositeTypeSpecifier() {
}
public CASTCompositeTypeSpecifier(int key, IASTName name) {
this.key = key;
setName(name);
}
public int getKey() {
return key;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier#setKey(int)
*/
public void setKey(int key) {
this.key = key;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier#getName()
*/
public IASTName getName() {
return name;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier#setName(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public void setName(IASTName name) {
this.name = name;
if (name != null) {
name.setParent(this);
name.setPropertyInParent(TYPE_NAME);
}
}
@ -63,37 +63,28 @@ public class CASTCompositeTypeSpecifier extends CASTBaseDeclSpecifier implements
private IScope scope = null;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier#getMembers()
*/
public IASTDeclaration [] getMembers() {
if( declarations == null ) return IASTDeclaration.EMPTY_DECLARATION_ARRAY;
declarations = (IASTDeclaration[]) ArrayUtil.removeNullsAfter( IASTDeclaration.class, declarations, declarationsPos );
return declarations;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier#addMemberDeclaration(org.eclipse.cdt.core.dom.ast.IASTDeclaration)
*/
public void addMemberDeclaration(IASTDeclaration declaration) {
if (declaration != null) {
declaration.setParent(this);
declaration.setPropertyInParent(MEMBER_DECLARATION);
declarations = (IASTDeclaration[]) ArrayUtil.append( IASTDeclaration.class, declarations, ++declarationsPos, declaration );
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier#getScope()
*/
public IScope getScope() {
if( scope == null )
scope = new CCompositeTypeScope( this );
return scope;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier#getRawSignature()
*/
public String getRawSignature() {
return getName().toString() == null ? "" : getName().toString(); //$NON-NLS-1$
}
@ -122,12 +113,12 @@ public class CASTCompositeTypeSpecifier extends CASTBaseDeclSpecifier implements
return true;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public int getRoleForName(IASTName n) {
if( n == this.name )
return r_definition;
return r_unclear;
}
}

View file

@ -22,33 +22,25 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
/**
* @author jcamelon
*/
public class CASTCompoundStatement extends CASTNode implements
IASTCompoundStatement, IASTAmbiguityParent {
public class CASTCompoundStatement extends CASTNode implements IASTCompoundStatement, IASTAmbiguityParent {
private IASTStatement [] statements = null;
private IScope scope = null;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTCompoundStatement#getStatements()
*/
public IASTStatement[] getStatements() {
if( statements == null ) return IASTStatement.EMPTY_STATEMENT_ARRAY;
return (IASTStatement[]) ArrayUtil.trim( IASTStatement.class, statements );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTCompoundStatement#addStatement(org.eclipse.cdt.core.dom.ast.IASTStatement)
*/
public void addStatement(IASTStatement statement) {
statements = (IASTStatement[]) ArrayUtil.append( IASTStatement.class, statements, statement );
if(statement != null) {
statement.setParent(this);
statement.setPropertyInParent(NESTED_STATEMENT);
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTCompoundStatement#resolveBinding()
*/
public IScope getScope() {
if( scope == null )
scope = new CScope( this );
@ -90,5 +82,4 @@ public class CASTCompoundStatement extends CASTNode implements
}
}
}
}
}

View file

@ -24,12 +24,23 @@ public class CASTCompoundStatementExpression extends CASTNode implements
private IASTCompoundStatement statement;
public IASTCompoundStatement getCompoundStatement() {
public CASTCompoundStatementExpression() {
}
public CASTCompoundStatementExpression(IASTCompoundStatement statement) {
setCompoundStatement(statement);
}
public IASTCompoundStatement getCompoundStatement() {
return statement;
}
public void setCompoundStatement(IASTCompoundStatement statement) {
this.statement = statement;
if (statement != null) {
statement.setParent(this);
statement.setPropertyInParent(STATEMENT);
}
}
public boolean accept( ASTVisitor action ){

View file

@ -28,12 +28,26 @@ public class CASTConditionalExpression extends CASTNode implements
private IASTExpression negative;
private IASTExpression positive;
public IASTExpression getLogicalConditionExpression() {
public CASTConditionalExpression() {
}
public CASTConditionalExpression(IASTExpression condition,
IASTExpression positive, IASTExpression negative) {
setLogicalConditionExpression(condition);
setPositiveResultExpression(positive);
setNegativeResultExpression(negative);
}
public IASTExpression getLogicalConditionExpression() {
return condition;
}
public void setLogicalConditionExpression(IASTExpression expression) {
condition = expression;
if (expression != null) {
expression.setParent(this);
expression.setPropertyInParent(LOGICAL_CONDITION);
}
}
public IASTExpression getPositiveResultExpression() {
@ -42,6 +56,10 @@ public class CASTConditionalExpression extends CASTNode implements
public void setPositiveResultExpression(IASTExpression expression) {
this.positive = expression;
if (expression != null) {
expression.setParent(this);
expression.setPropertyInParent(POSITIVE_RESULT);
}
}
public IASTExpression getNegativeResultExpression() {
@ -50,6 +68,10 @@ public class CASTConditionalExpression extends CASTNode implements
public void setNegativeResultExpression(IASTExpression expression) {
this.negative = expression;
if (expression != null) {
expression.setParent(this);
expression.setPropertyInParent(NEGATIVE_RESULT);
}
}
public boolean accept( ASTVisitor action ){

View file

@ -18,23 +18,28 @@ import org.eclipse.cdt.core.dom.ast.IASTDeclarationStatement;
/**
* @author jcamelon
*/
public class CASTDeclarationStatement extends CASTNode implements
IASTDeclarationStatement {
public class CASTDeclarationStatement extends CASTNode implements IASTDeclarationStatement {
private IASTDeclaration declaration;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarationStatement#getDeclaration()
*/
public IASTDeclaration getDeclaration() {
public CASTDeclarationStatement() {
}
public CASTDeclarationStatement(IASTDeclaration declaration) {
setDeclaration(declaration);
}
public IASTDeclaration getDeclaration() {
return declaration;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarationStatement#setDeclaration(org.eclipse.cdt.core.dom.ast.IASTDeclaration)
*/
public void setDeclaration(IASTDeclaration declaration) {
this.declaration = declaration;
if (declaration != null) {
declaration.setParent(this);
declaration.setPropertyInParent(DECLARATION);
}
}
public boolean accept( ASTVisitor action ){

View file

@ -39,65 +39,67 @@ public class CASTDeclarator extends CASTNode implements IASTDeclarator {
private int pointerOpsPos=-1;
public CASTDeclarator() {
}
public CASTDeclarator(IASTName name) {
setName(name);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarator#getPointerOperators()
*/
public IASTPointerOperator[] getPointerOperators() {
public CASTDeclarator(IASTName name, IASTInitializer initializer) {
setInitializer(initializer);
setName(name);
}
public IASTPointerOperator[] getPointerOperators() {
if( pointerOps == null ) return IASTPointerOperator.EMPTY_ARRAY;
pointerOps = (IASTPointerOperator[]) ArrayUtil.removeNullsAfter( IASTPointerOperator.class, pointerOps, pointerOpsPos );
return pointerOps;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarator#getNestedDeclarator()
*/
public IASTDeclarator getNestedDeclarator() {
return nestedDeclarator;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarator#getName()
*/
public IASTName getName() {
return name;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarator#getInitializer()
*/
public IASTInitializer getInitializer() {
return initializer;
}
/**
* @param initializer
*/
public void setInitializer(IASTInitializer initializer) {
this.initializer = initializer;
if (initializer != null) {
initializer.setParent(this);
initializer.setPropertyInParent(INITIALIZER);
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarator#addPointerOperator(org.eclipse.cdt.core.dom.ast.IASTPointerOperator)
*/
public void addPointerOperator(IASTPointerOperator operator) {
if (operator != null) {
operator.setParent(this);
operator.setPropertyInParent(POINTER_OPERATOR);
pointerOps = (IASTPointerOperator[]) ArrayUtil.append( IASTPointerOperator.class, pointerOps, ++pointerOpsPos, operator );
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarator#setNestedDeclarator(org.eclipse.cdt.core.dom.ast.IASTDeclarator)
*/
public void setNestedDeclarator(IASTDeclarator nested) {
this.nestedDeclarator = nested;
if (nested != null) {
nested.setParent(this);
nested.setPropertyInParent(NESTED_DECLARATOR);
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarator#setName(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public void setName(IASTName name) {
this.name = name;
if (name != null) {
name.setParent(this);
name.setPropertyInParent(DECLARATOR_NAME);;
}
}
public boolean accept( ASTVisitor action ){
@ -147,9 +149,6 @@ public class CASTDeclarator extends CASTNode implements IASTDeclarator {
return true;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public int getRoleForName(IASTName n ) {
if( n == this.name )
{

View file

@ -25,18 +25,23 @@ public class CASTDesignatedInitializer extends CASTNode implements
private IASTInitializer rhs;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.c.ICASTDesignatedInitializer#addDesignator(org.eclipse.cdt.core.dom.ast.c.ICASTDesignator)
*/
public void addDesignator(ICASTDesignator designator) {
public CASTDesignatedInitializer() {
}
public CASTDesignatedInitializer(IASTInitializer rhs) {
setOperandInitializer(rhs);
}
public void addDesignator(ICASTDesignator designator) {
if (designator != null) {
designator.setParent(this);
designator.setPropertyInParent(DESIGNATOR);
designators = (ICASTDesignator[]) ArrayUtil.append( ICASTDesignator.class, designators, ++designatorsPos, designator );
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.c.ICASTDesignatedInitializer#getDesignators()
*/
public ICASTDesignator[] getDesignators() {
if( designators == null ) return ICASTDesignatedInitializer.EMPTY_DESIGNATOR_ARRAY;
designators = (ICASTDesignator[]) ArrayUtil.removeNullsAfter( ICASTDesignator.class, designators, designatorsPos );
@ -45,18 +50,19 @@ public class CASTDesignatedInitializer extends CASTNode implements
private ICASTDesignator [] designators = null;
int designatorsPos=-1;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.c.ICASTDesignatedInitializer#getRHSInitializer()
*/
public IASTInitializer getOperandInitializer() {
return rhs;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.c.ICASTDesignatedInitializer#setRHSInitializer(org.eclipse.cdt.core.dom.ast.IASTInitializer)
*/
public void setOperandInitializer(IASTInitializer rhs) {
this.rhs = rhs;
if (rhs != null) {
rhs.setParent(this);
rhs.setPropertyInParent(OPERAND);
}
}
public boolean accept( ASTVisitor action ){

View file

@ -26,32 +26,39 @@ public class CASTDoStatement extends CASTNode implements IASTDoStatement, IASTAm
private IASTStatement body;
private IASTExpression condition;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTDoStatement#getBody()
*/
public IASTStatement getBody() {
public CASTDoStatement() {
}
public CASTDoStatement(IASTStatement body, IASTExpression condition) {
setBody(body);
setCondition(condition);
}
public IASTStatement getBody() {
return body;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTDoStatement#setBody(org.eclipse.cdt.core.dom.ast.IASTStatement)
*/
public void setBody(IASTStatement body) {
this.body = body;
if (body != null) {
body.setParent(this);
body.setPropertyInParent(BODY);
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTDoStatement#getCondition()
*/
public IASTExpression getCondition() {
return condition;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTDoStatement#setCondition(org.eclipse.cdt.core.dom.ast.IASTExpression)
*/
public void setCondition(IASTExpression condition) {
this.condition = condition;
if (condition != null) {
condition.setParent(this);
condition.setPropertyInParent(CONDITION);
}
}
public boolean accept( ASTVisitor action ){

View file

@ -29,32 +29,33 @@ public class CASTElaboratedTypeSpecifier extends CASTBaseDeclSpecifier implement
private int kind;
private IASTName name;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier#getKind()
*/
public int getKind() {
public CASTElaboratedTypeSpecifier() {
}
public CASTElaboratedTypeSpecifier(int kind, IASTName name) {
this.kind = kind;
this.name = name;
}
public int getKind() {
return kind;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier#setKind(int)
*/
public void setKind(int value) {
this.kind = value;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier#getName()
*/
public IASTName getName() {
return name;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier#setName(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public void setName(IASTName name) {
this.name = name;
if (name != null) {
name.setParent(this);
name.setPropertyInParent(TYPE_NAME);
}
}
public boolean accept( ASTVisitor action ){
@ -76,9 +77,6 @@ public class CASTElaboratedTypeSpecifier extends CASTBaseDeclSpecifier implement
return true;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public int getRoleForName(IASTName n ) {
if( n != name ) return r_unclear;

View file

@ -25,18 +25,23 @@ public class CASTEnumerationSpecifier extends CASTBaseDeclSpecifier implements
private IASTName name;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier#addEnumerator(org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator)
*/
public void addEnumerator(IASTEnumerator enumerator) {
public CASTEnumerationSpecifier() {
}
public CASTEnumerationSpecifier(IASTName name) {
setName(name);
}
public void addEnumerator(IASTEnumerator enumerator) {
if (enumerator != null) {
enumerator.setParent(this);
enumerator.setPropertyInParent(ENUMERATOR);
enumerators = (IASTEnumerator[]) ArrayUtil.append( IASTEnumerator.class, enumerators, ++enumeratorsPos, enumerator );
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier#getEnumerators()
*/
public IASTEnumerator[] getEnumerators() {
if( enumerators == null ) return IASTEnumerator.EMPTY_ENUMERATOR_ARRAY;
enumerators = (IASTEnumerator[]) ArrayUtil.removeNullsAfter( IASTEnumerator.class, enumerators, enumeratorsPos );
@ -46,23 +51,19 @@ public class CASTEnumerationSpecifier extends CASTBaseDeclSpecifier implements
private IASTEnumerator [] enumerators = null;
private int enumeratorsPos=-1;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier#setName(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public void setName(IASTName name) {
this.name = name;
if (name != null) {
name.setParent(this);
name.setPropertyInParent(ENUMERATION_NAME);
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier#getName()
*/
public IASTName getName() {
return name;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier#getRawSignature()
*/
public String getRawSignature() {
return getName().toString() == null ? "" : getName().toString(); //$NON-NLS-1$
}
@ -90,9 +91,6 @@ public class CASTEnumerationSpecifier extends CASTBaseDeclSpecifier implements
return true;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public int getRoleForName(IASTName n ) {
if( this.name == n )
return r_definition;

View file

@ -26,30 +26,35 @@ public class CASTEnumerator extends CASTNode implements IASTEnumerator, IASTAmbi
private IASTName name;
private IASTExpression value;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator#setName(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public void setName(IASTName name) {
public CASTEnumerator() {
}
public CASTEnumerator(IASTName name, IASTExpression value) {
setName(name);
setValue(value);
}
public void setName(IASTName name) {
this.name = name;
if (name != null) {
name.setParent(this);
name.setPropertyInParent(ENUMERATOR_NAME);
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator#getName()
*/
public IASTName getName() {
return name;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator#setValue(org.eclipse.cdt.core.dom.ast.IASTExpression)
*/
public void setValue(IASTExpression expression) {
this.value = expression;
if (expression != null) {
expression.setParent(this);
expression.setPropertyInParent(ENUMERATOR_VALUE);
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator#getValue()
*/
public IASTExpression getValue() {
return value;
}
@ -74,9 +79,7 @@ public class CASTEnumerator extends CASTNode implements IASTEnumerator, IASTAmbi
return true;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public int getRoleForName(IASTName n) {
if( n == name )return r_definition;
return r_unclear;

View file

@ -34,6 +34,10 @@ public class CASTExpressionList extends CASTNode implements IASTExpressionList,
public void addExpression(IASTExpression expression) {
expressions = (IASTExpression[]) ArrayUtil.append( IASTExpression.class, expressions, expression );
if(expression != null) {
expression.setParent(this);
expression.setPropertyInParent(NESTED_EXPRESSION);
}
}
private IASTExpression [] expressions = new IASTExpression[2];

View file

@ -25,22 +25,24 @@ public class CASTExpressionStatement extends CASTNode implements
private IASTExpression expression;
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IASTExpressionStatement#getExpression()
*/
public IASTExpression getExpression() {
public CASTExpressionStatement() {
}
public CASTExpressionStatement(IASTExpression expression) {
setExpression(expression);
}
public IASTExpression getExpression() {
return expression;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IASTExpressionStatement#setExpression(org.eclipse.cdt.core.dom.ast.IASTExpression)
*/
public void setExpression(IASTExpression expression) {
this.expression = expression;
if (expression != null) {
expression.setParent(this);
expression.setPropertyInParent(EXPRESSION);
}
}
public boolean accept(ASTVisitor action) {

View file

@ -14,6 +14,7 @@ import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTFieldDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
@ -25,18 +26,26 @@ public class CASTFieldDeclarator extends CASTDeclarator implements
private IASTExpression bitFieldSize;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTFieldDeclarator#getBitFieldSize()
*/
public IASTExpression getBitFieldSize() {
public CASTFieldDeclarator() {
}
public CASTFieldDeclarator(IASTName name, IASTExpression bitFieldSize) {
super(name);
setBitFieldSize(bitFieldSize);
}
public IASTExpression getBitFieldSize() {
return bitFieldSize;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTFieldDeclarator#setBitFieldSize(org.eclipse.cdt.core.dom.ast.IASTExpression)
*/
public void setBitFieldSize(IASTExpression size) {
bitFieldSize = size;
if (size != null) {
size.setParent(this);
size.setPropertyInParent(FIELD_SIZE);
}
}
protected boolean postAccept( ASTVisitor action ){

View file

@ -24,18 +24,24 @@ public class CASTFieldDesignator extends CASTNode implements
private IASTName name;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.c.ICASTFieldDesignator#getName()
*/
public IASTName getName() {
public CASTFieldDesignator() {
}
public CASTFieldDesignator(IASTName name) {
setName(name);
}
public IASTName getName() {
return name;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.c.ICASTFieldDesignator#setName(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public void setName(IASTName name) {
this.name = name;
if (name != null) {
name.setParent(this);
name.setPropertyInParent(FIELD_NAME);
}
}
public boolean accept( ASTVisitor action ){

View file

@ -31,12 +31,31 @@ public class CASTFieldReference extends CASTNode implements IASTFieldReference,
private IASTName name;
private boolean ptr;
public IASTExpression getFieldOwner() {
public CASTFieldReference() {
}
public CASTFieldReference(IASTName name, IASTExpression owner) {
this(name, owner, false);
}
public CASTFieldReference(IASTName name, IASTExpression owner, boolean ptr) {
setFieldOwner(owner);
setFieldName(name);
this.ptr = ptr;
}
public IASTExpression getFieldOwner() {
return owner;
}
public void setFieldOwner(IASTExpression expression) {
this.owner = expression;
if (expression != null) {
expression.setParent(this);
expression.setPropertyInParent(FIELD_OWNER);
}
}
public IASTName getFieldName() {
@ -45,6 +64,10 @@ public class CASTFieldReference extends CASTNode implements IASTFieldReference,
public void setFieldName(IASTName name) {
this.name = name;
if (name != null) {
name.setParent(this);
name.setPropertyInParent(FIELD_NAME);
}
}
public boolean isPointerDereference() {

View file

@ -30,52 +30,64 @@ public class CASTForStatement extends CASTNode implements IASTForStatement, IAST
private IASTStatement body, init;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTForStatement#getCondition()
*/
public IASTExpression getConditionExpression() {
public CASTForStatement() {
}
public CASTForStatement(IASTStatement init, IASTExpression condition,
IASTExpression iterationExpression, IASTStatement body) {
setInitializerStatement(init);
setConditionExpression(condition);
setIterationExpression(iterationExpression);
setBody(body);
}
public IASTExpression getConditionExpression() {
return condition;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTForStatement#setCondition(org.eclipse.cdt.core.dom.ast.IASTExpression)
*/
public void setConditionExpression(IASTExpression condition) {
this.condition = condition;
if (condition != null) {
condition.setParent(this);
condition.setPropertyInParent(CONDITION);
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTForStatement#getIterationExpression()
*/
public IASTExpression getIterationExpression() {
return iterationExpression;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTForStatement#setIterationExpression(org.eclipse.cdt.core.dom.ast.IASTExpression)
*/
public void setIterationExpression(IASTExpression iterator) {
this.iterationExpression = iterator;
if (iterator != null) {
iterator.setParent(this);
iterator.setPropertyInParent(ITERATION);
}
}
public IASTStatement getInitializerStatement() {
return init;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTForStatement#getBody()
*/
public void setInitializerStatement(IASTStatement statement) {
init = statement;
if (statement != null) {
statement.setParent(this);
statement.setPropertyInParent(INITIALIZER);
}
}
public IASTStatement getBody() {
return body;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTForStatement#setBody(org.eclipse.cdt.core.dom.ast.IASTStatement)
*/
public void setBody(IASTStatement statement) {
body = statement;
if (statement != null) {
statement.setParent(this);
statement.setPropertyInParent(BODY);
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTForStatement#getScope()
*/
public IScope getScope() {
if( scope == null )
scope = new CScope( this );
@ -133,14 +145,4 @@ public class CASTForStatement extends CASTNode implements IASTForStatement, IAST
}
}
public IASTStatement getInitializerStatement() {
return init;
}
public void setInitializerStatement(IASTStatement statement) {
init = statement;
}
}
}

View file

@ -27,8 +27,21 @@ public class CASTFunctionCallExpression extends CASTNode implements
private IASTExpression functionName;
private IASTExpression parameter;
public void setFunctionNameExpression(IASTExpression expression) {
public CASTFunctionCallExpression() {
}
public CASTFunctionCallExpression(IASTExpression functionName, IASTExpression parameter) {
setFunctionNameExpression(functionName);
setParameterExpression(parameter);
}
public void setFunctionNameExpression(IASTExpression expression) {
this.functionName = expression;
if (expression != null) {
expression.setParent(this);
expression.setPropertyInParent(FUNCTION_NAME);
}
}
public IASTExpression getFunctionNameExpression() {
@ -37,6 +50,10 @@ public class CASTFunctionCallExpression extends CASTNode implements
public void setParameterExpression(IASTExpression expression) {
this.parameter = expression;
if (expression != null) {
expression.setParent(this);
expression.setPropertyInParent(PARAMETERS);
}
}
public IASTExpression getParameterExpression() {

View file

@ -12,6 +12,7 @@
package org.eclipse.cdt.internal.core.dom.parser.c;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTStandardFunctionDeclarator;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
@ -19,8 +20,7 @@ import org.eclipse.cdt.core.parser.util.ArrayUtil;
/**
* @author jcamelon
*/
public class CASTFunctionDeclarator extends CASTDeclarator implements
IASTStandardFunctionDeclarator {
public class CASTFunctionDeclarator extends CASTDeclarator implements IASTStandardFunctionDeclarator {
private IASTParameterDeclaration [] parameters = null;
private int parametersPos=-1;
@ -28,34 +28,31 @@ public class CASTFunctionDeclarator extends CASTDeclarator implements
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator#getParameters()
*/
public IASTParameterDeclaration[] getParameters() {
public CASTFunctionDeclarator() {
}
public CASTFunctionDeclarator(IASTName name) {
super(name);
}
public IASTParameterDeclaration[] getParameters() {
if( parameters == null ) return IASTParameterDeclaration.EMPTY_PARAMETERDECLARATION_ARRAY;
parameters = (IASTParameterDeclaration[]) ArrayUtil.removeNullsAfter( IASTParameterDeclaration.class, parameters, parametersPos );
return parameters;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator#addParameterDeclaration(org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration)
*/
public void addParameterDeclaration(IASTParameterDeclaration parameter) {
if (parameter != null) {
parameter.setParent(this);
parameter.setPropertyInParent(FUNCTION_PARAMETER);
parameters = (IASTParameterDeclaration[]) ArrayUtil.append( IASTParameterDeclaration.class, parameters, ++parametersPos, parameter );
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator#takesVarArgs()
*/
public boolean takesVarArgs() {
return varArgs;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator#setVarArgs(boolean)
*/
public void setVarArgs(boolean value) {
varArgs = value;
}

View file

@ -31,51 +31,53 @@ public class CASTFunctionDefinition extends CASTNode implements
private IASTStatement bodyStatement;
private ICFunctionScope scope;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition#getDeclSpecifier()
*/
public IASTDeclSpecifier getDeclSpecifier() {
public CASTFunctionDefinition() {
}
public CASTFunctionDefinition(IASTDeclSpecifier declSpecifier,
IASTFunctionDeclarator declarator, IASTStatement bodyStatement) {
setDeclSpecifier(declSpecifier);
setDeclarator(declarator);
setBody(bodyStatement);
}
public IASTDeclSpecifier getDeclSpecifier() {
return declSpecifier;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition#setDeclSpecifier(org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier)
*/
public void setDeclSpecifier(IASTDeclSpecifier declSpec) {
declSpecifier = declSpec;
if (declSpec != null) {
declSpec.setParent(this);
declSpec.setPropertyInParent(DECL_SPECIFIER);
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition#getDeclarator()
*/
public IASTFunctionDeclarator getDeclarator() {
return declarator;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition#setDeclarator(org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator)
*/
public void setDeclarator(IASTFunctionDeclarator declarator) {
this.declarator = declarator;
if (declarator != null) {
declarator.setParent(this);
declarator.setPropertyInParent(DECLARATOR);
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition#getBody()
*/
public IASTStatement getBody() {
return bodyStatement;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition#setBody(org.eclipse.cdt.core.dom.ast.IASTStatement)
*/
public void setBody(IASTStatement statement) {
bodyStatement = statement;
if (statement != null) {
statement.setParent(this);
statement.setPropertyInParent(FUNCTION_BODY);
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition#getScope()
*/
public IScope getScope() {
if( scope == null )
scope = new CFunctionScope( this );

View file

@ -22,18 +22,23 @@ public class CASTGotoStatement extends CASTNode implements IASTGotoStatement {
private IASTName name;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTGotoStatement#getName()
*/
public IASTName getName() {
public CASTGotoStatement() {
}
public CASTGotoStatement(IASTName name) {
setName(name);
}
public IASTName getName() {
return this.name;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTGotoStatement#setName(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public void setName(IASTName name) {
this.name = name;
if (name != null) {
name.setParent(this);
name.setPropertyInParent(NAME);
}
}
public boolean accept( ASTVisitor action ){
@ -56,9 +61,6 @@ public class CASTGotoStatement extends CASTNode implements IASTGotoStatement {
return true;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public int getRoleForName(IASTName n) {
if( n == name ) return r_reference;
return r_unclear;

View file

@ -26,12 +26,24 @@ public class CASTIdExpression extends CASTNode implements IASTIdExpression, IAST
private IASTName name;
public IASTName getName() {
public CASTIdExpression() {
}
public CASTIdExpression(IASTName name) {
setName(name);
}
public IASTName getName() {
return name;
}
public void setName(IASTName name) {
this.name = name;
if (name != null) {
name.setParent(this);
name.setPropertyInParent(ID_NAME);
}
}
public boolean accept( ASTVisitor action ){

View file

@ -27,46 +27,56 @@ public class CASTIfStatement extends CASTNode implements IASTIfStatement, IASTAm
private IASTStatement thenClause;
private IASTStatement elseClause;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTIfStatement#getCondition()
*/
public IASTExpression getConditionExpression() {
public CASTIfStatement() {
}
public CASTIfStatement(IASTExpression condition, IASTStatement thenClause) {
setConditionExpression(condition);
setThenClause(thenClause);
}
public CASTIfStatement(IASTExpression condition, IASTStatement thenClause, IASTStatement elseClause) {
this(condition, thenClause);
setElseClause(elseClause);
}
public IASTExpression getConditionExpression() {
return condition;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTIfStatement#setCondition(org.eclipse.cdt.core.dom.ast.IASTExpression)
*/
public void setConditionExpression(IASTExpression condition) {
this.condition = condition;
if (condition != null) {
condition.setParent(this);
condition.setPropertyInParent(CONDITION);
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTIfStatement#getThenClause()
*/
public IASTStatement getThenClause() {
return thenClause;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTIfStatement#setThenClause(org.eclipse.cdt.core.dom.ast.IASTStatement)
*/
public void setThenClause(IASTStatement thenClause) {
this.thenClause = thenClause;
if (thenClause != null) {
thenClause.setParent(this);
thenClause.setPropertyInParent(THEN);
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTIfStatement#getElseClause()
*/
public IASTStatement getElseClause() {
return elseClause;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTIfStatement#setElseClause(org.eclipse.cdt.core.dom.ast.IASTStatement)
*/
public void setElseClause(IASTStatement elseClause) {
this.elseClause = elseClause;
if (elseClause != null) {
elseClause.setParent(this);
elseClause.setPropertyInParent(ELSE);
}
}
public boolean accept( ASTVisitor action ){

View file

@ -25,18 +25,24 @@ public class CASTInitializerExpression extends CASTNode implements
private IASTExpression expression;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTInitializerExpression#getExpression()
*/
public IASTExpression getExpression() {
public CASTInitializerExpression() {
}
public CASTInitializerExpression(IASTExpression expression) {
setExpression(expression);
}
public IASTExpression getExpression() {
return expression;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTInitializerExpression#setExpression(org.eclipse.cdt.core.dom.ast.IASTExpression)
*/
public void setExpression(IASTExpression expression) {
this.expression = expression;
if (expression != null) {
expression.setParent(this);
expression.setPropertyInParent(INITIALIZER_EXPRESSION);
}
}
public boolean accept( ASTVisitor action ){

View file

@ -24,19 +24,17 @@ public class CASTInitializerList extends CASTNode implements
IASTInitializerList {
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration#getDeclarators()
*/
public IASTInitializer[] getInitializers() {
if( initializers == null ) return IASTInitializer.EMPTY_INITIALIZER_ARRAY;
initializers = (IASTInitializer[]) ArrayUtil.removeNullsAfter( IASTInitializer.class, initializers, initializersPos );
return initializers;
}
public void addInitializer( IASTInitializer d )
{
public void addInitializer( IASTInitializer d ) {
if (d != null) {
initializers = (IASTInitializer[]) ArrayUtil.append( IASTInitializer.class, initializers, ++initializersPos, d );
initializers = (IASTInitializer[]) ArrayUtil.append( IASTInitializer.class, initializers, ++initializersPos, d );
d.setParent(this);
d.setPropertyInParent(NESTED_INITIALIZER);
}
}

View file

@ -28,30 +28,45 @@ public class CASTKnRFunctionDeclarator extends CASTDeclarator implements ICASTKn
IASTName[] parameterNames = IASTName.EMPTY_NAME_ARRAY;
IASTDeclaration[] parameterDeclarations = IASTDeclaration.EMPTY_DECLARATION_ARRAY;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.gnu.c.ICASTKnRFunctionDeclarator#setParameterNames(org.eclipse.cdt.core.dom.ast.IASTName[])
*/
public void setParameterNames(IASTName[] names) {
parameterNames = names;
public CASTKnRFunctionDeclarator() {
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.gnu.c.ICASTKnRFunctionDeclarator#getParameterNames()
*/
public CASTKnRFunctionDeclarator(IASTName[] parameterNames, IASTDeclaration[] parameterDeclarations) {
setParameterNames(parameterNames);
setParameterDeclarations(parameterDeclarations);
}
public void setParameterNames(IASTName[] names) {
parameterNames = names;
for(int i = 0; i < names.length; i++) {
IASTName name = names[i];
if (name != null) {
name.setParent(this);
name.setPropertyInParent(PARAMETER_NAME);
}
}
}
public IASTName[] getParameterNames() {
return parameterNames;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.gnu.c.ICASTKnRFunctionDeclarator#setParameterDeclarations(org.eclipse.cdt.core.dom.ast.IASTDeclaration[])
*/
public void setParameterDeclarations(IASTDeclaration[] decls) {
parameterDeclarations = decls;
for(int i = 0; i < parameterDeclarations.length; i++) {
IASTDeclaration decl = parameterDeclarations[i];
if (decl != null) {
decl.setParent(this);
decl.setPropertyInParent(FUNCTION_PARAMETER);
}
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.gnu.c.ICASTKnRFunctionDeclarator#getParameterDeclarations()
*/
public IASTDeclaration[] getParameterDeclarations() {
return parameterDeclarations;
}
@ -70,9 +85,6 @@ public class CASTKnRFunctionDeclarator extends CASTDeclarator implements ICASTKn
return true;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.gnu.c.ICASTKnRFunctionDeclarator#getDeclaratorForParameterName()
*/
public IASTDeclarator getDeclaratorForParameterName(IASTName name) {
boolean found=false;
for(int i=0; i<parameterNames.length; i++) {
@ -93,9 +105,6 @@ public class CASTKnRFunctionDeclarator extends CASTDeclarator implements ICASTKn
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.dom.parser.c.CASTDeclarator#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public int getRoleForName(IASTName name) {
IASTName [] n = getParameterNames();
for( int i = 0; i < n.length; ++i )

View file

@ -26,18 +26,25 @@ public class CASTLabelStatement extends CASTNode implements IASTLabelStatement,
private IASTName name;
private IASTStatement nestedStatement;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTLabelStatement#getName()
*/
public IASTName getName() {
public CASTLabelStatement() {
}
public CASTLabelStatement(IASTName name, IASTStatement nestedStatement) {
setName(name);
setNestedStatement(nestedStatement);
}
public IASTName getName() {
return name;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTLabelStatement#setName(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public void setName(IASTName name) {
this.name = name;
if (name != null) {
name.setParent(this);
name.setPropertyInParent(NAME);
}
}
public boolean accept( ASTVisitor action ){
@ -60,9 +67,7 @@ public class CASTLabelStatement extends CASTNode implements IASTLabelStatement,
return true;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public int getRoleForName(IASTName n) {
if( n == name ) return r_declaration;
return r_unclear;
@ -74,6 +79,10 @@ public class CASTLabelStatement extends CASTNode implements IASTLabelStatement,
public void setNestedStatement(IASTStatement s) {
nestedStatement = s;
if (s != null) {
s.setParent(this);
s.setPropertyInParent(NESTED_STATEMENT);
}
}
public void replace(IASTNode child, IASTNode other) {

View file

@ -18,13 +18,22 @@ import org.eclipse.cdt.core.dom.ast.IType;
/**
* @author jcamelon
*/
public class CASTLiteralExpression extends CASTNode implements
IASTLiteralExpression {
public class CASTLiteralExpression extends CASTNode implements IASTLiteralExpression {
private int kind;
private String value = ""; //$NON-NLS-1$
public int getKind() {
public CASTLiteralExpression() {
}
public CASTLiteralExpression(int kind, String value) {
this.kind = kind;
this.value = value;
}
public int getKind() {
return kind;
}

View file

@ -10,13 +10,13 @@
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.c;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.c.ICASTArrayModifier;
/**
* @author jcamelon
*/
public class CASTModifiedArrayModifier extends CASTArrayModifier implements
ICASTArrayModifier {
public class CASTModifiedArrayModifier extends CASTArrayModifier implements ICASTArrayModifier {
private boolean isVolatile;
private boolean isRestrict;
@ -24,74 +24,50 @@ public class CASTModifiedArrayModifier extends CASTArrayModifier implements
private boolean isConst;
private boolean varSized;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.c.ICASTArrayModifier#isConst()
*/
public boolean isConst() {
public CASTModifiedArrayModifier() {
}
public CASTModifiedArrayModifier(IASTExpression exp) {
super(exp);
}
public boolean isConst() {
return isConst;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.c.ICASTArrayModifier#isStatic()
*/
public boolean isStatic() {
return isStatic;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.c.ICASTArrayModifier#isRestrict()
*/
public boolean isRestrict() {
return isRestrict;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.c.ICASTArrayModifier#isVolatile()
*/
public boolean isVolatile() {
return isVolatile;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.c.ICASTArrayModifier#setConst(boolean)
*/
public void setConst(boolean value) {
this.isConst = value;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.c.ICASTArrayModifier#setVolatile(boolean)
*/
public void setVolatile(boolean value) {
this.isVolatile = value;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.c.ICASTArrayModifier#setRestrict(boolean)
*/
public void setRestrict(boolean value) {
this.isRestrict = value;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.c.ICASTArrayModifier#setStatic(boolean)
*/
public void setStatic(boolean value) {
this.isStatic = value;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.c.ICASTArrayModifier#isVariableSized()
*/
public boolean isVariableSized() {
return varSized;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.c.ICASTArrayModifier#setVariableSized(boolean)
*/
public void setVariableSized(boolean value) {
varSized = value;
}
}
}

View file

@ -34,9 +34,7 @@ public class CASTName extends CASTNode implements IASTName {
private IBinding binding = null;
/**
* @param name
*/
public CASTName(char[] name) {
this.name = name;
}
@ -73,11 +71,7 @@ public class CASTName extends CASTNode implements IASTName {
this.binding = binding;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
public String toString() {
if (name == EMPTY_CHAR_ARRAY)
return EMPTY_STRING;
@ -113,11 +107,7 @@ public class CASTName extends CASTNode implements IASTName {
return true;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IASTName#isDeclaration()
*/
public boolean isDeclaration() {
IASTNode parent = getParent();
if (parent instanceof IASTNameOwner) {
@ -133,11 +123,7 @@ public class CASTName extends CASTNode implements IASTName {
return false;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IASTName#isReference()
*/
public boolean isReference() {
IASTNode parent = getParent();
if (parent instanceof IASTNameOwner) {

View file

@ -25,32 +25,37 @@ public class CASTParameterDeclaration extends CASTNode implements
private IASTDeclSpecifier declSpec;
private IASTDeclarator declarator;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration#getDeclSpecifier()
*/
public IASTDeclSpecifier getDeclSpecifier() {
public CASTParameterDeclaration() {
}
public CASTParameterDeclaration(IASTDeclSpecifier declSpec, IASTDeclarator declarator) {
setDeclSpecifier(declSpec);
setDeclarator(declarator);
}
public IASTDeclSpecifier getDeclSpecifier() {
return declSpec;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration#getDeclarator()
*/
public IASTDeclarator getDeclarator() {
return declarator;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration#setDeclSpecifier(org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier)
*/
public void setDeclSpecifier(IASTDeclSpecifier declSpec) {
this.declSpec = declSpec;
if (declSpec != null) {
declSpec.setParent(this);
declSpec.setPropertyInParent(DECL_SPECIFIER);
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration#setDeclarator(org.eclipse.cdt.core.dom.ast.IASTDeclarator)
*/
public void setDeclarator(IASTDeclarator declarator) {
this.declarator = declarator;
if (declarator != null) {
declarator.setParent(this);
declarator.setPropertyInParent(DECLARATOR);
}
}
public boolean accept( ASTVisitor action ){

View file

@ -22,44 +22,36 @@ public class CASTPointer extends CASTNode implements ICASTPointer {
private boolean isVolatile;
private boolean isConst;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.c.ICASTPointer#isRestrict()
*/
public boolean isRestrict() {
public CASTPointer() {
}
public CASTPointer(boolean isRestrict, boolean isVolatile, boolean isConst) {
this.isRestrict = isRestrict;
this.isVolatile = isVolatile;
this.isConst = isConst;
}
public boolean isRestrict() {
return isRestrict;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.c.ICASTPointer#setRestrict(boolean)
*/
public void setRestrict(boolean value) {
isRestrict = value;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTPointer#isConst()
*/
public boolean isConst() {
return isConst;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTPointer#isVolatile()
*/
public boolean isVolatile() {
return isVolatile;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTPointer#setConst(boolean)
*/
public void setConst(boolean value) {
isConst = value;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTPointer#setVolatile(boolean)
*/
public void setVolatile(boolean value) {
isVolatile = value;
}

View file

@ -16,7 +16,6 @@ import java.text.MessageFormat;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
import org.eclipse.cdt.core.dom.ast.IASTNode;
@ -29,45 +28,6 @@ import org.eclipse.cdt.internal.core.parser.ParserMessages;
*/
public class CASTProblem extends CASTNode implements IASTProblem {
private IASTNode parent;
private ASTNodeProperty property;
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IASTNode#getParent()
*/
public IASTNode getParent() {
return parent;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IASTNode#setParent(org.eclipse.cdt.core.dom.ast.IASTNode)
*/
public void setParent(IASTNode node) {
this.parent = node;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IASTNode#getPropertyInParent()
*/
public ASTNodeProperty getPropertyInParent() {
return property;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IASTNode#setPropertyInParent(org.eclipse.cdt.core.dom.ast.ASTNodeProperty)
*/
public void setPropertyInParent(ASTNodeProperty property) {
this.property = property;
}
private final char[] arg;
@ -86,29 +46,15 @@ public class CASTProblem extends CASTNode implements IASTProblem {
this.isError = error;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.parser.IProblem#getID()
*/
public int getID() {
return id;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.parser.IProblem#isError()
*/
public boolean isError() {
return isError;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.parser.IProblem#isWarning()
*/
public boolean isWarning() {
return isWarning;
}
@ -293,29 +239,16 @@ public class CASTProblem extends CASTNode implements IASTProblem {
return message;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.parser.IASTProblem#checkCategory(int)
*/
public boolean checkCategory(int bitmask) {
return ((id & bitmask) != 0);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.parser.IASTProblem#getArguments()
*/
public String getArguments() {
return arg != null ? String.valueOf(arg) : ""; //$NON-NLS-1$
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IASTNode#getTranslationUnit()
*/
public IASTTranslationUnit getTranslationUnit() {
if (this instanceof IASTTranslationUnit)
return (IASTTranslationUnit) this;

View file

@ -12,6 +12,7 @@
package org.eclipse.cdt.internal.core.dom.parser.c;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTProblem;
import org.eclipse.cdt.core.dom.ast.IASTProblemDeclaration;
/**
@ -20,7 +21,15 @@ import org.eclipse.cdt.core.dom.ast.IASTProblemDeclaration;
public class CASTProblemDeclaration extends CASTProblemOwner implements
IASTProblemDeclaration {
public boolean accept( ASTVisitor action ){
public CASTProblemDeclaration() {
super();
}
public CASTProblemDeclaration(IASTProblem problem) {
super(problem);
}
public boolean accept( ASTVisitor action ){
if( action.shouldVisitDeclarations ){
switch( action.visit( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;

View file

@ -12,16 +12,24 @@
package org.eclipse.cdt.internal.core.dom.parser.c;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTProblem;
import org.eclipse.cdt.core.dom.ast.IASTProblemExpression;
import org.eclipse.cdt.core.dom.ast.IType;
/**
* @author jcamelon
*/
public class CASTProblemExpression extends CASTProblemOwner implements
IASTProblemExpression {
public class CASTProblemExpression extends CASTProblemOwner implements IASTProblemExpression {
public boolean accept( ASTVisitor action ){
public CASTProblemExpression() {
super();
}
public CASTProblemExpression(IASTProblem problem) {
super(problem);
}
public boolean accept( ASTVisitor action ){
if( action.shouldVisitExpressions ){
switch( action.visit( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;

View file

@ -11,22 +11,32 @@
package org.eclipse.cdt.internal.core.dom.parser.c;
import org.eclipse.cdt.core.dom.ast.IASTProblem;
import org.eclipse.cdt.core.dom.ast.IASTProblemHolder;
/**
* @author jcamelon
*/
abstract class CASTProblemOwner extends CASTNode {
abstract class CASTProblemOwner extends CASTNode implements IASTProblemHolder {
private IASTProblem problem;
public IASTProblem getProblem()
{
public CASTProblemOwner() {
}
public CASTProblemOwner(IASTProblem problem) {
setProblem(problem);
}
public IASTProblem getProblem() {
return problem;
}
public void setProblem(IASTProblem p)
{
public void setProblem(IASTProblem p) {
problem = p;
if (p != null) {
p.setParent(this);
p.setPropertyInParent(PROBLEM);
}
}
}

View file

@ -12,14 +12,23 @@
package org.eclipse.cdt.internal.core.dom.parser.c;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTProblem;
import org.eclipse.cdt.core.dom.ast.IASTProblemStatement;
/**
* @author jcamelon
*/
public class CASTProblemStatement extends CASTProblemOwner implements
IASTProblemStatement {
public boolean accept( ASTVisitor action ){
public class CASTProblemStatement extends CASTProblemOwner implements IASTProblemStatement {
public CASTProblemStatement() {
}
public CASTProblemStatement(IASTProblem problem) {
super(problem);
}
public boolean accept( ASTVisitor action ){
if( action.shouldVisitStatements ){
switch( action.visit( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;

View file

@ -25,18 +25,24 @@ public class CASTReturnStatement extends CASTNode implements
private IASTExpression retValue;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTReturnStatement#getReturnValue()
*/
public IASTExpression getReturnValue() {
public CASTReturnStatement() {
}
public CASTReturnStatement(IASTExpression retValue) {
setReturnValue(retValue);
}
public IASTExpression getReturnValue() {
return retValue;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTReturnStatement#setReturnValue(org.eclipse.cdt.core.dom.ast.IASTExpression)
*/
public void setReturnValue(IASTExpression returnValue) {
retValue = returnValue;
if (returnValue != null) {
returnValue.setParent(this);
returnValue.setPropertyInParent(RETURNVALUE);
}
}
public boolean accept( ASTVisitor action ){
@ -66,6 +72,4 @@ public class CASTReturnStatement extends CASTNode implements
retValue = (IASTExpression) other;
}
}
}
}

View file

@ -28,86 +28,50 @@ public class CASTSimpleDeclSpecifier extends CASTBaseDeclSpecifier implements IC
private boolean complex=false;
private boolean imaginary=false;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier#getType()
*/
public int getType() {
return simpleType;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier#isSigned()
*/
public boolean isSigned() {
return isSigned;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier#isUnsigned()
*/
public boolean isUnsigned() {
return isUnsigned;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier#isShort()
*/
public boolean isShort() {
return isShort;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier#isLong()
*/
public boolean isLong() {
return isLong;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier#setType(int)
*/
public void setType(int type) {
simpleType = type;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier#setShort(boolean)
*/
public void setShort(boolean value) {
isShort = value;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier#setLong(boolean)
*/
public void setLong(boolean value) {
isLong = value;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier#setUnsigned(boolean)
*/
public void setUnsigned(boolean value) {
isUnsigned = value;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier#setSigned(boolean)
*/
public void setSigned(boolean value) {
isSigned = value;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.c.ICASTSimpleDeclSpecifier#isLongLong()
*/
public boolean isLongLong() {
return longlong;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.c.ICASTSimpleDeclSpecifier#setLongLong(boolean)
*/
public void setLongLong(boolean value) {
longlong = value;
}
@ -130,32 +94,19 @@ public class CASTSimpleDeclSpecifier extends CASTBaseDeclSpecifier implements IC
return true;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.c.ICASTSimpleDeclSpecifier#isComplex()
*/
public boolean isComplex() {
return complex;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.c.ICASTSimpleDeclSpecifier#setComplex(boolean)
*/
public void setComplex(boolean value) {
this.complex = value;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.c.ICASTSimpleDeclSpecifier#isImaginary()
*/
public boolean isImaginary() {
return imaginary;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.c.ICASTSimpleDeclSpecifier#setImaginary(boolean)
*/
public void setImaginary(boolean value) {
this.imaginary = value;
}
}

View file

@ -21,29 +21,30 @@ import org.eclipse.cdt.core.parser.util.ArrayUtil;
/**
* @author jcamelon
*/
public class CASTSimpleDeclaration extends CASTNode implements
IASTSimpleDeclaration {
public class CASTSimpleDeclaration extends CASTNode implements IASTSimpleDeclaration {
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration#getDeclSpecifier()
*/
public IASTDeclSpecifier getDeclSpecifier() {
public CASTSimpleDeclaration() {
}
public CASTSimpleDeclaration(IASTDeclSpecifier declSpecifier) {
setDeclSpecifier(declSpecifier);
}
public IASTDeclSpecifier getDeclSpecifier() {
return declSpecifier;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration#getDeclarators()
*/
public IASTDeclarator[] getDeclarators() {
if( declarators == null ) return IASTDeclarator.EMPTY_DECLARATOR_ARRAY;
declarators = (IASTDeclarator[]) ArrayUtil.removeNullsAfter( IASTDeclarator.class, declarators, declaratorsPos );
return declarators;
}
public void addDeclarator( IASTDeclarator d )
{
public void addDeclarator( IASTDeclarator d ) {
if (d != null) {
d.setParent(this);
d.setPropertyInParent(DECLARATOR);
declarators = (IASTDeclarator[]) ArrayUtil.append( IASTDeclarator.class, declarators, ++declaratorsPos, d );
}
}
@ -53,11 +54,13 @@ public class CASTSimpleDeclaration extends CASTNode implements
private int declaratorsPos=-1;
private IASTDeclSpecifier declSpecifier;
/**
* @param declSpecifier The declSpecifier to set.
*/
public void setDeclSpecifier(IASTDeclSpecifier declSpecifier) {
this.declSpecifier = declSpecifier;
if (declSpecifier != null) {
declSpecifier.setParent(this);
declSpecifier.setPropertyInParent(DECL_SPECIFIER);
}
}
public boolean accept( ASTVisitor action ){
@ -83,5 +86,4 @@ public class CASTSimpleDeclaration extends CASTNode implements
}
return true;
}
}
}

View file

@ -27,32 +27,36 @@ public class CASTSwitchStatement extends CASTNode implements
private IASTExpression controller;
private IASTStatement body;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTSwitchStatement#getController()
*/
public IASTExpression getControllerExpression() {
public CASTSwitchStatement() {
}
public CASTSwitchStatement(IASTExpression controller, IASTStatement body) {
setControllerExpression(controller);
setBody(body);
}
public IASTExpression getControllerExpression() {
return controller;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTSwitchStatement#setController(org.eclipse.cdt.core.dom.ast.IASTExpression)
*/
public void setControllerExpression(IASTExpression controller) {
this.controller = controller;
if (controller != null) {
controller.setParent(this);
controller.setPropertyInParent(CONTROLLER_EXP);
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTSwitchStatement#getBody()
*/
public IASTStatement getBody() {
return body;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTSwitchStatement#setBody(org.eclipse.cdt.core.dom.ast.IASTStatement)
*/
public void setBody(IASTStatement body) {
this.body = body;
if (body != null) {
body.setParent(this);
body.setPropertyInParent(BODY);
}
}
public boolean accept( ASTVisitor action ){

View file

@ -91,6 +91,8 @@ public class CASTTranslationUnit extends CASTNode implements
public void addDeclaration(IASTDeclaration d) {
if (d != null) {
d.setParent(this);
d.setPropertyInParent(OWNED_DECLARATION);
decls = (IASTDeclaration[]) ArrayUtil.append( IASTDeclaration.class, decls, ++declsPos, d );
}
}

View file

@ -24,32 +24,36 @@ public class CASTTypeId extends CASTNode implements IASTTypeId {
private IASTDeclSpecifier declSpecifier;
private IASTDeclarator declarator;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTTypeId#getDeclSpecifier()
*/
public IASTDeclSpecifier getDeclSpecifier() {
public CASTTypeId() {
}
public CASTTypeId(IASTDeclSpecifier declSpecifier, IASTDeclarator declarator) {
setDeclSpecifier(declSpecifier);
setAbstractDeclarator(declarator);
}
public IASTDeclSpecifier getDeclSpecifier() {
return declSpecifier;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTTypeId#setDeclSpecifier(org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier)
*/
public void setDeclSpecifier(IASTDeclSpecifier declSpec) {
this.declSpecifier = declSpec;
if (declSpec != null) {
declSpec.setParent(this);
declSpec.setPropertyInParent(DECL_SPECIFIER);
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTTypeId#getAbstractDeclarator()
*/
public IASTDeclarator getAbstractDeclarator() {
return declarator;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTTypeId#setAbstractDeclarator(org.eclipse.cdt.core.dom.ast.IASTDeclarator)
*/
public void setAbstractDeclarator(IASTDeclarator abstractDeclarator) {
declarator = abstractDeclarator;
if (abstractDeclarator != null) {
abstractDeclarator.setParent(this);
abstractDeclarator.setPropertyInParent(ABSTRACT_DECLARATOR);
}
}

View file

@ -25,7 +25,15 @@ public class CASTTypeIdExpression extends CASTNode implements
private int op;
private IASTTypeId typeId;
public int getOperator() {
public CASTTypeIdExpression() {
}
public CASTTypeIdExpression(int op, IASTTypeId typeId) {
this.op = op;
setTypeId(typeId);
}
public int getOperator() {
return op;
}
@ -35,6 +43,10 @@ public class CASTTypeIdExpression extends CASTNode implements
public void setTypeId(IASTTypeId typeId) {
this.typeId = typeId;
if (typeId != null) {
typeId.setParent(this);
typeId.setPropertyInParent(TYPE_ID);
}
}
public IASTTypeId getTypeId() {
@ -65,5 +77,4 @@ public class CASTTypeIdExpression extends CASTNode implements
public IType getExpressionType() {
return CVisitor.getExpressionType(this);
}
}

View file

@ -23,23 +23,40 @@ import org.eclipse.cdt.core.dom.ast.c.ICASTTypeIdInitializerExpression;
public class CASTTypeIdInitializerExpression extends CASTNode implements
ICASTTypeIdInitializerExpression {
private IASTTypeId t;
private IASTInitializer i;
private IASTTypeId typeId;
private IASTInitializer initializer;
public IASTTypeId getTypeId() {
return t;
public CASTTypeIdInitializerExpression() {
}
public CASTTypeIdInitializerExpression(IASTTypeId t, IASTInitializer i) {
setTypeId(t);
setInitializer(i);
}
public IASTTypeId getTypeId() {
return typeId;
}
public void setTypeId(IASTTypeId typeId) {
t = typeId;
this.typeId = typeId;
if (typeId != null) {
typeId.setParent(this);
typeId.setPropertyInParent(TYPE_ID);
}
}
public IASTInitializer getInitializer() {
return i;
return initializer;
}
public void setInitializer(IASTInitializer initializer) {
i = initializer;
this.initializer = initializer;
if (initializer != null) {
initializer.setParent(this);
initializer.setPropertyInParent(INITIALIZER);
}
}
public boolean accept( ASTVisitor action ){
@ -51,8 +68,8 @@ public class CASTTypeIdInitializerExpression extends CASTNode implements
}
}
if( t != null ) if( !t.accept( action ) ) return false;
if( i != null ) if( !i.accept( action ) ) return false;
if( typeId != null ) if( !typeId.accept( action ) ) return false;
if( initializer != null ) if( !initializer.accept( action ) ) return false;
if( action.shouldVisitExpressions ){
switch( action.leave( this ) ){
@ -67,5 +84,4 @@ public class CASTTypeIdInitializerExpression extends CASTNode implements
public IType getExpressionType() {
return CVisitor.getExpressionType(this);
}
}

View file

@ -31,18 +31,24 @@ public class CASTTypedefNameSpecifier extends CASTBaseDeclSpecifier implements
ICASTTypedefNameSpecifier, IASTCompletionContext {
private IASTName name;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTTypedefNameSpecifier#getName()
*/
public IASTName getName() {
public CASTTypedefNameSpecifier() {
}
public CASTTypedefNameSpecifier(IASTName name) {
setName(name);
}
public IASTName getName() {
return name;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTTypedefNameSpecifier#setName(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public void setName(IASTName name) {
this.name = name;
if (name != null) {
name.setParent(this);
name.setPropertyInParent(NAME);
}
}
public boolean accept( ASTVisitor action ){
@ -64,9 +70,6 @@ public class CASTTypedefNameSpecifier extends CASTBaseDeclSpecifier implements
return true;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public int getRoleForName(IASTName n) {
if( n == name ) return r_reference;
return r_unclear;

View file

@ -27,7 +27,16 @@ public class CASTUnaryExpression extends CASTNode implements
private int operator;
private IASTExpression operand;
public int getOperator() {
public CASTUnaryExpression() {
}
public CASTUnaryExpression(int operator, IASTExpression operand) {
this.operator = operator;
setOperand(operand);
}
public int getOperator() {
return operator;
}
@ -41,6 +50,10 @@ public class CASTUnaryExpression extends CASTNode implements
public void setOperand(IASTExpression expression) {
operand = expression;
if (expression != null) {
expression.setParent(this);
expression.setPropertyInParent(OPERAND);
}
}
public boolean accept( ASTVisitor action ){

View file

@ -26,32 +26,37 @@ public class CASTWhileStatement extends CASTNode implements IASTWhileStatement,
private IASTExpression condition;
private IASTStatement body;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTWhileStatement#getCondition()
*/
public IASTExpression getCondition() {
public CASTWhileStatement() {
}
public CASTWhileStatement(IASTExpression condition, IASTStatement body) {
setCondition(condition);
setBody(body);
}
public IASTExpression getCondition() {
return condition;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTWhileStatement#setCondition(org.eclipse.cdt.core.dom.ast.IASTExpression)
*/
public void setCondition(IASTExpression condition) {
this.condition = condition;
if (condition != null) {
condition.setParent(this);
condition.setPropertyInParent(CONDITIONEXPRESSION);
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTWhileStatement#getBody()
*/
public IASTStatement getBody() {
return body;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTWhileStatement#setBody(org.eclipse.cdt.core.dom.ast.IASTStatement)
*/
public void setBody(IASTStatement body) {
this.body = body;
if (body != null) {
body.setParent(this);
body.setPropertyInParent(BODY);
}
}
public boolean accept( ASTVisitor action ){

View file

@ -23,28 +23,25 @@ import org.eclipse.cdt.core.dom.ast.gnu.c.IGCCASTSimpleDeclSpecifier;
* @author aniefer
*
*/
public class GCCASTSimpleDeclSpecifier extends CASTSimpleDeclSpecifier
implements IGCCASTSimpleDeclSpecifier {
public class GCCASTSimpleDeclSpecifier extends CASTSimpleDeclSpecifier implements IGCCASTSimpleDeclSpecifier {
private IASTExpression typeOfExpression;
/**
*
*/
public GCCASTSimpleDeclSpecifier() {
super();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.gnu.c.IGCCASTSimpleDeclSpecifier#setTypeofExpression(org.eclipse.cdt.core.dom.ast.IASTExpression)
*/
public GCCASTSimpleDeclSpecifier(IASTExpression typeofExpression) {
setTypeofExpression(typeofExpression);
}
public void setTypeofExpression(IASTExpression typeofExpression) {
this.typeOfExpression = typeofExpression;
if (typeofExpression != null) {
typeofExpression.setParent(this);
typeofExpression.setPropertyInParent(TYPEOF_EXPRESSION);
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.gnu.c.IGCCASTSimpleDeclSpecifier#getTypeofExpression()
*/
public IASTExpression getTypeofExpression() {
return typeOfExpression;
}

View file

@ -16,20 +16,22 @@ import org.eclipse.cdt.core.dom.ast.IASTASMDeclaration;
/**
* @author jcamelon
*/
public class CPPASTASMDeclaration extends CPPASTNode implements
IASTASMDeclaration {
public class CPPASTASMDeclaration extends CPPASTNode implements IASTASMDeclaration {
char [] assembly = null;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTASMDeclaration#getAssembly()
*/
public String getAssembly() {
if( assembly == null ) return ""; //$NON-NLS-1$
public CPPASTASMDeclaration() {
}
public CPPASTASMDeclaration(String assembly) {
setAssembly(assembly);
}
public String getAssembly() {
if( assembly == null )
return ""; //$NON-NLS-1$
return new String( assembly );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTASMDeclaration#setAssembly(java.lang.String)
*/
public void setAssembly(String assembly) {
this.assembly = assembly.toCharArray();
}

View file

@ -15,8 +15,7 @@ import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguousDeclaration;
public class CPPASTAmbiguousDeclaration extends CPPASTAmbiguity implements
IASTAmbiguousDeclaration {
public class CPPASTAmbiguousDeclaration extends CPPASTAmbiguity implements IASTAmbiguousDeclaration {
protected IASTNode[] getNodes() {
return getDeclarations();
@ -28,6 +27,8 @@ public class CPPASTAmbiguousDeclaration extends CPPASTAmbiguity implements
public void addDeclaration(IASTDeclaration d) {
if (d != null) {
decls = (IASTDeclaration[]) ArrayUtil.append(IASTDeclaration.class, decls, ++declsPos, d );
d.setParent(this);
d.setPropertyInParent(SUBDECLARATION);
}
}

View file

@ -24,7 +24,9 @@ public class CPPASTAmbiguousExpression extends CPPASTAmbiguity implements
public void addExpression(IASTExpression e) {
if (e != null) {
exp = (IASTExpression[]) ArrayUtil.append( IASTExpression.class, exp, ++expPos, e );
exp = (IASTExpression[]) ArrayUtil.append( IASTExpression.class, exp, ++expPos, e );
e.setParent(this);
e.setPropertyInParent(SUBEXPRESSION);
}
}

View file

@ -24,6 +24,8 @@ public class CPPASTAmbiguousStatement extends CPPASTAmbiguity implements
public void addStatement(IASTStatement s) {
if (s != null) {
stmts = (IASTStatement[]) ArrayUtil.append( IASTStatement.class, stmts, ++stmtsPos, s );
s.setParent(this);
s.setPropertyInParent(STATEMENT);
}
}

View file

@ -34,6 +34,8 @@ public class CPPASTArrayDeclarator extends CPPASTDeclarator implements
public void addArrayModifier(IASTArrayModifier arrayModifier) {
if (arrayModifier != null) {
arrayMods = (IASTArrayModifier[]) ArrayUtil.append( IASTArrayModifier.class, arrayMods, ++arrayModsPos, arrayModifier );
arrayModifier.setParent(this);
arrayModifier.setPropertyInParent(ARRAY_MODIFIER);
}
}

View file

@ -19,27 +19,27 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
/**
* @author jcamelon
*/
public class CPPASTArrayModifier extends CPPASTNode implements
IASTArrayModifier, IASTAmbiguityParent {
public class CPPASTArrayModifier extends CPPASTNode implements IASTArrayModifier, IASTAmbiguityParent {
private IASTExpression exp;
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IASTArrayModifier#getConstantExpression()
*/
public IASTExpression getConstantExpression() {
public CPPASTArrayModifier() {
}
public CPPASTArrayModifier(IASTExpression exp) {
setConstantExpression(exp);
}
public IASTExpression getConstantExpression() {
return exp;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IASTArrayModifier#setConstantExpression(org.eclipse.cdt.core.dom.ast.IASTExpression)
*/
public void setConstantExpression(IASTExpression expression) {
exp = expression;
if (expression != null) {
expression.setParent(this);
expression.setPropertyInParent(CONSTANT_EXPRESSION);
}
}
public boolean accept(ASTVisitor action) {

View file

@ -20,18 +20,30 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
/**
* @author jcamelon
*/
public class CPPASTArraySubscriptExpression extends CPPASTNode implements
IASTArraySubscriptExpression, IASTAmbiguityParent {
public class CPPASTArraySubscriptExpression extends CPPASTNode implements IASTArraySubscriptExpression, IASTAmbiguityParent {
private IASTExpression subscriptExp;
private IASTExpression arrayExpression;
public IASTExpression getArrayExpression() {
public CPPASTArraySubscriptExpression() {
}
public CPPASTArraySubscriptExpression(IASTExpression arrayExpression, IASTExpression subscriptExp) {
setArrayExpression(arrayExpression);
setSubscriptExpression(subscriptExp);
}
public IASTExpression getArrayExpression() {
return arrayExpression;
}
public void setArrayExpression(IASTExpression expression) {
arrayExpression = expression;
if (expression != null) {
expression.setParent(this);
expression.setPropertyInParent(ARRAY);
}
}
public IASTExpression getSubscriptExpression() {
@ -40,6 +52,10 @@ public class CPPASTArraySubscriptExpression extends CPPASTNode implements
public void setSubscriptExpression(IASTExpression expression) {
subscriptExp = expression;
if (expression != null) {
expression.setParent(this);
expression.setPropertyInParent(SUBSCRIPT);
}
}
public boolean accept( ASTVisitor action ){

View file

@ -15,8 +15,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier;
/**
* @author jcamelon
*/
public abstract class CPPASTBaseDeclSpecifier extends CPPASTNode implements
ICPPASTDeclSpecifier {
public abstract class CPPASTBaseDeclSpecifier extends CPPASTNode implements ICPPASTDeclSpecifier {
private boolean friend;
private boolean inline;
@ -26,100 +25,58 @@ public abstract class CPPASTBaseDeclSpecifier extends CPPASTNode implements
private boolean virtual;
private boolean explicit;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier#isFriend()
*/
public boolean isFriend() {
return friend;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier#getStorageClass()
*/
public int getStorageClass() {
return sc;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier#setStorageClass(int)
*/
public void setStorageClass(int storageClass) {
sc = storageClass;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier#isConst()
*/
public boolean isConst() {
return isConst;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier#setConst(boolean)
*/
public void setConst(boolean value) {
isConst = value;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier#isVolatile()
*/
public boolean isVolatile() {
return volatil;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier#setVolatile(boolean)
*/
public void setVolatile(boolean value) {
volatil = value;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier#isInline()
*/
public boolean isInline() {
return inline;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier#setInline(boolean)
*/
public void setInline(boolean value) {
this.inline = value;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier#setIsFriend(boolean)
*/
public void setFriend(boolean value) {
friend = value;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier#isVirtual()
*/
public boolean isVirtual() {
return virtual;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier#setVirtual(boolean)
*/
public void setVirtual(boolean value) {
virtual = value;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier#isExplicit()
*/
public boolean isExplicit() {
return explicit;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier#setExplicit(boolean)
*/
public void setExplicit(boolean value) {
this.explicit = value;
}

View file

@ -33,46 +33,32 @@ public class CPPASTBaseSpecifier extends CPPASTNode implements
private int visibility;
private IASTName name;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier#isVirtual()
*/
public boolean isVirtual() {
return isVirtual;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier#setVirtual(boolean)
*/
public void setVirtual(boolean value) {
isVirtual = value;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier#getVisibility()
*/
public int getVisibility() {
return visibility;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier#setVisibility(int)
*/
public void setVisibility(int visibility) {
this.visibility = visibility;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier#getName()
*/
public IASTName getName() {
return name;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier#setName(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public void setName(IASTName name) {
this.name = name;
if (name != null) {
name.setParent(this);
name.setPropertyInParent(NAME);
}
}
public boolean accept( ASTVisitor action ){
@ -98,9 +84,6 @@ public class CPPASTBaseSpecifier extends CPPASTNode implements
return true;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public int getRoleForName(IASTName n) {
if( name == n ) return r_reference;
return r_unclear;

View file

@ -27,7 +27,16 @@ public class CPPASTBinaryExpression extends CPPASTNode implements
private IASTExpression operand1;
private IASTExpression operand2;
public int getOperator() {
public CPPASTBinaryExpression() {
}
public CPPASTBinaryExpression(int op, IASTExpression operand1, IASTExpression operand2) {
this.op = op;
setOperand1(operand1);
setOperand2(operand2);
}
public int getOperator() {
return op;
}
@ -45,10 +54,18 @@ public class CPPASTBinaryExpression extends CPPASTNode implements
public void setOperand1(IASTExpression expression) {
operand1 = expression;
if (expression != null) {
expression.setParent(this);
expression.setPropertyInParent(OPERAND_ONE);
}
}
public void setOperand2(IASTExpression expression) {
operand2 = expression;
if (expression != null) {
expression.setParent(this);
expression.setPropertyInParent(OPERAND_TWO);
}
}
public boolean accept( ASTVisitor action ){

View file

@ -19,22 +19,27 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
/**
* @author jcamelon
*/
public class CPPASTCaseStatement extends CPPASTNode implements
IASTCaseStatement, IASTAmbiguityParent {
private IASTExpression expression;
public class CPPASTCaseStatement extends CPPASTNode implements IASTCaseStatement, IASTAmbiguityParent {
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTCaseStatement#getExpression()
*/
public IASTExpression getExpression() {
private IASTExpression expression;
public CPPASTCaseStatement() {
}
public CPPASTCaseStatement(IASTExpression expression) {
setExpression(expression);
}
public IASTExpression getExpression() {
return expression;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTCaseStatement#setExpression(org.eclipse.cdt.core.dom.ast.IASTExpression)
*/
public void setExpression(IASTExpression expression) {
this.expression = expression;
if (expression != null) {
expression.setParent(this);
expression.setPropertyInParent(EXPRESSION);
}
}
public boolean accept( ASTVisitor action ){

View file

@ -18,23 +18,39 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCastExpression;
/**
* @author jcamelon
*/
public class CPPASTCastExpression extends CPPASTUnaryExpression implements
ICPPASTCastExpression {
private IASTTypeId typeId;
public class CPPASTCastExpression extends CPPASTUnaryExpression implements ICPPASTCastExpression {
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTUnaryTypeIdExpression#setTypeId(org.eclipse.cdt.core.dom.ast.IASTTypeId)
*/
public void setTypeId(IASTTypeId typeId) {
private IASTTypeId typeId;
public CPPASTCastExpression() {
}
public CPPASTCastExpression(IASTTypeId typeId) {
setTypeId(typeId);
}
public void setTypeId(IASTTypeId typeId) {
this.typeId = typeId;
if (typeId != null) {
typeId.setParent(this);
typeId.setPropertyInParent(TYPE_ID);
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTUnaryTypeIdExpression#getTypeId()
*/
public IASTTypeId getTypeId() {
return typeId;
}
public void setOperand(IASTExpression expression) {
super.setOperand(expression);
// this needs to be overridden because CPPASTUnaryExpression sets
// propertyInParent to ICPPASTUnaryExpression.OPERAND, we want
// ICPPASTCastExpression.OPERAND
if (expression != null) {
expression.setParent(this);
expression.setPropertyInParent(ICPPASTCastExpression.OPERAND);
}
}
public boolean accept( ASTVisitor action ){
if( action.shouldVisitExpressions ){

View file

@ -20,51 +20,49 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
/**
* @author jcamelon
*/
public class CPPASTCatchHandler extends CPPASTNode implements
ICPPASTCatchHandler, IASTAmbiguityParent {
public class CPPASTCatchHandler extends CPPASTNode implements ICPPASTCatchHandler, IASTAmbiguityParent {
private boolean isCatchAll;
private IASTStatement body;
private IASTDeclaration declaration;
public CPPASTCatchHandler() {
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCatchHandler#setIsCatchAll(boolean)
*/
public void setIsCatchAll(boolean isEllipsis) {
public CPPASTCatchHandler(boolean isCatchAll, IASTStatement body, IASTDeclaration declaration) {
this.isCatchAll = isCatchAll;
setCatchBody(body);
setDeclaration(declaration);
}
public void setIsCatchAll(boolean isEllipsis) {
isCatchAll = isEllipsis;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCatchHandler#isCatchAll()
*/
public boolean isCatchAll() {
return isCatchAll;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCatchHandler#setCatchBody(org.eclipse.cdt.core.dom.ast.IASTStatement)
*/
public void setCatchBody(IASTStatement compoundStatement) {
body = compoundStatement;
if (compoundStatement != null) {
compoundStatement.setParent(this);
compoundStatement.setPropertyInParent(CATCH_BODY);
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCatchHandler#getCatchBody()
*/
public IASTStatement getCatchBody() {
return body;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCatchHandler#setDeclaration(org.eclipse.cdt.core.dom.ast.IASTDeclaration)
*/
public void setDeclaration(IASTDeclaration decl) {
declaration = decl;
if (decl != null) {
decl.setParent(this);
decl.setPropertyInParent(DECLARATION);
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCatchHandler#getDeclaration()
*/
public IASTDeclaration getDeclaration() {
return declaration;
}

View file

@ -29,73 +29,65 @@ public class CPPASTCompositeTypeSpecifier extends CPPASTBaseDeclSpecifier
private IASTName n;
private IScope scope;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier#getRawSignature()
*/
public String getRawSignature() {
public CPPASTCompositeTypeSpecifier() {
}
public CPPASTCompositeTypeSpecifier(int k, IASTName n) {
this.k = k;
setName(n);
}
public String getRawSignature() {
return getName().toString() == null ? "" : getName().toString(); //$NON-NLS-1$
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier#getBaseSpecifiers()
*/
public ICPPASTBaseSpecifier[] getBaseSpecifiers() {
if( baseSpecs == null ) return ICPPASTBaseSpecifier.EMPTY_BASESPECIFIER_ARRAY;
baseSpecs = (ICPPASTBaseSpecifier[]) ArrayUtil.removeNullsAfter( ICPPASTBaseSpecifier.class, baseSpecs, baseSpecsPos );
return baseSpecs;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier#addBaseSpecifier(org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier)
*/
public void addBaseSpecifier(ICPPASTBaseSpecifier baseSpec) {
if (baseSpec != null) {
baseSpec.setParent(this);
baseSpec.setPropertyInParent(BASE_SPECIFIER);
baseSpecs = (ICPPASTBaseSpecifier[]) ArrayUtil.append( ICPPASTBaseSpecifier.class, baseSpecs, ++baseSpecsPos, baseSpec );
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier#getKey()
*/
public int getKey() {
return k;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier#setKey(int)
*/
public void setKey(int key) {
k = key;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier#getName()
*/
public IASTName getName() {
return n;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier#setName(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public void setName(IASTName name) {
this.n = name;
if (name != null) {
name.setParent(this);
name.setPropertyInParent(TYPE_NAME);
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier#getMembers()
*/
public IASTDeclaration[] getMembers() {
if( declarations == null ) return IASTDeclaration.EMPTY_DECLARATION_ARRAY;
return (IASTDeclaration[]) ArrayUtil.trim( IASTDeclaration.class, declarations );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier#addMemberDeclaration(org.eclipse.cdt.core.dom.ast.IASTDeclaration)
*/
public void addMemberDeclaration(IASTDeclaration declaration) {
declarations = (IASTDeclaration[]) ArrayUtil.append( IASTDeclaration.class, declarations, declaration );
if(declaration != null) {
declaration.setParent(this);
declaration.setPropertyInParent(MEMBER_DECLARATION);
}
}
@ -103,9 +95,6 @@ public class CPPASTCompositeTypeSpecifier extends CPPASTBaseDeclSpecifier
private ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier [] baseSpecs = null;
private int baseSpecsPos=-1;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier#getScope()
*/
public IScope getScope() {
if( scope == null )
scope = new CPPClassScope( this );
@ -144,9 +133,6 @@ public class CPPASTCompositeTypeSpecifier extends CPPASTBaseDeclSpecifier
return true;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public int getRoleForName(IASTName name) {
if( name == this.n )
return r_definition;

View file

@ -29,24 +29,19 @@ public class CPPASTCompoundStatement extends CPPASTNode implements
private ICPPScope scope = null;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTCompoundStatement#getStatements()
*/
public IASTStatement[] getStatements() {
if( statements == null ) return IASTStatement.EMPTY_STATEMENT_ARRAY;
return (IASTStatement[]) ArrayUtil.trim( IASTStatement.class, statements );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTCompoundStatement#addStatement(org.eclipse.cdt.core.dom.ast.IASTStatement)
*/
public void addStatement(IASTStatement statement) {
statements = (IASTStatement[]) ArrayUtil.append( IASTStatement.class, statements, statement );
if (statement != null) {
statement.setParent(this);
statement.setPropertyInParent(NESTED_STATEMENT);
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTCompoundStatement#resolveScope()
*/
public IScope getScope() {
if( scope == null )
scope = new CPPBlockScope( this );

View file

@ -18,16 +18,28 @@ import org.eclipse.cdt.core.dom.ast.gnu.IGNUASTCompoundStatementExpression;
/**
* @author jcamelon
*/
public class CPPASTCompoundStatementExpression extends CPPASTNode implements
IGNUASTCompoundStatementExpression {
public class CPPASTCompoundStatementExpression extends CPPASTNode implements IGNUASTCompoundStatementExpression {
private IASTCompoundStatement statement;
public IASTCompoundStatement getCompoundStatement() {
public CPPASTCompoundStatementExpression() {
}
public CPPASTCompoundStatementExpression(IASTCompoundStatement statement) {
setCompoundStatement(statement);
}
public IASTCompoundStatement getCompoundStatement() {
return statement;
}
public void setCompoundStatement(IASTCompoundStatement statement) {
this.statement = statement;
if (statement != null) {
statement.setParent(this);
statement.setPropertyInParent(STATEMENT);
}
}
public boolean accept( ASTVisitor action ){

View file

@ -22,16 +22,31 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
*/
public class CPPASTConditionalExpression extends CPPASTNode implements
IASTConditionalExpression, IASTAmbiguityParent {
private IASTExpression condition;
private IASTExpression negative;
private IASTExpression postive;
public IASTExpression getLogicalConditionExpression() {
public CPPASTConditionalExpression() {
}
public CPPASTConditionalExpression(IASTExpression condition, IASTExpression postive, IASTExpression negative) {
setLogicalConditionExpression(condition);
setPositiveResultExpression(postive);
setNegativeResultExpression(negative);
}
public IASTExpression getLogicalConditionExpression() {
return condition;
}
public void setLogicalConditionExpression(IASTExpression expression) {
condition = expression;
if (expression != null) {
expression.setParent(this);
expression.setPropertyInParent(LOGICAL_CONDITION);
}
}
public IASTExpression getPositiveResultExpression() {
@ -40,6 +55,10 @@ public class CPPASTConditionalExpression extends CPPASTNode implements
public void setPositiveResultExpression(IASTExpression expression) {
this.postive = expression;
if (expression != null) {
expression.setParent(this);
expression.setPropertyInParent(POSITIVE_RESULT);
}
}
public IASTExpression getNegativeResultExpression() {
@ -48,6 +67,10 @@ public class CPPASTConditionalExpression extends CPPASTNode implements
public void setNegativeResultExpression(IASTExpression expression) {
this.negative = expression;
if (expression != null) {
expression.setParent(this);
expression.setPropertyInParent(NEGATIVE_RESULT);
}
}
public boolean accept( ASTVisitor action ){

View file

@ -24,43 +24,40 @@ public class CPPASTConstructorChainInitializer extends CPPASTNode implements
ICPPASTConstructorChainInitializer, IASTAmbiguityParent {
private IASTName name;
private IASTExpression value;
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer#getMemberInitializerId()
*/
public IASTName getMemberInitializerId() {
public CPPASTConstructorChainInitializer() {
}
public CPPASTConstructorChainInitializer(IASTName name, IASTExpression value) {
setMemberInitializerId(name);
setInitializerValue(value);
}
public IASTName getMemberInitializerId() {
return name;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer#setMemberInitializerId(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public void setMemberInitializerId(IASTName name) {
this.name = name;
if(name != null) {
name.setParent(this);
name.setPropertyInParent(MEMBER_ID);
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer#getInitializerValue()
*/
public IASTExpression getInitializerValue() {
return value;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer#setInitializerValue(org.eclipse.cdt.core.dom.ast.IASTExpression)
*/
public void setInitializerValue(IASTExpression expression) {
value = expression;
if(expression != null) {
expression.setParent(this);
expression.setPropertyInParent(INITIALIZER);
}
}
public boolean accept(ASTVisitor action) {
@ -73,11 +70,6 @@ public class CPPASTConstructorChainInitializer extends CPPASTNode implements
return true;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public int getRoleForName(IASTName n) {
if (name == n)
return r_reference;

View file

@ -24,18 +24,24 @@ public class CPPASTConstructorInitializer extends CPPASTNode implements
private IASTExpression exp;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorInitializer#getExpression()
*/
public IASTExpression getExpression() {
public CPPASTConstructorInitializer() {
}
public CPPASTConstructorInitializer(IASTExpression exp) {
setExpression(exp);
}
public IASTExpression getExpression() {
return exp;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorInitializer#setExpression(org.eclipse.cdt.core.dom.ast.IASTExpression)
*/
public void setExpression(IASTExpression expression) {
this.exp = expression;
if (expression != null) {
expression.setParent(this);
expression.setPropertyInParent(EXPRESSION);
}
}
public boolean accept( ASTVisitor action ){

View file

@ -21,22 +21,31 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConversionName;
* @author dsteffle
*/
public class CPPASTConversionName extends CPPASTName implements ICPPASTConversionName {
private IASTTypeId typeId=null;
private IASTTypeId typeId = null;
public CPPASTConversionName() {
super();
}
public CPPASTConversionName(char[] name) {
super(name);
}
public CPPASTConversionName(char[] name, IASTTypeId typeId) {
super(name);
setTypeId(typeId);
}
public IASTTypeId getTypeId() {
return typeId;
}
public void setTypeId(IASTTypeId typeId) {
this.typeId=typeId;
if (typeId != null) {
typeId.setParent(this);
typeId.setPropertyInParent(TYPE_ID);
}
}
public boolean accept(ASTVisitor action) {

View file

@ -24,18 +24,24 @@ public class CPPASTDeclarationStatement extends CPPASTNode implements
private IASTDeclaration declaration;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarationStatement#getDeclaration()
*/
public IASTDeclaration getDeclaration() {
public CPPASTDeclarationStatement() {
}
public CPPASTDeclarationStatement(IASTDeclaration declaration) {
setDeclaration(declaration);
}
public IASTDeclaration getDeclaration() {
return declaration;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarationStatement#setDeclaration(org.eclipse.cdt.core.dom.ast.IASTDeclaration)
*/
public void setDeclaration(IASTDeclaration declaration) {
this.declaration = declaration;
if (declaration != null) {
declaration.setParent(this);
declaration.setPropertyInParent(DECLARATION);
}
}
public boolean accept( ASTVisitor action ){

View file

@ -35,65 +35,68 @@ public class CPPASTDeclarator extends CPPASTNode implements IASTDeclarator {
private IASTPointerOperator [] pointerOps = null;
private int pointerOpsPos=-1;
public CPPASTDeclarator() {
}
public CPPASTDeclarator(IASTName name) {
setName(name);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarator#getPointerOperators()
*/
public IASTPointerOperator[] getPointerOperators() {
public CPPASTDeclarator(IASTName name, IASTInitializer initializer) {
this(name);
setInitializer(initializer);
}
public IASTPointerOperator[] getPointerOperators() {
if( pointerOps == null ) return IASTPointerOperator.EMPTY_ARRAY;
pointerOps = (IASTPointerOperator[]) ArrayUtil.removeNullsAfter( IASTPointerOperator.class, pointerOps, pointerOpsPos );
return pointerOps;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarator#getNestedDeclarator()
*/
public IASTDeclarator getNestedDeclarator() {
return nestedDeclarator;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarator#getName()
*/
public IASTName getName() {
return name;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarator#getInitializer()
*/
public IASTInitializer getInitializer() {
return initializer;
}
/**
* @param initializer
*/
public void setInitializer(IASTInitializer initializer) {
this.initializer = initializer;
if (initializer != null) {
initializer.setParent(this);
initializer.setPropertyInParent(INITIALIZER);
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarator#addPointerOperator(org.eclipse.cdt.core.dom.ast.IASTPointerOperator)
*/
public void addPointerOperator(IASTPointerOperator operator) {
if (operator != null) {
operator.setParent(this);
operator.setPropertyInParent(POINTER_OPERATOR);
pointerOps = (IASTPointerOperator[]) ArrayUtil.append( IASTPointerOperator.class, pointerOps, ++pointerOpsPos, operator );
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarator#setNestedDeclarator(org.eclipse.cdt.core.dom.ast.IASTDeclarator)
*/
public void setNestedDeclarator(IASTDeclarator nested) {
this.nestedDeclarator = nested;
if (nested != null) {
nested.setParent(this);
nested.setPropertyInParent(NESTED_DECLARATOR);
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarator#setName(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public void setName(IASTName name) {
this.name = name;
if (name != null) {
name.setParent(this);
name.setPropertyInParent(DECLARATOR_NAME);
}
}
public boolean accept( ASTVisitor action ){
@ -144,9 +147,6 @@ public class CPPASTDeclarator extends CPPASTNode implements IASTDeclarator {
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public int getRoleForName(IASTName n) {
IASTNode getParent = getParent();
boolean fnDtor = ( this instanceof IASTFunctionDeclarator );

View file

@ -16,8 +16,8 @@ import org.eclipse.cdt.core.dom.ast.IASTDefaultStatement;
/**
* @author jcamelon
*/
public class CPPASTDefaultStatement extends CPPASTNode implements
IASTDefaultStatement {
public class CPPASTDefaultStatement extends CPPASTNode implements IASTDefaultStatement {
public boolean accept( ASTVisitor action ){
if( action.shouldVisitStatements ){
switch( action.visit( this ) ){

View file

@ -25,12 +25,26 @@ public class CPPASTDeleteExpression extends CPPASTNode implements
private boolean isGlobal;
private boolean isVectored;
public IASTExpression getOperand() {
public CPPASTDeleteExpression() {
}
public CPPASTDeleteExpression(IASTExpression operand) {
setOperand(operand);
}
public IASTExpression getOperand() {
return operand;
}
public void setOperand(IASTExpression expression) {
operand = expression;
if (expression != null) {
expression.setParent(this);
expression.setPropertyInParent(OPERAND);
}
}
public void setIsGlobal(boolean global) {

View file

@ -21,35 +21,41 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
* @author jcamelon
*/
public class CPPASTDoStatement extends CPPASTNode implements IASTDoStatement, IASTAmbiguityParent {
private IASTStatement body;
private IASTStatement body;
private IASTExpression condition;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTDoStatement#getBody()
*/
public IASTStatement getBody() {
public CPPASTDoStatement() {
}
public CPPASTDoStatement(IASTStatement body, IASTExpression condition) {
setBody(body);
setCondition(condition);
}
public IASTStatement getBody() {
return body;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTDoStatement#setBody(org.eclipse.cdt.core.dom.ast.IASTStatement)
*/
public void setBody(IASTStatement body) {
this.body = body;
if (body != null) {
body.setParent(this);
body.setPropertyInParent(BODY);
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTDoStatement#getCondition()
*/
public IASTExpression getCondition() {
return condition;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTDoStatement#setCondition(org.eclipse.cdt.core.dom.ast.IASTExpression)
*/
public void setCondition(IASTExpression condition) {
this.condition = condition;
if (condition != null) {
condition.setParent(this);
condition.setPropertyInParent(CONDITION);
}
}
public boolean accept( ASTVisitor action ){

View file

@ -29,32 +29,33 @@ public class CPPASTElaboratedTypeSpecifier extends CPPASTBaseDeclSpecifier
private int kind;
private IASTName name;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier#getKind()
*/
public int getKind() {
public CPPASTElaboratedTypeSpecifier() {
}
public CPPASTElaboratedTypeSpecifier(int kind, IASTName name) {
this.kind = kind;
setName(name);
}
public int getKind() {
return kind;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier#setKind(int)
*/
public void setKind(int value) {
this.kind = value;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier#getName()
*/
public IASTName getName() {
return name;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier#setName(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public void setName(IASTName name) {
this.name = name;
if (name != null) {
name.setParent(this);
name.setPropertyInParent(TYPE_NAME);
}
}
public boolean accept( ASTVisitor action ){
@ -76,9 +77,6 @@ public class CPPASTElaboratedTypeSpecifier extends CPPASTBaseDeclSpecifier
return true;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public int getRoleForName(IASTName n) {
if( n != name ) return r_unclear;

View file

@ -24,22 +24,22 @@ public class CPPASTEnumerationSpecifier extends CPPASTBaseDeclSpecifier
private IASTName name;
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier#addEnumerator(org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator)
*/
public CPPASTEnumerationSpecifier() {
}
public CPPASTEnumerationSpecifier(IASTName name) {
setName(name);
}
public void addEnumerator(IASTEnumerator enumerator) {
if (enumerator != null) {
enumerator.setParent(this);
enumerator.setPropertyInParent(ENUMERATOR);
enumerators = (IASTEnumerator[]) ArrayUtil.append( IASTEnumerator.class, enumerators, ++enumeratorsPos, enumerator );
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier#getEnumerators()
*/
public IASTEnumerator[] getEnumerators() {
if (enumerators == null)
return IASTEnumerator.EMPTY_ENUMERATOR_ARRAY;
@ -51,29 +51,18 @@ public class CPPASTEnumerationSpecifier extends CPPASTBaseDeclSpecifier
private IASTEnumerator[] enumerators = null;
private int enumeratorsPos=-1;
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier#setName(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public void setName(IASTName name) {
this.name = name;
if (name != null) {
name.setParent(this);
name.setPropertyInParent(ENUMERATION_NAME);
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier#getName()
*/
public IASTName getName() {
return name;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier#getRawSignature()
*/
public String getRawSignature() {
return getName().toString() == null ? "" : getName().toString(); //$NON-NLS-1$
}
@ -108,11 +97,6 @@ public class CPPASTEnumerationSpecifier extends CPPASTBaseDeclSpecifier
return true;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public int getRoleForName(IASTName n) {
if (name == n)
return r_definition;

View file

@ -21,33 +21,39 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
* @author jcamelon
*/
public class CPPASTEnumerator extends CPPASTNode implements IASTEnumerator, IASTAmbiguityParent {
private IASTName name;
private IASTName name;
private IASTExpression value;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator#setName(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public void setName(IASTName name) {
public CPPASTEnumerator() {
}
public CPPASTEnumerator(IASTName name, IASTExpression value) {
setName(name);
setValue(value);
}
public void setName(IASTName name) {
this.name = name;
if (name != null) {
name.setParent(this);
name.setPropertyInParent(ENUMERATOR_NAME);
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator#getName()
*/
public IASTName getName() {
return name;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator#setValue(org.eclipse.cdt.core.dom.ast.IASTExpression)
*/
public void setValue(IASTExpression expression) {
this.value = expression;
if (expression != null) {
expression.setParent(this);
expression.setPropertyInParent(ENUMERATOR_VALUE);
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator#getValue()
*/
public IASTExpression getValue() {
return value;
}
@ -73,9 +79,6 @@ public class CPPASTEnumerator extends CPPASTNode implements IASTEnumerator, IAST
return true;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTNameOwner#getRoleForName(org.eclipse.cdt.core.dom.ast.IASTName)
*/
public int getRoleForName(IASTName n) {
if( name == n )
return r_definition;
@ -83,8 +86,7 @@ public class CPPASTEnumerator extends CPPASTNode implements IASTEnumerator, IAST
}
public void replace(IASTNode child, IASTNode other) {
if( child == value )
{
if( child == value ) {
other.setPropertyInParent( child.getPropertyInParent() );
other.setParent( child.getParent() );
value = (IASTExpression) other;

View file

@ -24,18 +24,24 @@ public class CPPASTExplicitTemplateInstantiation extends CPPASTNode implements
private IASTDeclaration declaration;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExplicitTemplateInstantiation#getDeclaration()
*/
public IASTDeclaration getDeclaration() {
public CPPASTExplicitTemplateInstantiation() {
}
public CPPASTExplicitTemplateInstantiation(IASTDeclaration declaration) {
setDeclaration(declaration);
}
public IASTDeclaration getDeclaration() {
return declaration;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExplicitTemplateInstantiation#setDeclaration(org.eclipse.cdt.core.dom.ast.IASTDeclaration)
*/
public void setDeclaration(IASTDeclaration declaration) {
this.declaration = declaration;
if (declaration != null) {
declaration.setParent(this);
declaration.setPropertyInParent(OWNED_DECLARATION);
}
}
public boolean accept( ASTVisitor action ){

View file

@ -31,6 +31,10 @@ public class CPPASTExpressionList extends CPPASTNode implements
public void addExpression(IASTExpression expression) {
expressions = (IASTExpression [])ArrayUtil.append( IASTExpression.class, expressions, expression );
if (expression != null) {
expression.setParent(this);
expression.setPropertyInParent(NESTED_EXPRESSION);
}
}
private IASTExpression [] expressions = new IASTExpression[2];

View file

@ -21,20 +21,27 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
*/
public class CPPASTExpressionStatement extends CPPASTNode implements
IASTExpressionStatement, IASTAmbiguityParent {
private IASTExpression expression;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTExpressionStatement#getExpression()
*/
public IASTExpression getExpression() {
public CPPASTExpressionStatement() {
}
public CPPASTExpressionStatement(IASTExpression expression) {
setExpression(expression);
}
public IASTExpression getExpression() {
return expression;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTExpressionStatement#setExpression(org.eclipse.cdt.core.dom.ast.IASTExpression)
*/
public void setExpression(IASTExpression expression) {
this.expression = expression;
if (expression != null) {
expression.setParent(this);
expression.setPropertyInParent(EXPRESSION);
}
}
public boolean accept( ASTVisitor action ){

View file

@ -25,18 +25,24 @@ public class CPPASTFieldDeclarator extends CPPASTDeclarator implements
private IASTExpression bitField;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTFieldDeclarator#getBitFieldSize()
*/
public IASTExpression getBitFieldSize() {
public CPPASTFieldDeclarator() {
}
public CPPASTFieldDeclarator(IASTExpression bitField) {
setBitFieldSize(bitField);
}
public IASTExpression getBitFieldSize() {
return bitField;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTFieldDeclarator#setBitFieldSize(org.eclipse.cdt.core.dom.ast.IASTExpression)
*/
public void setBitFieldSize(IASTExpression size) {
this.bitField = size;
if (size != null) {
size.setParent(this);
size.setPropertyInParent(FIELD_SIZE);
}
}
protected boolean postAccept( ASTVisitor action ){

View file

@ -36,7 +36,16 @@ public class CPPASTFieldReference extends CPPASTNode implements
private IASTName name;
private boolean isDeref;
public boolean isTemplate() {
public CPPASTFieldReference() {
}
public CPPASTFieldReference(IASTName name, IASTExpression owner) {
setFieldName(name);
setFieldOwner(owner);
}
public boolean isTemplate() {
return isTemplate;
}
@ -50,6 +59,10 @@ public class CPPASTFieldReference extends CPPASTNode implements
public void setFieldOwner(IASTExpression expression) {
owner = expression;
if (expression != null) {
expression.setParent(this);
expression.setPropertyInParent(FIELD_OWNER);
}
}
public IASTName getFieldName() {
@ -57,7 +70,11 @@ public class CPPASTFieldReference extends CPPASTNode implements
}
public void setFieldName(IASTName name) {
this.name =name;
this.name = name;
if (name != null) {
name.setParent(this);
name.setPropertyInParent(FIELD_NAME);
}
}
public boolean isPointerDereference() {

View file

@ -32,52 +32,62 @@ public class CPPASTForStatement extends CPPASTNode implements ICPPASTForStatemen
private IASTDeclaration cond_declaration;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTForStatement#getCondition()
*/
public IASTExpression getConditionExpression() {
public CPPASTForStatement() {
}
public CPPASTForStatement(IASTStatement init, IASTDeclaration cond_declaration,
IASTExpression iterationExpression, IASTStatement body) {
setInitializerStatement(init);
setConditionDeclaration(cond_declaration);
setIterationExpression(iterationExpression);
setBody(body);
}
public CPPASTForStatement(IASTStatement init, IASTExpression condition,
IASTExpression iterationExpression, IASTStatement body) {
setInitializerStatement(init);
setConditionExpression(iterationExpression);
setIterationExpression(iterationExpression);
setBody(body);
}
public IASTExpression getConditionExpression() {
return condition;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTForStatement#setCondition(org.eclipse.cdt.core.dom.ast.IASTExpression)
*/
public void setConditionExpression(IASTExpression condition) {
this.condition = condition;
if (condition != null) {
condition.setParent(this);
condition.setPropertyInParent(CONDITION);
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTForStatement#getIterationExpression()
*/
public IASTExpression getIterationExpression() {
return iterationExpression;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTForStatement#setIterationExpression(org.eclipse.cdt.core.dom.ast.IASTExpression)
*/
public void setIterationExpression(IASTExpression iterator) {
this.iterationExpression = iterator;
if (iterator != null) {
iterator.setParent(this);
iterator.setPropertyInParent(ITERATION);
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTForStatement#getBody()
*/
public IASTStatement getBody() {
return body;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTForStatement#setBody(org.eclipse.cdt.core.dom.ast.IASTStatement)
*/
public void setBody(IASTStatement statement) {
body = statement;
if (statement != null) {
statement.setParent(this);
statement.setPropertyInParent(BODY);
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTForStatement#getScope()
*/
public IScope getScope() {
if( scope == null )
scope = new CPPBlockScope( this );
@ -147,11 +157,19 @@ public class CPPASTForStatement extends CPPASTNode implements ICPPASTForStatemen
}
public void setInitializerStatement(IASTStatement statement) {
init = statement;
init = statement;
if (statement != null) {
statement.setParent(this);
statement.setPropertyInParent(INITIALIZER);
}
}
public void setConditionDeclaration(IASTDeclaration d) {
cond_declaration = d;
if (d != null) {
d.setParent(this);
d.setPropertyInParent(CONDITION_DECLARATION);
}
}
public IASTDeclaration getConditionDeclaration() {

View file

@ -22,11 +22,25 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
*/
public class CPPASTFunctionCallExpression extends CPPASTNode implements
IASTFunctionCallExpression, IASTAmbiguityParent {
private IASTExpression functionName;
private IASTExpression parameter;
public void setFunctionNameExpression(IASTExpression expression) {
public CPPASTFunctionCallExpression() {
}
public CPPASTFunctionCallExpression(IASTExpression functionName, IASTExpression parameter) {
setFunctionNameExpression(functionName);
setParameterExpression(parameter);
}
public void setFunctionNameExpression(IASTExpression expression) {
this.functionName = expression;
if (expression != null) {
expression.setParent(this);
expression.setPropertyInParent(FUNCTION_NAME);
}
}
public IASTExpression getFunctionNameExpression() {
@ -35,6 +49,10 @@ public class CPPASTFunctionCallExpression extends CPPASTNode implements
public void setParameterExpression(IASTExpression expression) {
this.parameter = expression;
if (expression != null) {
expression.setParent(this);
expression.setPropertyInParent(PARAMETERS);
}
}
public IASTExpression getParameterExpression() {

View file

@ -14,6 +14,7 @@ import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
@ -25,8 +26,7 @@ import org.eclipse.cdt.core.parser.util.ArrayUtil;
/**
* @author jcamelon
*/
public class CPPASTFunctionDeclarator extends CPPASTDeclarator implements
ICPPASTFunctionDeclarator {
public class CPPASTFunctionDeclarator extends CPPASTDeclarator implements ICPPASTFunctionDeclarator {
private IASTParameterDeclaration [] parameters = null;
private int parametersPos=-1;
@ -35,78 +35,58 @@ public class CPPASTFunctionDeclarator extends CPPASTDeclarator implements
private boolean pureVirtual;
private boolean isVolatile;
private boolean isConst;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator#getParameters()
*/
public IASTParameterDeclaration [] getParameters() {
public CPPASTFunctionDeclarator() {
}
public CPPASTFunctionDeclarator(IASTName name) {
super(name);
}
public IASTParameterDeclaration [] getParameters() {
if( parameters == null ) return IASTParameterDeclaration.EMPTY_PARAMETERDECLARATION_ARRAY;
parameters = (IASTParameterDeclaration[]) ArrayUtil.removeNullsAfter( IASTParameterDeclaration.class, parameters, parametersPos );
return parameters;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator#addParameterDeclaration(org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration)
*/
public void addParameterDeclaration(IASTParameterDeclaration parameter) {
if (parameter != null) {
parameter.setParent(this);
parameter.setPropertyInParent(FUNCTION_PARAMETER);
parameters = (IASTParameterDeclaration []) ArrayUtil.append( IASTParameterDeclaration.class, parameters, ++parametersPos, parameter );
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator#takesVarArgs()
*/
public boolean takesVarArgs() {
return varArgs;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator#setVarArgs(boolean)
*/
public void setVarArgs(boolean value) {
varArgs = value;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator#isConst()
*/
public boolean isConst() {
return isConst;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator#setConst(boolean)
*/
public void setConst(boolean value) {
this.isConst = value;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator#isVolatile()
*/
public boolean isVolatile() {
return isVolatile;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator#setVolatile(boolean)
*/
public void setVolatile(boolean value) {
this.isVolatile = value;
}
private IASTTypeId [] typeIds = null;
private int typeIdsPos=-1;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator#getExceptionSpecification()
*/
public IASTTypeId[] getExceptionSpecification() {
if( typeIds == null ) return IASTTypeId.EMPTY_TYPEID_ARRAY;
typeIds = (IASTTypeId[]) ArrayUtil.removeNullsAfter( IASTTypeId.class, typeIds, typeIdsPos );
@ -114,27 +94,20 @@ public class CPPASTFunctionDeclarator extends CPPASTDeclarator implements
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator#addExceptionSpecificationTypeId(org.eclipse.cdt.core.dom.ast.IASTTypeId)
*/
public void addExceptionSpecificationTypeId(IASTTypeId typeId) {
if (typeId != null) {
typeIds = (IASTTypeId[]) ArrayUtil.append( IASTTypeId.class, typeIds, ++typeIdsPos, typeId );
typeId.setParent(this);
typeId.setPropertyInParent(EXCEPTION_TYPEID);
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator#isPureVirtual()
*/
public boolean isPureVirtual() {
return pureVirtual;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator#setPureVirtual(boolean)
*/
public void setPureVirtual(boolean isPureVirtual) {
this.pureVirtual = isPureVirtual;
}
@ -143,9 +116,7 @@ public class CPPASTFunctionDeclarator extends CPPASTDeclarator implements
private ICPPASTConstructorChainInitializer [] constructorChain = null;
private int constructorChainPos=-1;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator#getConstructorChain()
*/
public ICPPASTConstructorChainInitializer[] getConstructorChain() {
if( constructorChain == null ) return ICPPASTConstructorChainInitializer.EMPTY_CONSTRUCTORCHAININITIALIZER_ARRAY;
constructorChain = (ICPPASTConstructorChainInitializer[]) ArrayUtil.removeNullsAfter( ICPPASTConstructorChainInitializer.class, constructorChain, constructorChainPos );
@ -153,12 +124,11 @@ public class CPPASTFunctionDeclarator extends CPPASTDeclarator implements
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator#addConstructorToChain(org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer)
*/
public void addConstructorToChain(ICPPASTConstructorChainInitializer initializer) {
if (initializer != null) {
constructorChain = (ICPPASTConstructorChainInitializer[]) ArrayUtil.append(ICPPASTConstructorChainInitializer.class, constructorChain, ++constructorChainPos, initializer );
initializer.setParent(this);
initializer.setPropertyInParent(CONSTRUCTOR_CHAIN_MEMBER);
}
}

Some files were not shown because too many files have changed in this diff Show more