mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-08 00:35:49 +02:00
fix bug 89539
This commit is contained in:
parent
074f1693f1
commit
af99524697
2 changed files with 36 additions and 0 deletions
|
@ -3095,5 +3095,30 @@ public class AST2CPPTests extends AST2BaseTest {
|
|||
assertEquals( s[0], "B" ); //$NON-NLS-1$
|
||||
assertTrue( alias.isGloballyQualified() );
|
||||
}
|
||||
|
||||
public void testBug89539() throws Exception {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append("class A{}; \n"); //$NON-NLS-1$
|
||||
buffer.append("class B : public A { \n"); //$NON-NLS-1$
|
||||
buffer.append(" B () : A() {} \n"); //$NON-NLS-1$
|
||||
buffer.append("}; \n"); //$NON-NLS-1$
|
||||
|
||||
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.CPP ); //$NON-NLS-1$
|
||||
CPPNameCollector col = new CPPNameCollector();
|
||||
tu.accept( col );
|
||||
|
||||
ICPPClassType A1 = (ICPPClassType) col.getName(0).resolveBinding();
|
||||
ICPPClassType A2 = (ICPPClassType) col.getName(2).resolveBinding();
|
||||
assertSame( A1, A2 );
|
||||
|
||||
ICPPConstructor A3 = (ICPPConstructor) col.getName(4).resolveBinding();
|
||||
assertSame( A3.getScope(), A1.getCompositeScope() );
|
||||
|
||||
tu = parse( buffer.toString(), ParserLanguage.CPP ); //$NON-NLS-1$
|
||||
col = new CPPNameCollector();
|
||||
tu.accept( col );
|
||||
|
||||
assertTrue( col.getName(4).resolveBinding() instanceof ICPPConstructor );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -199,6 +199,8 @@ public class CPPSemantics {
|
|||
IASTNode p1 = astName.getParent();
|
||||
IASTNode p2 = p1.getParent();
|
||||
|
||||
if( p1 instanceof ICPPASTConstructorChainInitializer )
|
||||
return true;
|
||||
if( p1 instanceof ICPPASTNamedTypeSpecifier && p2 instanceof IASTTypeId )
|
||||
return p2.getParent() instanceof ICPPASTNewExpression;
|
||||
else if( p1 instanceof ICPPASTQualifiedName && p2 instanceof ICPPASTFunctionDeclarator ){
|
||||
|
@ -520,6 +522,15 @@ public class CPPSemantics {
|
|||
else
|
||||
data.functionParameters = IASTExpression.EMPTY_EXPRESSION_ARRAY;
|
||||
}
|
||||
} else if( parent instanceof ICPPASTConstructorChainInitializer ){
|
||||
ICPPASTConstructorChainInitializer ctorinit = (ICPPASTConstructorChainInitializer) parent;
|
||||
IASTExpression val = ctorinit.getInitializerValue();
|
||||
if( val instanceof IASTExpressionList )
|
||||
data.functionParameters = ((IASTExpressionList) val ).getExpressions();
|
||||
else if( val != null )
|
||||
data.functionParameters = new IASTExpression [] { val };
|
||||
else
|
||||
data.functionParameters = IASTExpression.EMPTY_EXPRESSION_ARRAY;
|
||||
}
|
||||
|
||||
if( considerAssociatedScopes && !(name.getParent() instanceof ICPPASTQualifiedName) && data.functionCall() ){
|
||||
|
|
Loading…
Add table
Reference in a new issue