mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Patch for Hoda Amer
Core: Solution to bug#43373: No reference to static member in definition (Major) Solution to bug#43371: constructor incorrectly marked private (Normal) Tests: Added CompleteParseASTTest.testBug43373() Added QuickParseASTTests.testBug43371() UI: Solution to bug#43143: Naming of Code Assist Menus/Tab are not consistent changed both names to Content Assist. No tests provided.
This commit is contained in:
parent
558e9619c2
commit
ef856ea3e1
13 changed files with 213 additions and 27 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2003-09-23 Hoda Amer
|
||||||
|
Added CompleteParseASTTest.testBug43373()
|
||||||
|
Added QuickParseASTTests.testBug43371()
|
||||||
|
|
||||||
2003-09-22 Bogdan Gheorghe
|
2003-09-22 Bogdan Gheorghe
|
||||||
- modified CompletionProposalsTests, BaseSearchTest
|
- modified CompletionProposalsTests, BaseSearchTest
|
||||||
to avoid using isEnabled for the IndexManager
|
to avoid using isEnabled for the IndexManager
|
||||||
|
|
|
@ -773,5 +773,28 @@ public class CompleteParseASTTest extends CompleteParseBaseTest
|
||||||
for( int j =0; j < 4; ++j )
|
for( int j =0; j < 4; ++j )
|
||||||
assertFalse( classOp.getNameOffset() == ((IASTReference)callback.getReferences().get(j)).getOffset() );
|
assertFalse( classOp.getNameOffset() == ((IASTReference)callback.getReferences().get(j)).getOffset() );
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* class A { static int x; } int A::x = 5;
|
||||||
|
*/
|
||||||
|
public void testBug43373() throws Exception
|
||||||
|
{
|
||||||
|
try { // This is to prove that there are no exceptions
|
||||||
|
// Used to cause AST Semantic exception
|
||||||
|
Iterator i = parse( "class A { static int x; }; int A::x = 5;" ).getDeclarations();
|
||||||
|
IASTClassSpecifier classA = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
|
||||||
|
Iterator j = getDeclarations(classA);
|
||||||
|
IASTField field1 = (IASTField) j.next();
|
||||||
|
// Note : this used to be considered a variable, not a field
|
||||||
|
IASTField field2 = (IASTField)i.next();
|
||||||
|
|
||||||
|
assertEquals( callback.getReferences().size(), 1 );
|
||||||
|
Iterator references = callback.getReferences().iterator();
|
||||||
|
assertEquals( ((IASTReference)references.next()).getReferencedElement(), classA );
|
||||||
|
assertTrue (field1.getVisiblity() == field2.getVisiblity());
|
||||||
|
}catch (Exception e){
|
||||||
|
fail();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1815,5 +1815,31 @@ public class QuickParseASTTests extends BaseASTTest
|
||||||
{
|
{
|
||||||
parse("int *restrict ip_fn (void);", true, true, ParserLanguage.C).getDeclarations().next();
|
parse("int *restrict ip_fn (void);", true, true, ParserLanguage.C).getDeclarations().next();
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Test code: struct Example { Example(); Example(int); ~Example();};
|
||||||
|
* Purpose: tests a declaration in a class scope.
|
||||||
|
*/
|
||||||
|
public void testBug43371 () throws Exception
|
||||||
|
{
|
||||||
|
// Parse and get the translaton unit
|
||||||
|
Writer code = new StringWriter();
|
||||||
|
code.write("struct Example { Example(); Example(int); ~Example();};");
|
||||||
|
IASTCompilationUnit cu = parse(code.toString());
|
||||||
|
Iterator i = cu.getDeclarations();
|
||||||
|
assertTrue(i.hasNext());
|
||||||
|
IASTAbstractTypeSpecifierDeclaration declaration =
|
||||||
|
(IASTAbstractTypeSpecifierDeclaration)i.next();
|
||||||
|
assertFalse(i.hasNext());
|
||||||
|
assertTrue( declaration.getTypeSpecifier() instanceof IASTClassSpecifier);
|
||||||
|
assertTrue(((IASTClassSpecifier)declaration.getTypeSpecifier()).getClassKind()== ASTClassKind.STRUCT);
|
||||||
|
Iterator j =((IASTClassSpecifier)declaration.getTypeSpecifier()).getDeclarations();
|
||||||
|
assertTrue(j.hasNext());
|
||||||
|
IASTMethod m1 = (IASTMethod)j.next();
|
||||||
|
IASTMethod m2 = (IASTMethod)j.next();
|
||||||
|
IASTMethod m3 = (IASTMethod)j.next();
|
||||||
|
assertFalse(j.hasNext());
|
||||||
|
assertTrue(m1.getVisiblity() == ASTAccessVisibility.PUBLIC);
|
||||||
|
assertTrue(m2.getVisiblity() == ASTAccessVisibility.PUBLIC);
|
||||||
|
assertTrue(m3.getVisiblity() == ASTAccessVisibility.PUBLIC);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -521,6 +521,10 @@ public class CModelBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
methodElement.setParameterTypes(parameterTypes);
|
||||||
|
methodElement.setReturnType( ASTUtil.getType(functionDeclaration.getReturnType()) );
|
||||||
|
methodElement.setStatic(functionDeclaration.isStatic());
|
||||||
|
|
||||||
// Common settings for method declaration
|
// Common settings for method declaration
|
||||||
methodElement.setVisibility(methodDeclaration.getVisiblity());
|
methodElement.setVisibility(methodDeclaration.getVisiblity());
|
||||||
methodElement.setVolatile(methodDeclaration.isVolatile());
|
methodElement.setVolatile(methodDeclaration.isVolatile());
|
||||||
|
@ -535,15 +539,16 @@ public class CModelBuilder {
|
||||||
}
|
}
|
||||||
else // instance of IASTFunction
|
else // instance of IASTFunction
|
||||||
{
|
{
|
||||||
|
FunctionDeclaration functionElement = null;
|
||||||
if (functionDeclaration.hasFunctionBody())
|
if (functionDeclaration.hasFunctionBody())
|
||||||
{
|
{
|
||||||
// function
|
// function
|
||||||
if(!isTemplate){
|
if(!isTemplate){
|
||||||
Function newElement = new Function( parent, name );
|
Function newElement = new Function( parent, name );
|
||||||
element = newElement;
|
functionElement = newElement;
|
||||||
} else {
|
} else {
|
||||||
FunctionTemplate newElement = new FunctionTemplate( parent, name );
|
FunctionTemplate newElement = new FunctionTemplate( parent, name );
|
||||||
element = newElement;
|
functionElement = newElement;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -551,17 +556,17 @@ public class CModelBuilder {
|
||||||
// functionDeclaration
|
// functionDeclaration
|
||||||
if(!isTemplate){
|
if(!isTemplate){
|
||||||
FunctionDeclaration newElement = new FunctionDeclaration( parent, name );
|
FunctionDeclaration newElement = new FunctionDeclaration( parent, name );
|
||||||
element = newElement;
|
functionElement = newElement;
|
||||||
} else {
|
} else {
|
||||||
FunctionTemplate newElement = new FunctionTemplate( parent, name );
|
FunctionTemplate newElement = new FunctionTemplate( parent, name );
|
||||||
element = newElement;
|
functionElement = newElement;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
functionElement.setParameterTypes(parameterTypes);
|
||||||
|
functionElement.setReturnType( ASTUtil.getType(functionDeclaration.getReturnType()) );
|
||||||
|
functionElement.setStatic(functionDeclaration.isStatic());
|
||||||
|
element = functionElement;
|
||||||
}
|
}
|
||||||
element.setParameterTypes(parameterTypes);
|
|
||||||
element.setReturnType( ASTUtil.getType(functionDeclaration.getReturnType()) );
|
|
||||||
element.setStatic(functionDeclaration.isStatic());
|
|
||||||
|
|
||||||
// add to parent
|
// add to parent
|
||||||
parent.addChild( element );
|
parent.addChild( element );
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
2003-09-23 Hoda Amer
|
||||||
|
Solution to bug#43373: No reference to static member in definition
|
||||||
|
Solution to bug#43371: constructor incorrectly marked private
|
||||||
|
|
||||||
2003-09-18 Andrew Niefer
|
2003-09-18 Andrew Niefer
|
||||||
- modified Symbol table interfaces to use Lists & Maps instead of LinkedList and HashMap
|
- modified Symbol table interfaces to use Lists & Maps instead of LinkedList and HashMap
|
||||||
- fixed warnings in ParserSymbolTable
|
- fixed warnings in ParserSymbolTable
|
||||||
|
|
|
@ -147,7 +147,7 @@ public interface IASTFactory
|
||||||
boolean isVolatile,
|
boolean isVolatile,
|
||||||
boolean isVirtual,
|
boolean isVirtual,
|
||||||
boolean isExplicit,
|
boolean isExplicit,
|
||||||
boolean isPureVirtual, ASTAccessVisibility visibility, List constructorChain, boolean isDefinition ) throws ASTSemanticException;
|
boolean isPureVirtual, List constructorChain, boolean isDefinition ) throws ASTSemanticException;
|
||||||
public IASTAbstractDeclaration createAbstractDeclaration(
|
public IASTAbstractDeclaration createAbstractDeclaration(
|
||||||
boolean isConst,
|
boolean isConst,
|
||||||
boolean isVolatile,
|
boolean isVolatile,
|
||||||
|
|
|
@ -468,7 +468,6 @@ public class DeclarationWrapper implements IDeclaratorOwner
|
||||||
virtual,
|
virtual,
|
||||||
explicit,
|
explicit,
|
||||||
declarator.isPureVirtual(),
|
declarator.isPureVirtual(),
|
||||||
ASTAccessVisibility.PUBLIC,
|
|
||||||
declarator.getConstructorMemberInitializers(), declarator.hasFunctionBody() );
|
declarator.getConstructorMemberInitializers(), declarator.hasFunctionBody() );
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -37,9 +37,9 @@ public class ASTField extends ASTVariable implements IASTField
|
||||||
* @param references
|
* @param references
|
||||||
* @param visibility
|
* @param visibility
|
||||||
*/
|
*/
|
||||||
public ASTField(ISymbol newSymbol, IASTAbstractDeclaration abstractDeclaration, IASTInitializerClause initializerClause, IASTExpression bitfieldExpression, int startingOffset, int nameOffset, List references, IASTExpression constructorExpression, ASTAccessVisibility visibility)
|
public ASTField(ISymbol newSymbol, IASTAbstractDeclaration abstractDeclaration, IASTInitializerClause initializerClause, IASTExpression bitfieldExpression, int startingOffset, int nameOffset, List references, boolean previouslyDeclared, IASTExpression constructorExpression, ASTAccessVisibility visibility)
|
||||||
{
|
{
|
||||||
super( newSymbol, abstractDeclaration, initializerClause, bitfieldExpression, startingOffset, nameOffset, references, constructorExpression );
|
super( newSymbol, abstractDeclaration, initializerClause, bitfieldExpression, startingOffset, nameOffset, references, constructorExpression, previouslyDeclared );
|
||||||
this.visibility = visibility;
|
this.visibility = visibility;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ import org.eclipse.cdt.internal.core.parser.pst.TypeInfo;
|
||||||
*/
|
*/
|
||||||
public class ASTVariable extends ASTSymbol implements IASTVariable
|
public class ASTVariable extends ASTSymbol implements IASTVariable
|
||||||
{
|
{
|
||||||
|
private final boolean previouslyDeclared;
|
||||||
private final IASTExpression constructorExpression;
|
private final IASTExpression constructorExpression;
|
||||||
protected final ASTReferenceStore referenceDelegate;
|
protected final ASTReferenceStore referenceDelegate;
|
||||||
private final ASTQualifiedNamedElement qualifiedName;
|
private final ASTQualifiedNamedElement qualifiedName;
|
||||||
|
@ -45,7 +46,7 @@ public class ASTVariable extends ASTSymbol implements IASTVariable
|
||||||
* @param nameOffset
|
* @param nameOffset
|
||||||
* @param references
|
* @param references
|
||||||
*/
|
*/
|
||||||
public ASTVariable(ISymbol newSymbol, IASTAbstractDeclaration abstractDeclaration, IASTInitializerClause initializerClause, IASTExpression bitfieldExpression, int startingOffset, int nameOffset, List references, IASTExpression constructorExpression )
|
public ASTVariable(ISymbol newSymbol, IASTAbstractDeclaration abstractDeclaration, IASTInitializerClause initializerClause, IASTExpression bitfieldExpression, int startingOffset, int nameOffset, List references, IASTExpression constructorExpression, boolean previouslyDeclared )
|
||||||
{
|
{
|
||||||
super( newSymbol );
|
super( newSymbol );
|
||||||
this.abstractDeclaration = abstractDeclaration;
|
this.abstractDeclaration = abstractDeclaration;
|
||||||
|
@ -56,6 +57,7 @@ public class ASTVariable extends ASTSymbol implements IASTVariable
|
||||||
setNameOffset( nameOffset );
|
setNameOffset( nameOffset );
|
||||||
referenceDelegate = new ASTReferenceStore( references );
|
referenceDelegate = new ASTReferenceStore( references );
|
||||||
qualifiedName = new ASTQualifiedNamedElement( getOwnerScope(), newSymbol.getName() );
|
qualifiedName = new ASTQualifiedNamedElement( getOwnerScope(), newSymbol.getName() );
|
||||||
|
this.previouslyDeclared =previouslyDeclared;
|
||||||
}
|
}
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.parser.ast.IASTVariable#isAuto()
|
* @see org.eclipse.cdt.core.parser.ast.IASTVariable#isAuto()
|
||||||
|
|
|
@ -157,6 +157,10 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected ISymbol lookupQualifiedName( IContainerSymbol startingScope, String name, List references, boolean throwOnError ) throws ASTSemanticException{
|
||||||
|
return lookupQualifiedName(startingScope, name, TypeInfo.t_any, null, 0, references, throwOnError);
|
||||||
|
}
|
||||||
|
|
||||||
protected ISymbol lookupQualifiedName( IContainerSymbol startingScope, String name, TypeInfo.eType type, List parameters, int offset, List references, boolean throwOnError ) throws ASTSemanticException
|
protected ISymbol lookupQualifiedName( IContainerSymbol startingScope, String name, TypeInfo.eType type, List parameters, int offset, List references, boolean throwOnError ) throws ASTSemanticException
|
||||||
{
|
{
|
||||||
ISymbol result = null;
|
ISymbol result = null;
|
||||||
|
@ -1406,7 +1410,8 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
||||||
boolean isVirtual,
|
boolean isVirtual,
|
||||||
boolean isExplicit,
|
boolean isExplicit,
|
||||||
boolean isPureVirtual,
|
boolean isPureVirtual,
|
||||||
ASTAccessVisibility visibility, List constructorChain, boolean isFunctionDefinition ) throws ASTSemanticException
|
List constructorChain,
|
||||||
|
boolean isFunctionDefinition ) throws ASTSemanticException
|
||||||
{
|
{
|
||||||
List references = new ArrayList();
|
List references = new ArrayList();
|
||||||
IContainerSymbol ownerScope = scopeToSymbol( scope );
|
IContainerSymbol ownerScope = scopeToSymbol( scope );
|
||||||
|
@ -1437,7 +1442,12 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
||||||
if(parentSymbol == null){
|
if(parentSymbol == null){
|
||||||
parentSymbol = (IContainerSymbol) lookupQualifiedName(parentScope, token, TypeInfo.t_namespace, null, offset, references, false);
|
parentSymbol = (IContainerSymbol) lookupQualifiedName(parentScope, token, TypeInfo.t_namespace, null, offset, references, false);
|
||||||
}
|
}
|
||||||
if(parentSymbol == null)
|
if(parentSymbol == null){
|
||||||
|
parentSymbol = (IContainerSymbol) lookupQualifiedName(parentScope, token, TypeInfo.t_struct, null, offset, references, false);
|
||||||
|
}
|
||||||
|
if(parentSymbol == null){
|
||||||
|
parentSymbol = (IContainerSymbol) lookupQualifiedName(parentScope, token, TypeInfo.t_union, null, offset, references, false);
|
||||||
|
} if(parentSymbol == null)
|
||||||
break;
|
break;
|
||||||
else {
|
else {
|
||||||
parentScope = parentSymbol;
|
parentScope = parentSymbol;
|
||||||
|
@ -1445,12 +1455,16 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if((parentScope != null) && (parentScope.getType() == TypeInfo.t_class)){
|
if((parentScope != null) &&
|
||||||
IASTClassSpecifier methodParentScope = (IASTClassSpecifier)parentScope.getASTExtension().getPrimaryDeclaration();
|
( (parentScope.getType() == TypeInfo.t_class)
|
||||||
|
|| (parentScope.getType() == TypeInfo.t_struct)
|
||||||
|
|| (parentScope.getType() == TypeInfo.t_union))
|
||||||
|
){
|
||||||
|
IASTScope methodParentScope = (IASTScope)parentScope.getASTExtension().getPrimaryDeclaration();
|
||||||
return createMethod(methodParentScope, functionName,nameEndOffset, parameters, returnType,
|
return createMethod(methodParentScope, functionName,nameEndOffset, parameters, returnType,
|
||||||
exception, isInline, isFriend, isStatic, startOffset, offset,
|
exception, isInline, isFriend, isStatic, startOffset, offset,
|
||||||
ownerTemplate, isConst, isVolatile, isVirtual, isExplicit, isPureVirtual,
|
ownerTemplate, isConst, isVolatile, isVirtual, isExplicit, isPureVirtual,
|
||||||
visibility, constructorChain, references, isFunctionDefinition);
|
ASTAccessVisibility.PRIVATE, constructorChain, references, isFunctionDefinition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1852,6 +1866,59 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
||||||
int nameOffset, IASTExpression constructorExpression) throws ASTSemanticException
|
int nameOffset, IASTExpression constructorExpression) throws ASTSemanticException
|
||||||
{
|
{
|
||||||
List references = new ArrayList();
|
List references = new ArrayList();
|
||||||
|
IContainerSymbol ownerScope = scopeToSymbol( scope );
|
||||||
|
|
||||||
|
// check if this is a scoped field, not a variable
|
||||||
|
StringTokenizer tokenizer = new StringTokenizer(name,DOUBLE_COLON);
|
||||||
|
int tokencount = tokenizer.countTokens();
|
||||||
|
if(tokencount > 1){
|
||||||
|
List tokens = new ArrayList();
|
||||||
|
String oneToken = "";
|
||||||
|
// This is NOT a function. This is a method definition
|
||||||
|
while (tokenizer.hasMoreTokens()){
|
||||||
|
oneToken = tokenizer.nextToken();
|
||||||
|
tokens.add(oneToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
String fieldName = oneToken;
|
||||||
|
String parentName = name.substring(0, name.lastIndexOf(DOUBLE_COLON));
|
||||||
|
|
||||||
|
int numOfTokens = 1;
|
||||||
|
int offset = nameOffset;
|
||||||
|
IContainerSymbol parentScope = ownerScope;
|
||||||
|
Iterator i = tokens.iterator();
|
||||||
|
while (i.hasNext() && (numOfTokens++) < tokens.size()){
|
||||||
|
String token = (String) i.next();
|
||||||
|
IContainerSymbol parentSymbol =
|
||||||
|
(IContainerSymbol) lookupQualifiedName(parentScope, token, TypeInfo.t_class, null, offset, references, false);
|
||||||
|
if(parentSymbol == null){
|
||||||
|
parentSymbol = (IContainerSymbol) lookupQualifiedName(parentScope, token, TypeInfo.t_namespace, null, offset, references, false);
|
||||||
|
}
|
||||||
|
if(parentSymbol == null){
|
||||||
|
parentSymbol = (IContainerSymbol) lookupQualifiedName(parentScope, token, TypeInfo.t_struct, null, offset, references, false);
|
||||||
|
}
|
||||||
|
if(parentSymbol == null){
|
||||||
|
parentSymbol = (IContainerSymbol) lookupQualifiedName(parentScope, token, TypeInfo.t_union, null, offset, references, false);
|
||||||
|
}
|
||||||
|
if(parentSymbol == null)
|
||||||
|
break;
|
||||||
|
else {
|
||||||
|
parentScope = parentSymbol;
|
||||||
|
offset += token.length()+ DOUBLE_COLON.length();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if((parentScope != null) &&
|
||||||
|
( (parentScope.getType() == TypeInfo.t_class)
|
||||||
|
|| (parentScope.getType() == TypeInfo.t_struct)
|
||||||
|
|| (parentScope.getType() == TypeInfo.t_union))
|
||||||
|
){
|
||||||
|
IASTScope fieldParentScope = (IASTScope)parentScope.getASTExtension().getPrimaryDeclaration();
|
||||||
|
return createField(fieldParentScope, fieldName,isAuto, initializerClause, bitfieldExpression, abstractDeclaration, isMutable, isExtern,
|
||||||
|
isRegister, isStatic, startingOffset, offset, constructorExpression, ASTAccessVisibility.PRIVATE, references);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ISymbol newSymbol = cloneSimpleTypeSymbol(name, abstractDeclaration, references);
|
ISymbol newSymbol = cloneSimpleTypeSymbol(name, abstractDeclaration, references);
|
||||||
setVariableTypeInfoBits(
|
setVariableTypeInfoBits(
|
||||||
isAuto,
|
isAuto,
|
||||||
|
@ -1862,16 +1929,28 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
||||||
isStatic,
|
isStatic,
|
||||||
newSymbol);
|
newSymbol);
|
||||||
setPointerOperators( newSymbol, abstractDeclaration.getPointerOperators(), abstractDeclaration.getArrayModifiers() );
|
setPointerOperators( newSymbol, abstractDeclaration.getPointerOperators(), abstractDeclaration.getArrayModifiers() );
|
||||||
|
|
||||||
|
newSymbol.setIsForwardDeclaration(isStatic);
|
||||||
|
boolean previouslyDeclared = false;
|
||||||
|
if(!isStatic){
|
||||||
|
ISymbol variableDeclaration = (ISymbol) lookupQualifiedName(ownerScope, name, new ArrayList(), false);
|
||||||
|
|
||||||
|
if( variableDeclaration != null )
|
||||||
|
{
|
||||||
|
variableDeclaration.setTypeSymbol( newSymbol );
|
||||||
|
previouslyDeclared = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
scopeToSymbol(scope).addSymbol( newSymbol );
|
ownerScope.addSymbol( newSymbol );
|
||||||
}
|
}
|
||||||
catch (ParserSymbolTableException e)
|
catch (ParserSymbolTableException e)
|
||||||
{
|
{
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
}
|
}
|
||||||
|
|
||||||
ASTVariable variable = new ASTVariable( newSymbol, abstractDeclaration, initializerClause, bitfieldExpression, startingOffset, nameOffset, references, constructorExpression );
|
ASTVariable variable = new ASTVariable( newSymbol, abstractDeclaration, initializerClause, bitfieldExpression, startingOffset, nameOffset, references, constructorExpression, previouslyDeclared );
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
attachSymbolExtension(newSymbol, variable );
|
attachSymbolExtension(newSymbol, variable );
|
||||||
|
@ -1931,6 +2010,25 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createField(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, boolean, org.eclipse.cdt.core.parser.ast.IASTInitializerClause, org.eclipse.cdt.core.parser.ast.IASTExpression, org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration, boolean, boolean, boolean, boolean, int, int, org.eclipse.cdt.core.parser.ast.ASTAccessVisibility)
|
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createField(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, boolean, org.eclipse.cdt.core.parser.ast.IASTInitializerClause, org.eclipse.cdt.core.parser.ast.IASTExpression, org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration, boolean, boolean, boolean, boolean, int, int, org.eclipse.cdt.core.parser.ast.ASTAccessVisibility)
|
||||||
*/
|
*/
|
||||||
|
public IASTField createField(
|
||||||
|
IASTScope scope,
|
||||||
|
String name,
|
||||||
|
boolean isAuto,
|
||||||
|
IASTInitializerClause initializerClause,
|
||||||
|
IASTExpression bitfieldExpression,
|
||||||
|
IASTAbstractDeclaration abstractDeclaration,
|
||||||
|
boolean isMutable,
|
||||||
|
boolean isExtern,
|
||||||
|
boolean isRegister,
|
||||||
|
boolean isStatic,
|
||||||
|
int startingOffset,
|
||||||
|
int nameOffset,
|
||||||
|
IASTExpression constructorExpression, ASTAccessVisibility visibility) throws ASTSemanticException
|
||||||
|
{
|
||||||
|
return createField(scope, name,isAuto, initializerClause, bitfieldExpression, abstractDeclaration, isMutable, isExtern,
|
||||||
|
isRegister, isStatic, startingOffset, nameOffset, constructorExpression, visibility, null);
|
||||||
|
}
|
||||||
|
|
||||||
public IASTField createField(
|
public IASTField createField(
|
||||||
IASTScope scope,
|
IASTScope scope,
|
||||||
String name,
|
String name,
|
||||||
|
@ -1944,9 +2042,14 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
||||||
boolean isStatic,
|
boolean isStatic,
|
||||||
int startingOffset,
|
int startingOffset,
|
||||||
int nameOffset,
|
int nameOffset,
|
||||||
IASTExpression constructorExpression, ASTAccessVisibility visibility) throws ASTSemanticException
|
IASTExpression constructorExpression,
|
||||||
|
ASTAccessVisibility visibility,
|
||||||
|
List references) throws ASTSemanticException
|
||||||
{
|
{
|
||||||
List references = new ArrayList();
|
IContainerSymbol ownerScope = scopeToSymbol( scope );
|
||||||
|
|
||||||
|
if(references == null)
|
||||||
|
references = new ArrayList();
|
||||||
ISymbol newSymbol = cloneSimpleTypeSymbol(name, abstractDeclaration, references);
|
ISymbol newSymbol = cloneSimpleTypeSymbol(name, abstractDeclaration, references);
|
||||||
setVariableTypeInfoBits(
|
setVariableTypeInfoBits(
|
||||||
isAuto,
|
isAuto,
|
||||||
|
@ -1958,16 +2061,32 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
||||||
newSymbol);
|
newSymbol);
|
||||||
setPointerOperators( newSymbol, abstractDeclaration.getPointerOperators(), abstractDeclaration.getArrayModifiers() );
|
setPointerOperators( newSymbol, abstractDeclaration.getPointerOperators(), abstractDeclaration.getArrayModifiers() );
|
||||||
|
|
||||||
|
newSymbol.setIsForwardDeclaration(isStatic);
|
||||||
|
boolean previouslyDeclared = false;
|
||||||
|
if(!isStatic){
|
||||||
|
List fieldReferences = new ArrayList();
|
||||||
|
ISymbol fieldDeclaration = lookupQualifiedName(ownerScope, name, fieldReferences, false);
|
||||||
|
|
||||||
|
if( fieldDeclaration != null )
|
||||||
|
{
|
||||||
|
previouslyDeclared = true;
|
||||||
|
fieldDeclaration.setTypeSymbol( newSymbol );
|
||||||
|
// set the definition visibility = declaration visibility
|
||||||
|
ASTReference reference = (ASTReference) fieldReferences.iterator().next();
|
||||||
|
visibility = ((IASTField)reference.getReferencedElement()).getVisiblity();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
scopeToSymbol(scope).addSymbol( newSymbol );
|
ownerScope.addSymbol( newSymbol );
|
||||||
}
|
}
|
||||||
catch (ParserSymbolTableException e)
|
catch (ParserSymbolTableException e)
|
||||||
{
|
{
|
||||||
throw new ASTSemanticException();
|
throw new ASTSemanticException();
|
||||||
}
|
}
|
||||||
|
|
||||||
ASTField field = new ASTField( newSymbol, abstractDeclaration, initializerClause, bitfieldExpression, startingOffset, nameOffset, references, constructorExpression, visibility );
|
ASTField field = new ASTField( newSymbol, abstractDeclaration, initializerClause, bitfieldExpression, startingOffset, nameOffset, references, previouslyDeclared, constructorExpression, visibility );
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
attachSymbolExtension(newSymbol, field );
|
attachSymbolExtension(newSymbol, field );
|
||||||
|
|
|
@ -188,7 +188,7 @@ public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createFunction(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, java.util.List, org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration, org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification, boolean, boolean, boolean, int, int, org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration)
|
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createFunction(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, java.util.List, org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration, org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification, boolean, boolean, boolean, int, int, org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration)
|
||||||
*/
|
*/
|
||||||
public IASTFunction createFunction(IASTScope scope, String name, int nameEndOffset, List parameters, IASTAbstractDeclaration returnType, IASTExceptionSpecification exception, boolean isInline, boolean isFriend, boolean isStatic, int startOffset, int nameOffset, IASTTemplate ownerTemplate, boolean isConst, boolean isVolatile, boolean isVirtual, boolean isExplicit, boolean isPureVirtual, ASTAccessVisibility visibility, List constructorChain, boolean isFunctionDefinition )
|
public IASTFunction createFunction(IASTScope scope, String name, int nameEndOffset, List parameters, IASTAbstractDeclaration returnType, IASTExceptionSpecification exception, boolean isInline, boolean isFriend, boolean isStatic, int startOffset, int nameOffset, IASTTemplate ownerTemplate, boolean isConst, boolean isVolatile, boolean isVirtual, boolean isExplicit, boolean isPureVirtual, List constructorChain, boolean isFunctionDefinition )
|
||||||
{
|
{
|
||||||
return new ASTFunction(scope, name, nameEndOffset, parameters, returnType, exception, isInline, isFriend, isStatic, startOffset, nameOffset, ownerTemplate );
|
return new ASTFunction(scope, name, nameEndOffset, parameters, returnType, exception, isInline, isFriend, isStatic, startOffset, nameOffset, ownerTemplate );
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,10 @@
|
||||||
* src/org/eclipse/cdt/ui/dialogs/AbstractErrorParserBlock.java
|
* src/org/eclipse/cdt/ui/dialogs/AbstractErrorParserBlock.java
|
||||||
* src/org/eclipse/cdt/ui/dialogs/BinaryParserBlock.java
|
* src/org/eclipse/cdt/ui/dialogs/BinaryParserBlock.java
|
||||||
|
|
||||||
|
2003-09-23 Hoda Amer
|
||||||
|
Solution to bug#43143: Naming of Code Assist Menus/Tab are not consistent
|
||||||
|
changed both names to Content Assist. No tests provided.
|
||||||
|
|
||||||
2003-09-22 Bogdan Gheorghe
|
2003-09-22 Bogdan Gheorghe
|
||||||
Got rid of the C/C++ Project property page (only the indexer tab
|
Got rid of the C/C++ Project property page (only the indexer tab
|
||||||
was left). Here are the changes:
|
was left). Here are the changes:
|
||||||
|
|
|
@ -950,7 +950,7 @@ public class CEditorPreferencePage extends PreferencePage implements IWorkbenchP
|
||||||
item.setControl(createColorPage(folder));
|
item.setControl(createColorPage(folder));
|
||||||
|
|
||||||
item = new TabItem(folder, SWT.NONE);
|
item = new TabItem(folder, SWT.NONE);
|
||||||
item.setText("Code A&ssist");
|
item.setText("Content A&ssist");
|
||||||
item.setImage(CPluginImages.get(CPluginImages.IMG_OBJS_TUNIT));
|
item.setImage(CPluginImages.get(CPluginImages.IMG_OBJS_TUNIT));
|
||||||
item.setControl(createContentAssistPage(folder));
|
item.setControl(createContentAssistPage(folder));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue