mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-01 06:05:24 +02:00
[98375] Added handling of content assist in condition expressions.
This commit is contained in:
parent
561a996910
commit
e5876952df
1 changed files with 17 additions and 9 deletions
|
@ -863,8 +863,13 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
|||
if (LT(1) == IToken.tQUESTION) {
|
||||
consume(IToken.tQUESTION);
|
||||
IASTExpression secondExpression = expression();
|
||||
consume(IToken.tCOLON);
|
||||
IASTExpression thirdExpression = assignmentExpression();
|
||||
IASTExpression thirdExpression = null;
|
||||
|
||||
if (LT(1) != IToken.tEOC) {
|
||||
consume(IToken.tCOLON);
|
||||
thirdExpression = assignmentExpression();
|
||||
}
|
||||
|
||||
IASTConditionalExpression result = createConditionalExpression();
|
||||
result.setLogicalConditionExpression(firstExpression);
|
||||
firstExpression.setParent(result);
|
||||
|
@ -874,13 +879,16 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
|||
secondExpression.setParent(result);
|
||||
secondExpression
|
||||
.setPropertyInParent(IASTConditionalExpression.POSITIVE_RESULT);
|
||||
result.setNegativeResultExpression(thirdExpression);
|
||||
thirdExpression.setParent(result);
|
||||
thirdExpression
|
||||
.setPropertyInParent(IASTConditionalExpression.NEGATIVE_RESULT);
|
||||
((ASTNode) result).setOffsetAndLength(((ASTNode) firstExpression)
|
||||
.getOffset(), calculateEndOffset(thirdExpression)
|
||||
- ((ASTNode) firstExpression).getOffset());
|
||||
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());
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
return firstExpression;
|
||||
|
|
Loading…
Add table
Reference in a new issue