mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 17:35:35 +02:00
Bug 471621 - Have CPPASTAlignmentSpecifier implement IASTAmbiguityParent
This is necessary because the expression inside the alignment specifier may be an ambiguous expression. Change-Id: Ibb38410fea21251d866ddc58de6dc29b73623732 Signed-off-by: Nathan Ridge <zeratul976@hotmail.com>
This commit is contained in:
parent
f413507257
commit
ebd396e2fb
1 changed files with 17 additions and 1 deletions
|
@ -13,10 +13,13 @@ package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
|||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTAlignmentSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
||||
|
||||
public class CPPASTAlignmentSpecifier extends ASTNode implements IASTAlignmentSpecifier {
|
||||
public class CPPASTAlignmentSpecifier extends ASTNode implements IASTAlignmentSpecifier,
|
||||
IASTAmbiguityParent {
|
||||
// Precisely one of these is null.
|
||||
private IASTExpression fExpression;
|
||||
private IASTTypeId fTypeId;
|
||||
|
@ -66,4 +69,17 @@ public class CPPASTAlignmentSpecifier extends ASTNode implements IASTAlignmentSp
|
|||
}
|
||||
return fTypeId.accept(visitor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void replace(IASTNode child, IASTNode other) {
|
||||
if (child instanceof IASTExpression && other instanceof IASTExpression && fExpression == child) {
|
||||
fExpression = (IASTExpression) other;
|
||||
other.setParent(child.getParent());
|
||||
other.setPropertyInParent(child.getPropertyInParent());
|
||||
} else if (child instanceof IASTTypeId && other instanceof IASTTypeId && fTypeId == child) {
|
||||
fTypeId = (IASTTypeId) other;
|
||||
other.setParent(child.getParent());
|
||||
other.setPropertyInParent(child.getPropertyInParent());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue