1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-04 06:45:43 +02:00

Fixed Bug 87807 - [Parser] CPPASTTypeIdExpression does not implement ICPPASTTypeIdExpression

This commit is contained in:
John Camelon 2005-03-14 20:24:33 +00:00
parent f83e7a7c6f
commit 44ccc9fdac
4 changed files with 13 additions and 12 deletions

View file

@ -288,7 +288,8 @@ public class AST2BaseTest extends TestCase {
protected void isExpressionStringEqual(IASTExpression exp, String str) {
assertEquals(str, ASTSignatureUtil.getExpressionString(exp));
String expressionString = ASTSignatureUtil.getExpressionString(exp);
assertEquals(str, expressionString);
}
protected void isParameterSignatureEqual(IASTDeclarator decltor, String str) {

View file

@ -163,12 +163,12 @@ public class AST2UtilOldTests extends AST2BaseTest {
isExpressionStringEqual( ((IASTInitializerExpression)((IASTSimpleDeclaration)d[0]).getDeclarators()[0].getInitializer()).getExpression(), "foo(typeid(a))" ); //$NON-NLS-1$
}
// Kind POSTFIX_TYPEID_TYPEID : type of the ID
// TODO enable after 87807 is fixed
// public void testPostfixTypeIdTypeId2() throws Exception{
// IASTTranslationUnit tu = parse("int x = foo( typeid(const A) );".toString(), ParserLanguage.CPP); //$NON-NLS-1$
// IASTDeclaration[] d = tu.getDeclarations();
// isExpressionStringEqual( ((IASTInitializerExpression)((IASTSimpleDeclaration)d[0]).getDeclarators()[0].getInitializer()).getExpression(), "foo(typeid(const A))" ); //$NON-NLS-1$
// }
public void testPostfixTypeIdTypeId2() throws Exception{
IASTTranslationUnit tu = parse("int x = foo( typeid(const A) );".toString(), ParserLanguage.CPP); //$NON-NLS-1$
IASTDeclaration[] d = tu.getDeclarations();
isExpressionStringEqual( ((IASTInitializerExpression)((IASTSimpleDeclaration)d[0]).getDeclarators()[0].getInitializer()).getExpression(), "foo(typeid (const A))" ); //$NON-NLS-1$
}
// Kind UNARY_INCREMENT : LHS
public void testUnaryIncrement() throws Exception
{

View file

@ -12,13 +12,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.IASTTypeId;
import org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTypeIdExpression;
/**
* @author jcamelon
*/
public class CPPASTTypeIdExpression extends CPPASTNode implements
IASTTypeIdExpression {
ICPPASTTypeIdExpression {
private int op;
private IASTTypeId typeId;

View file

@ -4549,21 +4549,21 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
*/
protected IASTExpression buildTypeIdExpression(int op, IASTTypeId typeId,
int startingOffset, int endingOffset) {
IASTTypeIdExpression typeIdExpression = createTypeIdExpression();
ICPPASTTypeIdExpression typeIdExpression = createTypeIdExpression();
((ASTNode) typeIdExpression).setOffsetAndLength(startingOffset,
endingOffset - startingOffset);
((ASTNode) typeIdExpression).setLength(endingOffset - startingOffset);
typeIdExpression.setOperator(op);
typeIdExpression.setTypeId(typeId);
typeId.setParent(typeIdExpression);
typeId.setPropertyInParent(IASTTypeIdExpression.TYPE_ID);
typeId.setPropertyInParent(ICPPASTTypeIdExpression.TYPE_ID);
return typeIdExpression;
}
/**
* @return
*/
protected IASTTypeIdExpression createTypeIdExpression() {
protected ICPPASTTypeIdExpression createTypeIdExpression() {
return new CPPASTTypeIdExpression();
}