diff --git a/core/org.eclipse.cdt.core.tests/ChangeLog b/core/org.eclipse.cdt.core.tests/ChangeLog index f6216b9df0d..698fb751741 100644 --- a/core/org.eclipse.cdt.core.tests/ChangeLog +++ b/core/org.eclipse.cdt.core.tests/ChangeLog @@ -1,3 +1,7 @@ +2003-08-28 Hoda Amer + - Added to completeParseASTTest testQualifiedNameReferences(), + testIsConstructor() and testIsDestructor(). + 2003-08-28 John Camelon Moved bug39535 from failedTests to quickParse success tests. diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java index cea6b8eb3fb..1ff68be1836 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java @@ -522,5 +522,39 @@ public class CompleteParseASTTest extends CompleteParseBaseTest IASTVariableReference maxRef = (IASTVariableReference) callback.getReferences().get(0); assertEquals( maxRef.getReferencedElement(), max ); } + + public void testQualifiedNameReferences() throws Exception + { + Iterator i = parse( "class A{ class B{ class C { public: int cMethod(); }; }; }; \n int A::B::C::cMethod() {}; \n" ).getDeclarations(); + IASTClassSpecifier classA = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier(); + Iterator j = getDeclarations(classA); + IASTClassSpecifier classB = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)j.next()).getTypeSpecifier(); + Iterator k = getDeclarations(classB); + IASTClassSpecifier classC = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)k.next()).getTypeSpecifier(); + + // Note : this used to be considered a function, not a method + IASTMethod method = (IASTMethod)i.next(); + + assertEquals( callback.getReferences().size(), 3 ); + Iterator references = callback.getReferences().iterator(); + assertEquals( ((IASTClassReference)references.next()).getReferencedElement(), classA ); + assertEquals( ((IASTClassReference)references.next()).getReferencedElement(), classB ); + assertEquals( ((IASTClassReference)references.next()).getReferencedElement(), classC ); + } + public void testIsConstructor() throws Exception + { + Iterator i = parse( "class A{ public: A(); }; \n A::A() {}; \n" ).getDeclarations(); + IASTClassSpecifier classA = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier(); + IASTMethod method = (IASTMethod)i.next(); + assertTrue (method.isConstructor()); + } + + public void testIsDestructor() throws Exception + { + Iterator i = parse( "class A{ public: A(); }; \n A::~A() {}; \n" ).getDeclarations(); + IASTClassSpecifier classA = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier(); + IASTMethod method = (IASTMethod)i.next(); + assertTrue (method.isDestructor()); + } } diff --git a/core/org.eclipse.cdt.core/ChangeLog b/core/org.eclipse.cdt.core/ChangeLog index e41a4a1dec2..0d72ca80f5c 100644 --- a/core/org.eclipse.cdt.core/ChangeLog +++ b/core/org.eclipse.cdt.core/ChangeLog @@ -1,3 +1,13 @@ +2003-08-28 Hoda Amer + - Added resolving references in a method's qualified name + in Complete parse mode. + Example (.cpp file ): The method "A::B::C::aMethod(){};" + used to be an IASTFunction, with name = "A::B::C::aMethod". + Now is an IASTMethod, with name = "aMethod", and references to + class A, class B and class C. + - Added the checking for "isConstructor" and "isDestructor" + for an IASTMethod in complete parse mode. + 2003-08-26 Bogdan Gheorghe - Modified start up code to set debug trace options - Added trace debug statements to CModelBuilder. @@ -5,11 +15,10 @@ Util.debugLog clients (currently Parser and CModelBuidler) - Modified Util.java to make use of IDebugLogConstants - 2003-08-25 Hoda Amer Modified the IASTFactory to take three expression lists for the createNewDescriptor() instead of just one. - They are : newPlacementExpressions, typeIdExpressions, and + They are : newPlacementExpressions, newTypeIdExpressions, and newInitializerExpressions. 2003-08-25 John Camelon diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelBuilder.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelBuilder.java index e289c8d1d37..2c1bb208689 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelBuilder.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelBuilder.java @@ -110,8 +110,8 @@ public class CModelBuilder { catch( ParserException e ) { - System.out.println( "Parse Exception in Outline View" ); - e.printStackTrace(); + Util.debugLog( "Parse Exception in CModelBuilder", IDebugLogConstants.MODEL ); + //e.printStackTrace(); } long startTime = System.currentTimeMillis(); try @@ -120,8 +120,8 @@ public class CModelBuilder { } catch( NullPointerException npe ) { - System.out.println( "NullPointer exception generating CModel"); - npe.printStackTrace(); + Util.debugLog( "NullPointer exception in CModelBuilder", IDebugLogConstants.MODEL); + //npe.printStackTrace(); } // For the debuglog to take place, you have to call diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/MethodDeclaration.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/MethodDeclaration.java index 7d900e1a476..f54ac6c7c6e 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/MethodDeclaration.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/MethodDeclaration.java @@ -30,13 +30,13 @@ public class MethodDeclaration extends FunctionDeclaration implements IMethodDec } public boolean isConstructor(){ - // Still a problem with the parser + // is not implemented in the parser's quick mode //return isConstructor; return getElementName().equals(getParent().getElementName()); } public boolean isDestructor() { - // still a problem with the parser + // is not implemented in the parser's quick mode //return isDestructor; return getElementName().startsWith("~"); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTFactory.java index b37f30b0221..f8111864ee8 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTFactory.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTFactory.java @@ -143,7 +143,13 @@ public interface IASTFactory boolean isStatic, int startOffset, int nameOffset, - IASTTemplate ownerTemplate) throws ASTSemanticException; + IASTTemplate ownerTemplate, + boolean isConst, + boolean isVolatile, + boolean isVirtual, + boolean isExplicit, + boolean isPureVirtual, + ASTAccessVisibility visibility, List constructorChain) throws ASTSemanticException; public IASTAbstractDeclaration createAbstractDeclaration( boolean isConst, boolean isVolatile, @@ -163,8 +169,6 @@ public interface IASTFactory IASTTemplate ownerTemplate, boolean isConst, boolean isVolatile, - boolean isConstructor, - boolean isDestructor, boolean isVirtual, boolean isExplicit, boolean isPureVirtual, @@ -189,4 +193,7 @@ public interface IASTFactory public IASTAbstractTypeSpecifierDeclaration createTypeSpecDeclaration( IASTScope scope, IASTTypeSpecifier typeSpecifier, IASTTemplate template, int startingOffset, int endingOffset); + static final String DOUBLE_COLON = "::"; + static final String TELTA = "~"; + } \ No newline at end of file diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/DeclarationWrapper.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/DeclarationWrapper.java index 1be6445f73d..d9979c87e5e 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/DeclarationWrapper.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/DeclarationWrapper.java @@ -15,6 +15,7 @@ import java.util.Iterator; import java.util.List; import org.eclipse.cdt.core.parser.ITokenDuple; +import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility; import org.eclipse.cdt.core.parser.ast.ASTPointerOperator; import org.eclipse.cdt.core.parser.ast.ASTSemanticException; import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration; @@ -431,13 +432,10 @@ public class DeclarationWrapper implements IDeclaratorOwner templateDeclaration, declarator.isConst(), declarator.isVolatile(), - false, - // isConstructor - false, // isDestructor - virtual, - explicit, - declarator.isPureVirtual(), - ((IASTClassSpecifier)scope).getCurrentVisibilityMode(), declarator.getConstructorMemberInitializers()); + virtual, + explicit, + declarator.isPureVirtual(), + ((IASTClassSpecifier)scope).getCurrentVisibilityMode(), declarator.getConstructorMemberInitializers()); } /** * @param declarator @@ -460,7 +458,14 @@ public class DeclarationWrapper implements IDeclaratorOwner staticc, startingOffset, declarator.getNameStartOffset(), - templateDeclaration); + templateDeclaration, + declarator.isConst(), + declarator.isVolatile(), + virtual, + explicit, + declarator.isPureVirtual(), + ASTAccessVisibility.PUBLIC, + declarator.getConstructorMemberInitializers()); } /** * @param declarator diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java index bb5e968e9c1..6643240870e 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java @@ -12,7 +12,9 @@ package org.eclipse.cdt.internal.core.parser.ast.complete; import java.util.ArrayList; import java.util.Iterator; +import java.util.LinkedList; import java.util.List; +import java.util.StringTokenizer; import org.eclipse.cdt.core.parser.IToken; import org.eclipse.cdt.core.parser.ITokenDuple; @@ -82,11 +84,47 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto /** * */ + public CompleteParseASTFactory() { super(); } + protected ISymbol lookupQualifiedName( IContainerSymbol startingScope, String name, TypeInfo.eType type, List parameters, int offset, List references, boolean throwOnError ) throws ASTSemanticException + { + ISymbol result = null; + try + { + if( name == null ) throw new ASTSemanticException(); + try + { + if(type == TypeInfo.t_function){ + // looking for a function + result = startingScope.qualifiedFunctionLookup(name, new LinkedList(parameters)); + }else{ + // looking for a class + result = startingScope.qualifiedLookup(name, type); + } + if( result != null ) + references.add( createReference( result, name, offset )); + else + throw new ASTSemanticException(); + } + catch (ParserSymbolTableException e) + { + throw new ASTSemanticException(); + } + + } + catch( ASTSemanticException se ) + { + if( throwOnError ) + throw se; + return null; + } + return result; + + } protected ISymbol lookupQualifiedName( IContainerSymbol startingScope, ITokenDuple name, List references, boolean throwOnError ) throws ASTSemanticException { @@ -833,51 +871,107 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto } /* (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.IASTTemplate) - */ - public IASTFunction createFunction( - IASTScope scope, - String name, - List parameters, - IASTAbstractDeclaration returnType, - IASTExceptionSpecification exception, - boolean isInline, - boolean isFriend, - boolean isStatic, - int startOffset, - int nameOffset, - IASTTemplate ownerTemplate) throws ASTSemanticException - { - IContainerSymbol ownerScope = scopeToSymbol( scope ); - IParameterizedSymbol symbol = pst.newParameterizedSymbol( name, TypeInfo.t_function ); - setFunctionTypeInfoBits(isInline, isFriend, isStatic, symbol); - List references = new ArrayList(); - + * @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.IASTTemplate) + */ + public IASTFunction createFunction( + IASTScope scope, + String name, + 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) throws ASTSemanticException + { + List references = new ArrayList(); + IContainerSymbol ownerScope = scopeToSymbol( scope ); + + // check if this is a method in a body file + 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 functionName = 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) + break; + else { + parentScope = parentSymbol; + offset += token.length()+ DOUBLE_COLON.length(); + } + } + + if((parentScope != null) && (parentScope.getType() == TypeInfo.t_class)){ + // find out the visibility of the method's declaration + List functionReferences = new ArrayList(); + IParameterizedSymbol methodDeclaration = + (IParameterizedSymbol) lookupQualifiedName(parentScope, functionName, TypeInfo.t_function, parameters, 0, functionReferences, false); + if(methodDeclaration != null){ + ASTMethodReference reference = (ASTMethodReference) functionReferences.iterator().next(); + visibility = ((IASTMethod)reference.getReferencedElement()).getVisiblity(); + } + return createMethod(scope, functionName, parameters, returnType, + exception, isInline, isFriend, isStatic, startOffset, offset, + ownerTemplate, isConst, isVolatile, isVirtual, isExplicit, isPureVirtual, + visibility, constructorChain,parentName, references); + } + } + + IParameterizedSymbol symbol = pst.newParameterizedSymbol( name, TypeInfo.t_function ); + setFunctionTypeInfoBits(isInline, isFriend, isStatic, symbol); + setParameter( symbol, returnType, false, references ); setParameters( symbol, references, parameters.iterator() ); - - - try - { - ownerScope.addSymbol( symbol ); - } - catch (ParserSymbolTableException e) - { - throw new ASTSemanticException(); - } - - - ASTFunction function = new ASTFunction( symbol, parameters, returnType, exception, startOffset, nameOffset, ownerTemplate, references ); - try - { - attachSymbolExtension(symbol, function); - } - catch (ExtensionException e1) - { - throw new ASTSemanticException(); - } - return function; - } + + try + { + ownerScope.addSymbol( symbol ); + } + catch (ParserSymbolTableException e) + { + throw new ASTSemanticException(); + } + ASTFunction function = new ASTFunction( symbol, parameters, returnType, exception, startOffset, nameOffset, ownerTemplate, references ); + try + { + attachSymbolExtension(symbol, function); + } + catch (ExtensionException e1) + { + throw new ASTSemanticException(); + } + return function; + } + protected void setFunctionTypeInfoBits( boolean isInline, boolean isFriend, @@ -1019,6 +1113,33 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createMethod(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.IASTTemplate, boolean, boolean, boolean, boolean, boolean, boolean, boolean, org.eclipse.cdt.core.parser.ast.ASTAccessVisibility) */ + + public IASTMethod createMethod( + IASTScope scope, + String name, + 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) throws ASTSemanticException + { + return createMethod(scope, name, parameters, returnType, + exception, isInline, isFriend, isStatic, startOffset, nameOffset, + ownerTemplate, isConst, isVolatile, isVirtual, isExplicit, isPureVirtual, + visibility, constructorChain,scopeToSymbol(scope).getName(), null); + } + public IASTMethod createMethod( IASTScope scope, String name, @@ -1033,18 +1154,23 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto IASTTemplate ownerTemplate, boolean isConst, boolean isVolatile, - boolean isConstructor, - boolean isDestructor, boolean isVirtual, boolean isExplicit, boolean isPureVirtual, - ASTAccessVisibility visibility, List constructorChain) throws ASTSemanticException + ASTAccessVisibility visibility, + List constructorChain, + String parentName, + List references) throws ASTSemanticException { + boolean isConstructor = false; + boolean isDestructor = false; + IContainerSymbol ownerScope = scopeToSymbol( scope ); IParameterizedSymbol symbol = pst.newParameterizedSymbol( name, TypeInfo.t_function ); setFunctionTypeInfoBits(isInline, isFriend, isStatic, symbol); setMethodTypeInfoBits( symbol, isConst, isVolatile, isVirtual, isExplicit ); - List references = new ArrayList(); + if(references == null) + references = new ArrayList(); if( returnType.getTypeSpecifier() != null ) setParameter( symbol, returnType, false, references ); @@ -1058,7 +1184,19 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto { throw new ASTSemanticException(); } - + + // check constructor / destructor if no return type + if ( returnType.getTypeSpecifier() == null ){ + if(parentName.indexOf(DOUBLE_COLON) != -1){ + parentName = parentName.substring(parentName.lastIndexOf(DOUBLE_COLON) + DOUBLE_COLON.length()); + } + if( parentName.equals(name) ){ + isConstructor = true; + } else if(name.startsWith(TELTA) && parentName.equals(name.substring(1))){ + isDestructor = true; + } + } + ASTMethod method = new ASTMethod( symbol, parameters, returnType, exception, startOffset, nameOffset, ownerTemplate, references, isConstructor, isDestructor, isPureVirtual, visibility, constructorChain ); try { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/QuickParseASTFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/QuickParseASTFactory.java index dbb33f07443..8b5ef8ce5d6 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/QuickParseASTFactory.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/QuickParseASTFactory.java @@ -187,7 +187,7 @@ public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory /* (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) */ - public IASTFunction createFunction(IASTScope scope, String name, List parameters, IASTAbstractDeclaration returnType, IASTExceptionSpecification exception, boolean isInline, boolean isFriend, boolean isStatic, int startOffset, int nameOffset, IASTTemplate ownerTemplate) + public IASTFunction createFunction(IASTScope scope, String name, 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) { return new ASTFunction(scope, name, parameters, returnType, exception, isInline, isFriend, isStatic, startOffset, nameOffset, ownerTemplate ); } @@ -195,9 +195,9 @@ public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createMethod(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, boolean, boolean, boolean, boolean, boolean, boolean, boolean, org.eclipse.cdt.core.parser.ast.ASTAccessVisibility) */ - public IASTMethod createMethod(IASTScope scope, String name, List parameters, IASTAbstractDeclaration returnType, IASTExceptionSpecification exception, boolean isInline, boolean isFriend, boolean isStatic, int startOffset, int nameOffset, IASTTemplate ownerTemplate, boolean isConst, boolean isVolatile, boolean isConstructor, boolean isDestructor, boolean isVirtual, boolean isExplicit, boolean isPureVirtual, ASTAccessVisibility visibility, List constructorChain) - { - return new ASTMethod(scope, name, parameters, returnType, exception, isInline, isFriend, isStatic, startOffset, nameOffset, ownerTemplate, isConst, isVolatile, isConstructor, isDestructor, isVirtual, isExplicit, isPureVirtual, visibility, constructorChain); + public IASTMethod createMethod(IASTScope scope, String name, 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) + { + return new ASTMethod(scope, name, parameters, returnType, exception, isInline, isFriend, isStatic, startOffset, nameOffset, ownerTemplate, isConst, isVolatile, false, false, isVirtual, isExplicit, isPureVirtual, visibility, constructorChain); } /* (non-Javadoc) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/IContainerSymbol.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/IContainerSymbol.java index f266de7dabe..3e3484bdb4a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/IContainerSymbol.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/IContainerSymbol.java @@ -46,6 +46,7 @@ public interface IContainerSymbol extends ISymbol { public ISymbol lookupMemberForDefinition( String name ) throws ParserSymbolTableException; public IContainerSymbol lookupNestedNameSpecifier( String name ) throws ParserSymbolTableException; public ISymbol qualifiedLookup( String name ) throws ParserSymbolTableException; + public ISymbol qualifiedLookup( String name, TypeInfo.eType t ) throws ParserSymbolTableException; public IParameterizedSymbol unqualifiedFunctionLookup( String name, LinkedList parameters ) throws ParserSymbolTableException; public IParameterizedSymbol memberFunctionLookup( String name, LinkedList parameters ) throws ParserSymbolTableException; public IParameterizedSymbol qualifiedFunctionLookup( String name, LinkedList parameters ) throws ParserSymbolTableException; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ParserSymbolTable.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ParserSymbolTable.java index 2e447c1557d..e0ae598b659 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ParserSymbolTable.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ParserSymbolTable.java @@ -3021,7 +3021,12 @@ public class ParserSymbolTable { } public ISymbol qualifiedLookup( String name ) throws ParserSymbolTableException{ - LookupData data = new LookupData( name, TypeInfo.t_any, getTemplateInstance() ); + + return qualifiedLookup(name, TypeInfo.t_any); + } + + public ISymbol qualifiedLookup( String name, TypeInfo.eType t ) throws ParserSymbolTableException{ + LookupData data = new LookupData( name, t, getTemplateInstance() ); data.qualified = true; ParserSymbolTable.lookup( data, this );