mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
fix for bug 47625
This commit is contained in:
parent
0d4329b166
commit
671986dfa7
9 changed files with 65 additions and 8 deletions
|
@ -1,3 +1,6 @@
|
||||||
|
2004-04-05 Andrew Niefer
|
||||||
|
added parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.testBug47625()
|
||||||
|
|
||||||
2004-04-06 John Camelon
|
2004-04-06 John Camelon
|
||||||
Moved testBug39704A(), testBug39704B(), testBug39704C() & testBug39704D() from ASTFailedTests to QuickParseASTTests.
|
Moved testBug39704A(), testBug39704B(), testBug39704C() & testBug39704D() from ASTFailedTests to QuickParseASTTests.
|
||||||
|
|
||||||
|
|
|
@ -1390,4 +1390,25 @@ public class CompleteParseASTTest extends CompleteParseBaseTest
|
||||||
assertEquals( ((IASTSimpleTypeSpecifier)variable.getAbstractDeclaration().getTypeSpecifier()).getTypeSpecifier(), typedef );
|
assertEquals( ((IASTSimpleTypeSpecifier)variable.getAbstractDeclaration().getTypeSpecifier()).getTypeSpecifier(), typedef );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testBug47625() throws Exception
|
||||||
|
{
|
||||||
|
Writer writer = new StringWriter();
|
||||||
|
writer.write("struct s { int num; }; ");
|
||||||
|
writer.write("namespace ns{ ");
|
||||||
|
writer.write(" struct s { double num; };");
|
||||||
|
writer.write(" s inner = { 3.14 };");
|
||||||
|
writer.write(" ::s outer = { 42 };");
|
||||||
|
writer.write("}");
|
||||||
|
|
||||||
|
Iterator i = parse( writer.toString() ).getDeclarations();
|
||||||
|
IASTClassSpecifier outerS = (IASTClassSpecifier) ((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
|
||||||
|
IASTNamespaceDefinition ns = (IASTNamespaceDefinition) i.next();
|
||||||
|
|
||||||
|
i = getDeclarations( ns );
|
||||||
|
IASTClassSpecifier innerS = (IASTClassSpecifier) ((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
|
||||||
|
IASTVariable inner = (IASTVariable) i.next();
|
||||||
|
IASTVariable outer = (IASTVariable) i.next();
|
||||||
|
|
||||||
|
assertAllReferences( 2, createTaskList( new Task( outerS ), new Task( innerS ) ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
2004-04-06 Andrew Niefer
|
||||||
|
fix bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=47625
|
||||||
|
|
||||||
2004-04-06 John Camelon
|
2004-04-06 John Camelon
|
||||||
Fixed https://bugs.eclipse.org/bugs/show_bug.cgi?id=39704
|
Fixed https://bugs.eclipse.org/bugs/show_bug.cgi?id=39704
|
||||||
Fixed https://bugs.eclipse.org/bugs/show_bug.cgi?id=29060
|
Fixed https://bugs.eclipse.org/bugs/show_bug.cgi?id=29060
|
||||||
|
|
|
@ -152,7 +152,8 @@ public interface IASTFactory
|
||||||
boolean isShort,
|
boolean isShort,
|
||||||
boolean isLong,
|
boolean isLong,
|
||||||
boolean isSigned,
|
boolean isSigned,
|
||||||
boolean isUnsigned, boolean isTypename, boolean isComplex, boolean isImaginary) throws ASTSemanticException;
|
boolean isUnsigned,
|
||||||
|
boolean isTypename, boolean isComplex, boolean isImaginary, boolean isGlobal ) throws ASTSemanticException;
|
||||||
|
|
||||||
public IASTFunction createFunction(
|
public IASTFunction createFunction(
|
||||||
IASTScope scope,
|
IASTScope scope,
|
||||||
|
|
|
@ -69,6 +69,7 @@ public class DeclarationWrapper implements IDeclaratorOwner
|
||||||
friend = false,
|
friend = false,
|
||||||
inline = false;
|
inline = false;
|
||||||
private int startingLine;
|
private int startingLine;
|
||||||
|
private boolean global = false;
|
||||||
/**
|
/**
|
||||||
* @param b
|
* @param b
|
||||||
*/
|
*/
|
||||||
|
@ -744,4 +745,14 @@ public class DeclarationWrapper implements IDeclaratorOwner
|
||||||
{
|
{
|
||||||
complex = b;
|
complex = b;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @param b
|
||||||
|
*/
|
||||||
|
public void setGloballyQualified(boolean b) {
|
||||||
|
global = b;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isGloballyQualified(){
|
||||||
|
return global;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -960,7 +960,11 @@ public abstract class Parser extends ExpressionParser implements IParser
|
||||||
sdw.isShort(),
|
sdw.isShort(),
|
||||||
sdw.isLong(),
|
sdw.isLong(),
|
||||||
sdw.isSigned(),
|
sdw.isSigned(),
|
||||||
sdw.isUnsigned(), sdw.isTypeNamed(), sdw.isComplex(), sdw.isImaginary()));
|
sdw.isUnsigned(),
|
||||||
|
sdw.isTypeNamed(),
|
||||||
|
sdw.isComplex(),
|
||||||
|
sdw.isImaginary(),
|
||||||
|
sdw.isGloballyQualified()));
|
||||||
}
|
}
|
||||||
catch (Exception e1)
|
catch (Exception e1)
|
||||||
{
|
{
|
||||||
|
@ -1193,7 +1197,11 @@ public abstract class Parser extends ExpressionParser implements IParser
|
||||||
sdw.isShort(),
|
sdw.isShort(),
|
||||||
sdw.isLong(),
|
sdw.isLong(),
|
||||||
sdw.isSigned(),
|
sdw.isSigned(),
|
||||||
sdw.isUnsigned(), sdw.isTypeNamed(), sdw.isComplex(), sdw.isImaginary()));
|
sdw.isUnsigned(),
|
||||||
|
sdw.isTypeNamed(),
|
||||||
|
sdw.isComplex(),
|
||||||
|
sdw.isImaginary(),
|
||||||
|
sdw.isGloballyQualified()));
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
{
|
{
|
||||||
|
@ -1564,7 +1572,9 @@ public abstract class Parser extends ExpressionParser implements IParser
|
||||||
flags.setEncounteredTypename(true);
|
flags.setEncounteredTypename(true);
|
||||||
break;
|
break;
|
||||||
case IToken.tCOLONCOLON :
|
case IToken.tCOLONCOLON :
|
||||||
consume(IToken.tCOLONCOLON);
|
sdw.setGloballyQualified( true );
|
||||||
|
consume( IToken.tCOLONCOLON );
|
||||||
|
break;
|
||||||
case IToken.tIDENTIFIER :
|
case IToken.tIDENTIFIER :
|
||||||
// TODO - Kludgy way to handle constructors/destructors
|
// TODO - Kludgy way to handle constructors/destructors
|
||||||
if (flags.haveEncounteredRawType())
|
if (flags.haveEncounteredRawType())
|
||||||
|
|
|
@ -1717,7 +1717,11 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
||||||
boolean isShort,
|
boolean isShort,
|
||||||
boolean isLong,
|
boolean isLong,
|
||||||
boolean isSigned,
|
boolean isSigned,
|
||||||
boolean isUnsigned, boolean isTypename, boolean isComplex, boolean isImaginary) throws ASTSemanticException
|
boolean isUnsigned,
|
||||||
|
boolean isTypename,
|
||||||
|
boolean isComplex,
|
||||||
|
boolean isImaginary,
|
||||||
|
boolean isGlobal ) throws ASTSemanticException
|
||||||
{
|
{
|
||||||
TypeInfo.eType type = null;
|
TypeInfo.eType type = null;
|
||||||
|
|
||||||
|
@ -1747,7 +1751,10 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
||||||
IToken first = typeName.getFirstToken();
|
IToken first = typeName.getFirstToken();
|
||||||
|
|
||||||
ISymbol typeSymbol = getScopeToSearchUpon( scope, first, i );
|
ISymbol typeSymbol = getScopeToSearchUpon( scope, first, i );
|
||||||
|
|
||||||
|
if( isGlobal )
|
||||||
|
typeSymbol = typeSymbol.getSymbolTable().getCompilationUnit();
|
||||||
|
|
||||||
List [] argLists = typeName.getTemplateIdArgLists();
|
List [] argLists = typeName.getTemplateIdArgLists();
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
|
|
||||||
|
|
|
@ -502,7 +502,8 @@ public class ExpressionParseASTFactory extends BaseASTFactory implements IASTFac
|
||||||
boolean isUnsigned,
|
boolean isUnsigned,
|
||||||
boolean isTypename,
|
boolean isTypename,
|
||||||
boolean isComplex,
|
boolean isComplex,
|
||||||
boolean isImaginary)
|
boolean isImaginary,
|
||||||
|
boolean isGlobal)
|
||||||
throws ASTSemanticException {
|
throws ASTSemanticException {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -208,7 +208,7 @@ public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createSimpleTypeSpecifier(org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier.SimpleType, org.eclipse.cdt.core.parser.ITokenDuple)
|
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createSimpleTypeSpecifier(org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier.SimpleType, org.eclipse.cdt.core.parser.ITokenDuple)
|
||||||
*/
|
*/
|
||||||
public IASTSimpleTypeSpecifier createSimpleTypeSpecifier(IASTScope scope, Type kind, ITokenDuple typeName, boolean isShort, boolean isLong, boolean isSigned, boolean isUnsigned, boolean isTypename, boolean isComplex, boolean isImaginary )
|
public IASTSimpleTypeSpecifier createSimpleTypeSpecifier(IASTScope scope, Type kind, ITokenDuple typeName, boolean isShort, boolean isLong, boolean isSigned, boolean isUnsigned, boolean isTypename, boolean isComplex, boolean isImaginary, boolean isGlobal)
|
||||||
{
|
{
|
||||||
return new ASTSimpleTypeSpecifier( kind, typeName, isShort, isLong, isSigned, isUnsigned, isTypename, isComplex, isImaginary);
|
return new ASTSimpleTypeSpecifier( kind, typeName, isShort, isLong, isSigned, isUnsigned, isTypename, isComplex, isImaginary);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue