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
|
||||
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 );
|
||||
}
|
||||
|
||||
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
|
||||
Fixed https://bugs.eclipse.org/bugs/show_bug.cgi?id=39704
|
||||
Fixed https://bugs.eclipse.org/bugs/show_bug.cgi?id=29060
|
||||
|
|
|
@ -152,7 +152,8 @@ public interface IASTFactory
|
|||
boolean isShort,
|
||||
boolean isLong,
|
||||
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(
|
||||
IASTScope scope,
|
||||
|
|
|
@ -69,6 +69,7 @@ public class DeclarationWrapper implements IDeclaratorOwner
|
|||
friend = false,
|
||||
inline = false;
|
||||
private int startingLine;
|
||||
private boolean global = false;
|
||||
/**
|
||||
* @param b
|
||||
*/
|
||||
|
@ -744,4 +745,14 @@ public class DeclarationWrapper implements IDeclaratorOwner
|
|||
{
|
||||
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.isLong(),
|
||||
sdw.isSigned(),
|
||||
sdw.isUnsigned(), sdw.isTypeNamed(), sdw.isComplex(), sdw.isImaginary()));
|
||||
sdw.isUnsigned(),
|
||||
sdw.isTypeNamed(),
|
||||
sdw.isComplex(),
|
||||
sdw.isImaginary(),
|
||||
sdw.isGloballyQualified()));
|
||||
}
|
||||
catch (Exception e1)
|
||||
{
|
||||
|
@ -1193,7 +1197,11 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
sdw.isShort(),
|
||||
sdw.isLong(),
|
||||
sdw.isSigned(),
|
||||
sdw.isUnsigned(), sdw.isTypeNamed(), sdw.isComplex(), sdw.isImaginary()));
|
||||
sdw.isUnsigned(),
|
||||
sdw.isTypeNamed(),
|
||||
sdw.isComplex(),
|
||||
sdw.isImaginary(),
|
||||
sdw.isGloballyQualified()));
|
||||
}
|
||||
catch (ASTSemanticException e)
|
||||
{
|
||||
|
@ -1564,7 +1572,9 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
flags.setEncounteredTypename(true);
|
||||
break;
|
||||
case IToken.tCOLONCOLON :
|
||||
consume(IToken.tCOLONCOLON);
|
||||
sdw.setGloballyQualified( true );
|
||||
consume( IToken.tCOLONCOLON );
|
||||
break;
|
||||
case IToken.tIDENTIFIER :
|
||||
// TODO - Kludgy way to handle constructors/destructors
|
||||
if (flags.haveEncounteredRawType())
|
||||
|
|
|
@ -1717,7 +1717,11 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
boolean isShort,
|
||||
boolean isLong,
|
||||
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;
|
||||
|
||||
|
@ -1747,7 +1751,10 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
IToken first = typeName.getFirstToken();
|
||||
|
||||
ISymbol typeSymbol = getScopeToSearchUpon( scope, first, i );
|
||||
|
||||
|
||||
if( isGlobal )
|
||||
typeSymbol = typeSymbol.getSymbolTable().getCompilationUnit();
|
||||
|
||||
List [] argLists = typeName.getTemplateIdArgLists();
|
||||
int idx = 0;
|
||||
|
||||
|
|
|
@ -502,7 +502,8 @@ public class ExpressionParseASTFactory extends BaseASTFactory implements IASTFac
|
|||
boolean isUnsigned,
|
||||
boolean isTypename,
|
||||
boolean isComplex,
|
||||
boolean isImaginary)
|
||||
boolean isImaginary,
|
||||
boolean isGlobal)
|
||||
throws ASTSemanticException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
|
|
|
@ -208,7 +208,7 @@ public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory
|
|||
/* (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)
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue