Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 57170 Details for
Bug 169860
Port Content Assist to PDOM
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
proposed patch
content_assist_patch.txt (text/plain), 115.70 KB, created by
Bryan Wilkinson
on 2007-01-19 15:23:59 EST
(
hide
)
Description:
proposed patch
Filename:
MIME Type:
Creator:
Bryan Wilkinson
Created:
2007-01-19 15:23:59 EST
Size:
115.70 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.cdt.ui >Index: src/org/eclipse/cdt/internal/ui/text/contentassist/CCompletionProcessor2.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CCompletionProcessor2.java,v >retrieving revision 1.35 >diff -u -r1.35 CCompletionProcessor2.java >--- src/org/eclipse/cdt/internal/ui/text/contentassist/CCompletionProcessor2.java 18 Dec 2006 19:16:18 -0000 1.35 >+++ src/org/eclipse/cdt/internal/ui/text/contentassist/CCompletionProcessor2.java 19 Jan 2007 20:07:43 -0000 >@@ -29,9 +29,11 @@ > import org.eclipse.ui.IEditorPart; > > import org.eclipse.cdt.core.CCorePlugin; >+import org.eclipse.cdt.core.dom.IPDOMManager; > import org.eclipse.cdt.core.dom.ast.ASTCompletionNode; > import org.eclipse.cdt.core.index.IIndex; > import org.eclipse.cdt.core.index.IIndexManager; >+import org.eclipse.cdt.core.model.ITranslationUnit; > import org.eclipse.cdt.core.model.IWorkingCopy; > import org.eclipse.cdt.ui.CUIPlugin; > import org.eclipse.cdt.ui.text.ICCompletionProposal; >@@ -78,11 +80,14 @@ > String prefix = null; > > if (workingCopy != null) { >- // TODO, to improve performance, we want to skip all headers >- // But right now we're not getting any completions >-// fCurrentCompletionNode = workingCopy.getCompletionNode(index, ITranslationUnit.AST_SKIP_ALL_HEADERS, offset); >- fCurrentCompletionNode = workingCopy.getCompletionNode(index, 0, offset); >- >+ IPDOMManager manager = CCorePlugin.getPDOMManager(); >+ String indexerId = manager.getIndexerId(workingCopy.getCProject()); >+ int flags = ITranslationUnit.AST_SKIP_ALL_HEADERS; >+ if (IPDOMManager.ID_NO_INDEXER.equals(indexerId)) { >+ flags = 0; >+ } >+ fCurrentCompletionNode = workingCopy.getCompletionNode(index, flags, offset); >+ > if (fCurrentCompletionNode != null) > prefix = fCurrentCompletionNode.getPrefix(); > } >Index: src/org/eclipse/cdt/internal/ui/text/contentassist/DOMCompletionContributor.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/DOMCompletionContributor.java,v >retrieving revision 1.33 >diff -u -r1.33 DOMCompletionContributor.java >--- src/org/eclipse/cdt/internal/ui/text/contentassist/DOMCompletionContributor.java 18 Jan 2007 11:08:45 -0000 1.33 >+++ src/org/eclipse/cdt/internal/ui/text/contentassist/DOMCompletionContributor.java 19 Jan 2007 20:07:43 -0000 >@@ -23,6 +23,7 @@ > import org.eclipse.cdt.core.dom.ast.ASTTypeUtil; > import org.eclipse.cdt.core.dom.ast.DOMException; > import org.eclipse.cdt.core.dom.ast.IASTFunctionStyleMacroParameter; >+import org.eclipse.cdt.core.dom.ast.IASTIdExpression; > import org.eclipse.cdt.core.dom.ast.IASTName; > import org.eclipse.cdt.core.dom.ast.IASTPreprocessorFunctionStyleMacroDefinition; > import org.eclipse.cdt.core.dom.ast.IASTPreprocessorMacroDefinition; >@@ -48,6 +49,7 @@ > import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration; > import org.eclipse.cdt.core.model.IWorkingCopy; > import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility; >+import org.eclipse.cdt.core.parser.util.CharArrayUtils; > import org.eclipse.cdt.ui.CUIPlugin; > import org.eclipse.cdt.ui.text.contentassist.ICompletionContributor; > >@@ -61,7 +63,9 @@ > ASTCompletionNode completionNode, > String prefix, > List proposals) { >+ > if (completionNode != null) { >+ boolean handleMacros = false; > IASTName[] names = completionNode.getNames(); > if (names == null || names.length == 0) > // No names, not much we can do here >@@ -74,6 +78,7 @@ > // The node isn't properly hooked up, must have backtracked out of this node > continue; > IBinding[] bindings = names[i].resolvePrefix(); >+ if (names[i].getParent() instanceof IASTIdExpression) handleMacros = true; > if (bindings != null) > for (int j = 0; j < bindings.length; ++j) { > IBinding binding = bindings[j]; >@@ -91,11 +96,11 @@ > } > > // Find all macros if there is a prefix >- if (prefix.length() > 0) { >+ if (prefix.length() > 0 && handleMacros) { > IASTPreprocessorMacroDefinition[] macros = completionNode.getTranslationUnit().getMacroDefinitions(); > if (macros != null) > for (int i = 0; i < macros.length; ++i) >- if (macros[i].getName().toString().startsWith(prefix)) >+ if (CharArrayUtils.equals(macros[i].getName().toCharArray(), prefix.toCharArray(), true)) > handleMacro(macros[i], completionNode, offset, viewer, proposals); > } > } >#P org.eclipse.cdt.core >Index: parser/org/eclipse/cdt/core/dom/ast/gnu/cpp/GPPLanguage.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/gnu/cpp/GPPLanguage.java,v >retrieving revision 1.29 >diff -u -r1.29 GPPLanguage.java >--- parser/org/eclipse/cdt/core/dom/ast/gnu/cpp/GPPLanguage.java 5 Jan 2007 13:12:22 -0000 1.29 >+++ parser/org/eclipse/cdt/core/dom/ast/gnu/cpp/GPPLanguage.java 19 Jan 2007 20:07:45 -0000 >@@ -97,7 +97,8 @@ > scanner, > ParserMode.COMPLETION_PARSE, > ParserUtil.getParserLogService(), >- new GPPParserExtensionConfiguration()); >+ new GPPParserExtensionConfiguration(), >+ index); > > // Run the parse and return the completion node > parser.parse(); >Index: parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPVisitor.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPVisitor.java,v >retrieving revision 1.139 >diff -u -r1.139 CPPVisitor.java >--- parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPVisitor.java 15 Dec 2006 16:44:57 -0000 1.139 >+++ parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPVisitor.java 19 Jan 2007 20:07:46 -0000 >@@ -1804,7 +1804,7 @@ > if( op == IASTUnaryExpression.op_sizeof ){ > IScope scope = getContainingScope( expression ); > try { >- IBinding [] bs = scope.find( SIZE_T ); >+ IBinding [] bs = scope.find( SIZE_T, false ); > if( bs.length > 0 && bs[0] instanceof IType ){ > return (IType) bs[0]; > } >@@ -1859,7 +1859,7 @@ > if( typeidExp.getOperator() == IASTTypeIdExpression.op_sizeof ){ > IScope scope = getContainingScope( typeidExp ); > try { >- IBinding [] bs = scope.find( SIZE_T ); >+ IBinding [] bs = scope.find( SIZE_T, false ); > if( bs.length > 0 && bs[0] instanceof IType ){ > return (IType) bs[0]; > } >Index: parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassInstanceScope.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassInstanceScope.java,v >retrieving revision 1.16 >diff -u -r1.16 CPPClassInstanceScope.java >--- parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassInstanceScope.java 16 Nov 2006 21:35:42 -0000 1.16 >+++ parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassInstanceScope.java 19 Jan 2007 20:07:45 -0000 >@@ -242,7 +242,7 @@ > /* (non-Javadoc) > * @see org.eclipse.cdt.core.dom.ast.IScope#find(java.lang.String) > */ >- public IBinding[] find(String name) { >+ public IBinding[] find(String name, boolean prefixLookup) { > if( name != null ) {} > return null; > } >Index: parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPScope.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPScope.java,v >retrieving revision 1.24 >diff -u -r1.24 CPPScope.java >--- parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPScope.java 6 Dec 2006 10:41:25 -0000 1.24 >+++ parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPScope.java 19 Jan 2007 20:07:45 -0000 >@@ -200,8 +200,8 @@ > /* (non-Javadoc) > * @see org.eclipse.cdt.core.dom.ast.IScope#find(java.lang.String) > */ >- public IBinding[] find(String name) throws DOMException { >- return CPPSemantics.findBindings( this, name, false ); >+ public IBinding[] find(String name, boolean prefixLookup) throws DOMException { >+ return CPPSemantics.findBindings( this, name, false, prefixLookup ); > } > > public void flushCache() { >Index: parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleDeclaration.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleDeclaration.java,v >retrieving revision 1.6 >diff -u -r1.6 CPPASTSimpleDeclaration.java >--- parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleDeclaration.java 31 Oct 2006 10:08:55 -0000 1.6 >+++ parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleDeclaration.java 19 Jan 2007 20:07:45 -0000 >@@ -14,14 +14,17 @@ > import org.eclipse.cdt.core.dom.ast.ASTVisitor; > import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier; > import org.eclipse.cdt.core.dom.ast.IASTDeclarator; >+import org.eclipse.cdt.core.dom.ast.IASTName; > import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration; >+import org.eclipse.cdt.core.dom.ast.IBinding; > import org.eclipse.cdt.core.parser.util.ArrayUtil; >+import org.eclipse.cdt.internal.core.dom.parser.IASTCompletionContext; > > /** > * @author jcamelon > */ > public class CPPASTSimpleDeclaration extends CPPASTNode implements >- IASTSimpleDeclaration { >+ IASTSimpleDeclaration, IASTCompletionContext { > > /* (non-Javadoc) > * @see org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration#getDeclSpecifier() >@@ -75,4 +78,11 @@ > return true; > } > >+ public IBinding[] resolvePrefix(IASTName n) { >+ if (declSpecifier instanceof IASTCompletionContext) { >+ return ((IASTCompletionContext) declSpecifier).resolvePrefix(n); >+ } >+ return null; >+ } >+ > } >Index: parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTIdExpression.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTIdExpression.java,v >retrieving revision 1.6 >diff -u -r1.6 CPPASTIdExpression.java >--- parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTIdExpression.java 14 Jun 2006 12:16:08 -0000 1.6 >+++ parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTIdExpression.java 19 Jan 2007 20:07:45 -0000 >@@ -11,14 +11,21 @@ > package org.eclipse.cdt.internal.core.dom.parser.cpp; > > import org.eclipse.cdt.core.dom.ast.ASTVisitor; >+import org.eclipse.cdt.core.dom.ast.DOMException; > import org.eclipse.cdt.core.dom.ast.IASTIdExpression; > import org.eclipse.cdt.core.dom.ast.IASTName; >+import org.eclipse.cdt.core.dom.ast.IBinding; >+import org.eclipse.cdt.core.dom.ast.IScope; > import org.eclipse.cdt.core.dom.ast.IType; >+import org.eclipse.cdt.core.index.BindingFilter; >+import org.eclipse.cdt.core.index.IIndex; >+import org.eclipse.cdt.internal.core.dom.parser.IASTCompletionContext; >+import org.eclipse.core.runtime.CoreException; > > /** > * @author jcamelon > */ >-public class CPPASTIdExpression extends CPPASTNode implements IASTIdExpression { >+public class CPPASTIdExpression extends CPPASTNode implements IASTIdExpression, IASTCompletionContext { > private IASTName name; > > public IASTName getName() { >@@ -51,4 +58,31 @@ > return CPPVisitor.getExpressionType(this); > } > >+ public IBinding[] resolvePrefix(IASTName n) { >+ BindingFilter filter = new BindingFilter() { >+ protected boolean isValidBinding(IBinding binding) { >+ return true; >+ } >+ }; >+ >+ IScope scope = CPPVisitor.getContainingScope(n); >+ >+ try { >+ IBinding[] bindings = scope.find(n.toString(), true); >+ filter.handleBindings(bindings); >+ } catch (DOMException e) { >+ } >+ >+ IIndex index = getTranslationUnit().getIndex(); >+ >+ try { >+ index.filterBindings( >+ n.toCharArray(), >+ n.getLinkage(), >+ filter); >+ } catch (CoreException e) { >+ } >+ >+ return filter.getBindings(); >+ } > } >Index: parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSemantics.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSemantics.java,v >retrieving revision 1.147 >diff -u -r1.147 CPPSemantics.java >--- parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSemantics.java 15 Dec 2006 16:44:57 -0000 1.147 >+++ parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSemantics.java 19 Jan 2007 20:07:45 -0000 >@@ -127,6 +127,7 @@ > import org.eclipse.cdt.internal.core.dom.parser.ASTNode; > import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer; > import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding; >+import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding; > > /** > * @author aniefer >@@ -1375,6 +1376,12 @@ > IASTNode [] nodes = null; > IASTNode parent = ASTInternal.getPhysicalNodeOfScope(scope); > >+ if (parent == null && scope instanceof PDOMBinding) { >+ IBinding[] bindings = scope.find(data.astName.toString(), data.prefixLookup); >+ mergeResults(data, bindings, true); >+ return null; >+ } >+ > IASTName [] namespaceDefs = null; > int namespaceIdx = -1; > >@@ -1789,8 +1796,7 @@ > } > char[] c = potential.toCharArray(); > char [] n = data.name(); >- return ( (data.prefixLookup && CharArrayUtils.equals( c, 0, n.length, n )) || >- (!data.prefixLookup && CharArrayUtils.equals( c, n )) ); >+ return CharArrayUtils.equals( c, n, data.prefixLookup ); > } > > private static void addDefinition( IBinding binding, IASTName name ){ >@@ -3251,15 +3257,19 @@ > return null; > } > >- public static IBinding[] findBindings( IScope scope, String name, boolean qualified ) throws DOMException{ >- return findBindings( scope, name.toCharArray(), qualified ); >+ public static IBinding[] findBindings( IScope scope, String name, boolean qualified, boolean prefixLookup ) throws DOMException{ >+ return findBindings( scope, name.toCharArray(), qualified, prefixLookup ); > } >- public static IBinding[] findBindings( IScope scope, char []name, boolean qualified ) throws DOMException{ >+ public static IBinding[] findBindings( IScope scope, char []name, boolean qualified, boolean prefixLookup ) throws DOMException{ > CPPASTName astName = new CPPASTName(); > astName.setName( name ); > astName.setParent( ASTInternal.getPhysicalNodeOfScope(scope)); > astName.setPropertyInParent( STRING_LOOKUP_PROPERTY ); > >+ if (prefixLookup) { >+ return prefixLookup(astName, scope); >+ } >+ > LookupData data = new LookupData( astName ); > data.forceQualified = qualified; > >@@ -3296,13 +3306,17 @@ > return (IBinding[]) set.keyArray( IBinding.class ); > } > >- public static IBinding [] prefixLookup( IASTName name ){ >+ public static IBinding [] prefixLookup( IASTName name ){ >+ return prefixLookup(name, name); >+ } >+ >+ public static IBinding [] prefixLookup( IASTName name, Object start ){ > LookupData data = createLookupData( name, true ); > data.prefixLookup = true; > data.foundItems = new CharArrayObjectMap( 2 ); > > try { >- lookup( data, name ); >+ lookup( data, start ); > } catch ( DOMException e ) { > } > CharArrayObjectMap map = (CharArrayObjectMap) data.foundItems; >Index: parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionScope.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionScope.java,v >retrieving revision 1.17 >diff -u -r1.17 CPPFunctionScope.java >--- parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionScope.java 29 Sep 2006 07:19:43 -0000 1.17 >+++ parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPFunctionScope.java 19 Jan 2007 20:07:45 -0000 >@@ -14,6 +14,9 @@ > */ > package org.eclipse.cdt.internal.core.dom.parser.cpp; > >+import java.util.ArrayList; >+import java.util.List; >+ > import org.eclipse.cdt.core.dom.IName; > import org.eclipse.cdt.core.dom.ast.DOMException; > import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement; >@@ -31,6 +34,7 @@ > import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionScope; > import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace; > import org.eclipse.cdt.core.parser.util.CharArrayObjectMap; >+import org.eclipse.cdt.core.parser.util.CharArrayUtils; > > /** > * @author aniefer >@@ -71,12 +75,23 @@ > /* (non-Javadoc) > * @see org.eclipse.cdt.core.dom.ast.IScope#find(java.lang.String) > */ >- public IBinding[] find(String name) throws DOMException { >+ public IBinding[] find(String name, boolean prefixLookup) throws DOMException { > char [] n = name.toCharArray(); >- if( labels.containsKey( n ) ) >- return new IBinding[] { (IBinding) labels.get( n ) }; >- >- return super.find( name ); >+ List bindings = new ArrayList(); >+ >+ for (int i = 0; i < labels.size(); i++) { >+ char[] key = labels.keyAt(i); >+ if (CharArrayUtils.equals(key, n, prefixLookup)) { >+ bindings.add((IBinding) labels.get(key)); >+ } >+ } >+ >+ IBinding[] additional = super.find( name, prefixLookup ); >+ for (int i = 0; i < additional.length; i++) { >+ bindings.add(additional[i]); >+ } >+ >+ return (IBinding[]) bindings.toArray(new IBinding[bindings.size()]); > } > > public IScope getParent() throws DOMException { >Index: parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTUsingDirective.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTUsingDirective.java,v >retrieving revision 1.4 >diff -u -r1.4 CPPASTUsingDirective.java >--- parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTUsingDirective.java 23 Jun 2005 16:02:11 -0000 1.4 >+++ parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTUsingDirective.java 19 Jan 2007 20:07:45 -0000 >@@ -11,14 +11,23 @@ > package org.eclipse.cdt.internal.core.dom.parser.cpp; > > import org.eclipse.cdt.core.dom.ast.ASTVisitor; >+import org.eclipse.cdt.core.dom.ast.IASTDeclaration; > import org.eclipse.cdt.core.dom.ast.IASTName; >+import org.eclipse.cdt.core.dom.ast.IBinding; >+import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceDefinition; > import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTUsingDirective; >+import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace; >+import org.eclipse.cdt.core.index.BindingFilter; >+import org.eclipse.cdt.core.index.IIndex; >+import org.eclipse.cdt.core.parser.util.CharArrayUtils; >+import org.eclipse.cdt.internal.core.dom.parser.IASTCompletionContext; >+import org.eclipse.core.runtime.CoreException; > > /** > * @author jcamelon > */ > public class CPPASTUsingDirective extends CPPASTNode implements >- ICPPASTUsingDirective { >+ ICPPASTUsingDirective, IASTCompletionContext { > > private IASTName name; > >@@ -57,4 +66,36 @@ > return r_reference; > return r_unclear; > } >+ >+ public IBinding[] resolvePrefix(IASTName n) { >+ BindingFilter filter = new BindingFilter() { >+ protected boolean isValidBinding(IBinding binding) { >+ return binding instanceof ICPPNamespace; >+ } >+ }; >+ >+ IASTDeclaration[] decls = getTranslationUnit().getDeclarations(); >+ for (int i = 0; i < decls.length; i++) { >+ if (decls[i] instanceof ICPPASTNamespaceDefinition) { >+ ICPPASTNamespaceDefinition defn = (ICPPASTNamespaceDefinition) decls[i]; >+ IASTName name = defn.getName(); >+ if (CharArrayUtils.equals(name.toCharArray(), n.toCharArray(), true)) { >+ IBinding binding = name.resolveBinding(); >+ filter.handleBinding(binding); >+ } >+ } >+ } >+ >+ IIndex index = getTranslationUnit().getIndex(); >+ >+ try { >+ index.filterBindings( >+ n.toCharArray(), >+ n.getLinkage(), >+ filter); >+ } catch (CoreException e) { >+ } >+ >+ return filter.getBindings(); >+ } > } >Index: parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCompositeTypeSpecifier.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCompositeTypeSpecifier.java,v >retrieving revision 1.12 >diff -u -r1.12 CPPASTCompositeTypeSpecifier.java >--- parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCompositeTypeSpecifier.java 31 Oct 2006 10:08:55 -0000 1.12 >+++ parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTCompositeTypeSpecifier.java 19 Jan 2007 20:07:45 -0000 >@@ -11,19 +11,26 @@ > package org.eclipse.cdt.internal.core.dom.parser.cpp; > > import org.eclipse.cdt.core.dom.ast.ASTVisitor; >+import org.eclipse.cdt.core.dom.ast.DOMException; > import org.eclipse.cdt.core.dom.ast.IASTDeclaration; > import org.eclipse.cdt.core.dom.ast.IASTName; > import org.eclipse.cdt.core.dom.ast.IASTNode; >+import org.eclipse.cdt.core.dom.ast.IBinding; > import org.eclipse.cdt.core.dom.ast.IScope; > import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier; >+import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType; >+import org.eclipse.cdt.core.index.BindingFilter; >+import org.eclipse.cdt.core.index.IIndex; > import org.eclipse.cdt.core.parser.util.ArrayUtil; > import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent; >+import org.eclipse.cdt.internal.core.dom.parser.IASTCompletionContext; >+import org.eclipse.core.runtime.CoreException; > > /** > * @author jcamelon > */ > public class CPPASTCompositeTypeSpecifier extends CPPASTBaseDeclSpecifier >- implements ICPPASTCompositeTypeSpecifier, IASTAmbiguityParent { >+ implements ICPPASTCompositeTypeSpecifier, IASTAmbiguityParent, IASTCompletionContext { > > private int k; > private IASTName n; >@@ -161,4 +168,42 @@ > } > } > } >+ >+ public IBinding[] resolvePrefix(IASTName n) { >+ BindingFilter filter = new BindingFilter(){ >+ public boolean isValidBinding(IBinding binding) { >+ if (binding instanceof ICPPClassType) { >+ ICPPClassType classType = (ICPPClassType) binding; >+ try { >+ int key = classType.getKey(); >+ if (key == ICPPClassType.k_class) { >+ return true; >+ } >+ } catch (DOMException e) { >+ } >+ } >+ return false; >+ } >+ }; >+ >+ IScope scope = CPPVisitor.getContainingScope(n); >+ >+ try { >+ IBinding[] bindings = scope.find(n.toString(), true); >+ filter.handleBindings(bindings); >+ } catch (DOMException e) { >+ } >+ >+ IIndex index = getTranslationUnit().getIndex(); >+ >+ try { >+ index.filterBindings( >+ n.toCharArray(), >+ n.getLinkage(), >+ filter); >+ } catch (CoreException e) { >+ } >+ >+ return filter.getBindings(); >+ } > } >Index: parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFieldReference.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFieldReference.java,v >retrieving revision 1.7 >diff -u -r1.7 CPPASTFieldReference.java >--- parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFieldReference.java 14 Jun 2006 12:16:08 -0000 1.7 >+++ parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTFieldReference.java 19 Jan 2007 20:07:45 -0000 >@@ -10,19 +10,31 @@ > *******************************************************************************/ > package org.eclipse.cdt.internal.core.dom.parser.cpp; > >+import java.util.ArrayList; >+import java.util.List; >+ > import org.eclipse.cdt.core.dom.ast.ASTVisitor; >+import org.eclipse.cdt.core.dom.ast.DOMException; > import org.eclipse.cdt.core.dom.ast.IASTExpression; > import org.eclipse.cdt.core.dom.ast.IASTName; > import org.eclipse.cdt.core.dom.ast.IASTNode; >+import org.eclipse.cdt.core.dom.ast.IBinding; >+import org.eclipse.cdt.core.dom.ast.IField; > import org.eclipse.cdt.core.dom.ast.IType; > import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFieldReference; >+import org.eclipse.cdt.core.dom.ast.cpp.ICPPBase; >+import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType; >+import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor; >+import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod; >+import org.eclipse.cdt.core.parser.util.CharArrayUtils; > import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent; >+import org.eclipse.cdt.internal.core.dom.parser.IASTCompletionContext; > > /** > * @author jcamelon > */ > public class CPPASTFieldReference extends CPPASTNode implements >- ICPPASTFieldReference, IASTAmbiguityParent { >+ ICPPASTFieldReference, IASTAmbiguityParent, IASTCompletionContext { > > private boolean isTemplate; > private IASTExpression owner; >@@ -93,5 +105,63 @@ > public IType getExpressionType() { > return CPPVisitor.getExpressionType(this); > } >+ >+ public IBinding[] resolvePrefix(IASTName n) { >+ IASTExpression expression = getFieldOwner(); >+ IType type = expression.getExpressionType(); >+ type = CPPSemantics.getUltimateType(type, true); //stop at pointer to member? >+ >+ if (type instanceof ICPPClassType) { >+ ICPPClassType classType = (ICPPClassType) type; >+ List bindings = new ArrayList(); >+ char[] name = n.toCharArray(); >+ >+ try { >+ IField[] fields = classType.getFields(); >+ for (int i = 0; i < fields.length; i++) { >+ char[] potential = fields[i].getNameCharArray(); >+ if (CharArrayUtils.equals(potential, 0, name.length, name, true)) { >+ bindings.add(fields[i]); >+ } >+ } >+ } catch (DOMException e) { >+ } >+ >+ try { >+ ICPPMethod[] methods = classType.getMethods(); >+ for (int i = 0; i < methods.length; i++) { >+ if (!(methods[i] instanceof ICPPConstructor) && !methods[i].isImplicit()) { >+ char[] potential = methods[i].getNameCharArray(); >+ if (CharArrayUtils.equals(potential, 0, name.length, name, true)) { >+ bindings.add(methods[i]); >+ } >+ } >+ } >+ } catch (DOMException e) { >+ } >+ >+ collectBases(classType, bindings, n.toCharArray()); >+ return (IBinding[]) bindings.toArray(new IBinding[bindings.size()]); >+ } >+ >+ return null; >+ } > >+ private void collectBases(ICPPClassType classType, List bindings, char[] prefix) { >+ if (CharArrayUtils.equals(classType.getNameCharArray(), prefix, true)) { >+ bindings.add(classType); >+ } >+ >+ try { >+ ICPPBase[] bases = classType.getBases(); >+ for (int i = 0; i < bases.length; i++) { >+ IBinding base = bases[i].getBaseClass(); >+ if (base instanceof ICPPClassType) { >+ ICPPClassType baseClass = (ICPPClassType) base; >+ collectBases(baseClass, bindings, prefix); >+ } >+ } >+ } catch (DOMException e) { >+ } >+ } > } >Index: parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassScope.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassScope.java,v >retrieving revision 1.37 >diff -u -r1.37 CPPClassScope.java >--- parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassScope.java 6 Dec 2006 16:27:51 -0000 1.37 >+++ parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassScope.java 19 Jan 2007 20:07:45 -0000 >@@ -299,7 +299,7 @@ > /* (non-Javadoc) > * @see org.eclipse.cdt.core.dom.ast.IScope#find(java.lang.String) > */ >- public IBinding[] find(String name) throws DOMException { >+ public IBinding[] find(String name, boolean prefixLookup) throws DOMException { > char [] n = name.toCharArray(); > ICPPASTCompositeTypeSpecifier compType = (ICPPASTCompositeTypeSpecifier) getPhysicalNode(); > IASTName compName = compType.getName(); >@@ -307,10 +307,10 @@ > IASTName [] ns = ((ICPPASTQualifiedName)compName).getNames(); > compName = ns[ ns.length - 1 ]; > } >- if( CharArrayUtils.equals( n, compName.toCharArray() ) ){ >+ if( CharArrayUtils.equals( compName.toCharArray(), n, prefixLookup) ){ > return (IBinding[]) ArrayUtil.addAll( IBinding.class, null, getConstructors( bindings, true ) ); > } >- return super.find( name ); >+ return super.find( name, prefixLookup ); > } > > public static boolean isConstructorReference( IASTName name ){ >Index: parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTUsingDeclaration.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTUsingDeclaration.java,v >retrieving revision 1.4 >diff -u -r1.4 CPPASTUsingDeclaration.java >--- parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTUsingDeclaration.java 23 Jun 2005 16:02:11 -0000 1.4 >+++ parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTUsingDeclaration.java 19 Jan 2007 20:07:45 -0000 >@@ -11,14 +11,23 @@ > package org.eclipse.cdt.internal.core.dom.parser.cpp; > > import org.eclipse.cdt.core.dom.ast.ASTVisitor; >+import org.eclipse.cdt.core.dom.ast.IASTDeclaration; > import org.eclipse.cdt.core.dom.ast.IASTName; >+import org.eclipse.cdt.core.dom.ast.IBinding; >+import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceDefinition; > import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTUsingDeclaration; >+import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace; >+import org.eclipse.cdt.core.index.BindingFilter; >+import org.eclipse.cdt.core.index.IIndex; >+import org.eclipse.cdt.core.parser.util.CharArrayUtils; >+import org.eclipse.cdt.internal.core.dom.parser.IASTCompletionContext; >+import org.eclipse.core.runtime.CoreException; > > /** > * @author jcamelon > */ > public class CPPASTUsingDeclaration extends CPPASTNode implements >- ICPPASTUsingDeclaration { >+ ICPPASTUsingDeclaration, IASTCompletionContext { > > private boolean typeName; > private IASTName name; >@@ -72,4 +81,36 @@ > return r_reference; > return r_unclear; > } >+ >+ public IBinding[] resolvePrefix(IASTName n) { >+ BindingFilter filter = new BindingFilter() { >+ protected boolean isValidBinding(IBinding binding) { >+ return binding instanceof ICPPNamespace; >+ } >+ }; >+ >+ IASTDeclaration[] decls = getTranslationUnit().getDeclarations(); >+ for (int i = 0; i < decls.length; i++) { >+ if (decls[i] instanceof ICPPASTNamespaceDefinition) { >+ ICPPASTNamespaceDefinition defn = (ICPPASTNamespaceDefinition) decls[i]; >+ IASTName name = defn.getName(); >+ if (CharArrayUtils.equals(name.toCharArray(), n.toCharArray(), true)) { >+ IBinding binding = name.resolveBinding(); >+ filter.handleBinding(binding); >+ } >+ } >+ } >+ >+ IIndex index = getTranslationUnit().getIndex(); >+ >+ try { >+ index.filterBindings( >+ n.toCharArray(), >+ n.getLinkage(), >+ filter); >+ } catch (CoreException e) { >+ } >+ >+ return filter.getBindings(); >+ } > } >Index: parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNamedTypeSpecifier.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNamedTypeSpecifier.java,v >retrieving revision 1.4 >diff -u -r1.4 CPPASTNamedTypeSpecifier.java >--- parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNamedTypeSpecifier.java 23 Jun 2005 16:02:11 -0000 1.4 >+++ parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNamedTypeSpecifier.java 19 Jan 2007 20:07:45 -0000 >@@ -11,14 +11,26 @@ > package org.eclipse.cdt.internal.core.dom.parser.cpp; > > import org.eclipse.cdt.core.dom.ast.ASTVisitor; >+import org.eclipse.cdt.core.dom.ast.DOMException; > import org.eclipse.cdt.core.dom.ast.IASTName; >+import org.eclipse.cdt.core.dom.ast.IBinding; >+import org.eclipse.cdt.core.dom.ast.IEnumeration; >+import org.eclipse.cdt.core.dom.ast.IScope; >+import org.eclipse.cdt.core.dom.ast.ITypedef; > import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamedTypeSpecifier; >+import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType; >+import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace; >+import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter; >+import org.eclipse.cdt.core.index.BindingFilter; >+import org.eclipse.cdt.core.index.IIndex; >+import org.eclipse.cdt.internal.core.dom.parser.IASTCompletionContext; >+import org.eclipse.core.runtime.CoreException; > > /** > * @author jcamelon > */ > public class CPPASTNamedTypeSpecifier extends CPPASTBaseDeclSpecifier implements >- ICPPASTNamedTypeSpecifier { >+ ICPPASTNamedTypeSpecifier, IASTCompletionContext { > > private boolean typename; > private IASTName name; >@@ -71,4 +83,54 @@ > return r_reference; > return r_unclear; > } >+ >+ public IBinding[] resolvePrefix(IASTName n) { >+ BindingFilter filter = new BindingFilter() { >+ private boolean findTemplateParameters = true; >+ >+ public boolean isValidBinding(IBinding binding) { >+ if (findTemplateParameters){ >+ return binding instanceof ICPPTemplateParameter; >+ } else { >+ return binding instanceof ICPPClassType >+ || binding instanceof IEnumeration >+ || binding instanceof ICPPNamespace >+ || binding instanceof ITypedef; >+ } >+ >+ } >+ >+ public void changeFilter() { >+ findTemplateParameters = !findTemplateParameters; >+ } >+ }; >+ >+ IScope scope = CPPVisitor.getContainingScope(n); >+ >+ try { >+ IBinding[] bindings = scope.find(n.toString(), true); >+ filter.handleBindings(bindings); >+ } catch (DOMException e) { >+ } >+ >+ filter.changeFilter(); >+ >+ try { >+ IBinding[] bindings = getTranslationUnit().getScope().find(n.toString(), true); >+ filter.handleBindings(bindings); >+ } catch (DOMException e1) { >+ } >+ >+ IIndex index = getTranslationUnit().getIndex(); >+ >+ try { >+ index.filterBindings( >+ n.toCharArray(), >+ n.getLinkage(), >+ filter); >+ } catch (CoreException e) { >+ } >+ >+ return filter.getBindings(); >+ } > } >Index: parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassType.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassType.java,v >retrieving revision 1.42 >diff -u -r1.42 CPPClassType.java >--- parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassType.java 6 Dec 2006 10:41:25 -0000 1.42 >+++ parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassType.java 19 Jan 2007 20:07:45 -0000 >@@ -333,7 +333,7 @@ > * @see org.eclipse.cdt.core.dom.ast.ICompositeType#findField(java.lang.String) > */ > public IField findField(String name) throws DOMException { >- IBinding [] bindings = CPPSemantics.findBindings( getCompositeScope(), name, true ); >+ IBinding [] bindings = CPPSemantics.findBindings( getCompositeScope(), name, true, false ); > IField field = null; > for ( int i = 0; i < bindings.length; i++ ) { > if( bindings[i] instanceof IField ){ >Index: parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTName.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTName.java,v >retrieving revision 1.13 >diff -u -r1.13 CPPASTName.java >--- parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTName.java 6 Dec 2006 10:41:25 -0000 1.13 >+++ parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTName.java 19 Jan 2007 20:07:45 -0000 >@@ -18,6 +18,7 @@ > import org.eclipse.cdt.core.dom.ast.IBinding; > import org.eclipse.cdt.core.dom.ast.IProblemBinding; > import org.eclipse.cdt.core.parser.util.CharArrayUtils; >+import org.eclipse.cdt.internal.core.dom.parser.IASTCompletionContext; > import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding; > > /** >@@ -75,7 +76,16 @@ > } > > public IBinding[] resolvePrefix() { >- return CPPSemantics.prefixLookup(this); >+ IASTNode node = getParent(); >+ while (!(node instanceof IASTCompletionContext)) { >+ if (node == null) { >+ return null; >+ } >+ node = node.getParent(); >+ } >+ >+ IASTCompletionContext context = (IASTCompletionContext) node; >+ return context.resolvePrefix(this); > } > > public void setBinding(IBinding binding) { >Index: parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassTemplate.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassTemplate.java,v >retrieving revision 1.21 >diff -u -r1.21 CPPClassTemplate.java >--- parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassTemplate.java 3 Jan 2007 22:56:30 -0000 1.21 >+++ parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassTemplate.java 19 Jan 2007 20:07:45 -0000 >@@ -236,7 +236,7 @@ > * @see org.eclipse.cdt.core.dom.ast.ICompositeType#findField(java.lang.String) > */ > public IField findField(String name) throws DOMException { >- IBinding [] bindings = CPPSemantics.findBindings( getCompositeScope(), name, true ); >+ IBinding [] bindings = CPPSemantics.findBindings( getCompositeScope(), name, true, false ); > IField field = null; > for ( int i = 0; i < bindings.length; i++ ) { > if( bindings[i] instanceof IField ){ >Index: parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPUnknownScope.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPUnknownScope.java,v >retrieving revision 1.6 >diff -u -r1.6 CPPUnknownScope.java >--- parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPUnknownScope.java 12 Oct 2006 13:23:41 -0000 1.6 >+++ parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPUnknownScope.java 19 Jan 2007 20:07:45 -0000 >@@ -58,7 +58,7 @@ > /* (non-Javadoc) > * @see org.eclipse.cdt.core.dom.ast.IScope#find(java.lang.String) > */ >- public IBinding[] find( String name ) { >+ public IBinding[] find( String name, boolean prefixLookup ) { > // TODO Auto-generated method stub > return null; > } >Index: parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTQualifiedName.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTQualifiedName.java,v >retrieving revision 1.18 >diff -u -r1.18 CPPASTQualifiedName.java >--- parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTQualifiedName.java 31 Oct 2006 10:08:55 -0000 1.18 >+++ parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTQualifiedName.java 19 Jan 2007 20:07:45 -0000 >@@ -10,7 +10,11 @@ > *******************************************************************************/ > package org.eclipse.cdt.internal.core.dom.parser.cpp; > >+import java.util.ArrayList; >+import java.util.List; >+ > import org.eclipse.cdt.core.dom.ast.ASTVisitor; >+import org.eclipse.cdt.core.dom.ast.DOMException; > import org.eclipse.cdt.core.dom.ast.IASTName; > import org.eclipse.cdt.core.dom.ast.IASTNameOwner; > import org.eclipse.cdt.core.dom.ast.IASTNode; >@@ -19,13 +23,18 @@ > import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTOperatorName; > import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName; > import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateId; >+import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType; >+import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod; >+import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace; > import org.eclipse.cdt.core.parser.util.ArrayUtil; >+import org.eclipse.cdt.core.parser.util.CharArrayUtils; >+import org.eclipse.cdt.internal.core.dom.parser.IASTCompletionContext; > > /** > * @author jcamelon > */ > public class CPPASTQualifiedName extends CPPASTNode implements >- ICPPASTQualifiedName { >+ ICPPASTQualifiedName, IASTCompletionContext { > > /** > * @param duple >@@ -275,4 +284,45 @@ > } > return false; > } >+ >+ public IBinding[] resolvePrefix(IASTName n) { >+ IBinding binding = names[names.length - 2].resolveBinding(); >+ if (binding instanceof ICPPClassType) { >+ ICPPClassType classType = (ICPPClassType) binding; >+ List bindings = new ArrayList(); >+ char[] name = n.toCharArray(); >+ >+ try { >+ ICPPMethod[] methods = classType.getDeclaredMethods(); >+ for (int i = 0; i < methods.length; i++) { >+ char[] potential = methods[i].getNameCharArray(); >+ if (CharArrayUtils.equals(potential, 0, name.length, name, true)) { >+ bindings.add(methods[i]); >+ } >+ } >+ } catch (DOMException e) { >+ } >+ >+ return (IBinding[]) bindings.toArray(new IBinding[bindings.size()]); >+ } else if (binding instanceof ICPPNamespace) { >+ ICPPNamespace namespace = (ICPPNamespace) binding; >+ List bindings = new ArrayList(); >+ char[] name = n.toCharArray(); >+ >+ try { >+ IBinding[] members = namespace.getMemberBindings(); >+ for (int i = 0 ; i < members.length; i++) { >+ char[] potential = members[i].getNameCharArray(); >+ if (CharArrayUtils.equals(potential, name, true)) { >+ bindings.add(members[i]); >+ } >+ } >+ } catch (DOMException e) { >+ } >+ >+ return (IBinding[]) bindings.toArray(new IBinding[bindings.size()]); >+ } >+ >+ return null; >+ } > } >Index: parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTIdExpression.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTIdExpression.java,v >retrieving revision 1.8 >diff -u -r1.8 CASTIdExpression.java >--- parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTIdExpression.java 20 Dec 2006 20:59:43 -0000 1.8 >+++ parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTIdExpression.java 19 Jan 2007 20:07:45 -0000 >@@ -12,14 +12,21 @@ > package org.eclipse.cdt.internal.core.dom.parser.c; > > import org.eclipse.cdt.core.dom.ast.ASTVisitor; >+import org.eclipse.cdt.core.dom.ast.DOMException; > import org.eclipse.cdt.core.dom.ast.IASTIdExpression; > import org.eclipse.cdt.core.dom.ast.IASTName; >+import org.eclipse.cdt.core.dom.ast.IBinding; >+import org.eclipse.cdt.core.dom.ast.IScope; > import org.eclipse.cdt.core.dom.ast.IType; >+import org.eclipse.cdt.core.index.BindingFilter; >+import org.eclipse.cdt.core.index.IIndex; >+import org.eclipse.cdt.internal.core.dom.parser.IASTCompletionContext; >+import org.eclipse.core.runtime.CoreException; > > /** > * @author jcamelon > */ >-public class CASTIdExpression extends CASTNode implements IASTIdExpression { >+public class CASTIdExpression extends CASTNode implements IASTIdExpression, IASTCompletionContext { > > private IASTName name; > >@@ -61,4 +68,31 @@ > return CVisitor.getExpressionType(this); > } > >+ public IBinding[] resolvePrefix(IASTName n) { >+ BindingFilter filter = new BindingFilter() { >+ protected boolean isValidBinding(IBinding binding) { >+ return true; >+ } >+ }; >+ >+ IScope scope = CVisitor.getContainingScope(n); >+ >+ try { >+ IBinding[] bindings = scope.find(n.toString(), true); >+ filter.handleBindings(bindings); >+ } catch (DOMException e) { >+ } >+ >+ IIndex index = getTranslationUnit().getIndex(); >+ >+ try { >+ index.filterBindings( >+ n.toCharArray(), >+ n.getLinkage(), >+ filter); >+ } catch (CoreException e) { >+ } >+ >+ return filter.getBindings(); >+ } > } >Index: parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTTypedefNameSpecifier.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTTypedefNameSpecifier.java,v >retrieving revision 1.6 >diff -u -r1.6 CASTTypedefNameSpecifier.java >--- parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTTypedefNameSpecifier.java 20 Dec 2006 20:59:43 -0000 1.6 >+++ parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTTypedefNameSpecifier.java 19 Jan 2007 20:07:45 -0000 >@@ -12,14 +12,24 @@ > package org.eclipse.cdt.internal.core.dom.parser.c; > > import org.eclipse.cdt.core.dom.ast.ASTVisitor; >+import org.eclipse.cdt.core.dom.ast.DOMException; > import org.eclipse.cdt.core.dom.ast.IASTName; >+import org.eclipse.cdt.core.dom.ast.IBinding; >+import org.eclipse.cdt.core.dom.ast.ICompositeType; >+import org.eclipse.cdt.core.dom.ast.IEnumeration; >+import org.eclipse.cdt.core.dom.ast.IScope; >+import org.eclipse.cdt.core.dom.ast.ITypedef; > import org.eclipse.cdt.core.dom.ast.c.ICASTTypedefNameSpecifier; >+import org.eclipse.cdt.core.index.BindingFilter; >+import org.eclipse.cdt.core.index.IIndex; >+import org.eclipse.cdt.internal.core.dom.parser.IASTCompletionContext; >+import org.eclipse.core.runtime.CoreException; > > /** > * @author jcamelon > */ > public class CASTTypedefNameSpecifier extends CASTBaseDeclSpecifier implements >- ICASTTypedefNameSpecifier { >+ ICASTTypedefNameSpecifier, IASTCompletionContext { > > private IASTName name; > /* (non-Javadoc) >@@ -63,4 +73,33 @@ > return r_unclear; > } > >+ public IBinding[] resolvePrefix(IASTName n) { >+ BindingFilter filter = new BindingFilter() { >+ protected boolean isValidBinding(IBinding binding) { >+ return binding instanceof ICompositeType >+ || binding instanceof IEnumeration >+ || binding instanceof ITypedef; >+ } >+ }; >+ >+ IScope scope = CVisitor.getContainingScope(n); >+ >+ try { >+ IBinding[] bindings = scope.find(n.toString(), true); >+ filter.handleBindings(bindings); >+ } catch (DOMException e) { >+ } >+ >+ IIndex index = getTranslationUnit().getIndex(); >+ >+ try { >+ index.filterBindings( >+ n.toCharArray(), >+ n.getLinkage(), >+ filter); >+ } catch (CoreException e) { >+ } >+ >+ return filter.getBindings(); >+ } > } >Index: parser/org/eclipse/cdt/internal/core/dom/parser/c/CScope.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CScope.java,v >retrieving revision 1.17 >diff -u -r1.17 CScope.java >--- parser/org/eclipse/cdt/internal/core/dom/parser/c/CScope.java 12 Oct 2006 13:23:41 -0000 1.17 >+++ parser/org/eclipse/cdt/internal/core/dom/parser/c/CScope.java 19 Jan 2007 20:07:45 -0000 >@@ -98,8 +98,8 @@ > /* (non-Javadoc) > * @see org.eclipse.cdt.core.dom.ast.IScope#find(java.lang.String) > */ >- public IBinding[] find( String name ) throws DOMException { >- return CVisitor.findBindings( this, name ); >+ public IBinding[] find( String name, boolean prefixLookup ) throws DOMException { >+ return CVisitor.findBindings( this, name, prefixLookup ); > } > > public IBinding getBinding( int namespaceType, char [] name ){ >Index: parser/org/eclipse/cdt/internal/core/dom/parser/c/CVisitor.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CVisitor.java,v >retrieving revision 1.88 >diff -u -r1.88 CVisitor.java >--- parser/org/eclipse/cdt/internal/core/dom/parser/c/CVisitor.java 20 Oct 2006 15:02:43 -0000 1.88 >+++ parser/org/eclipse/cdt/internal/core/dom/parser/c/CVisitor.java 19 Jan 2007 20:07:45 -0000 >@@ -12,6 +12,9 @@ > > package org.eclipse.cdt.internal.core.dom.parser.c; > >+import java.util.ArrayList; >+import java.util.List; >+ > import org.eclipse.cdt.core.CCorePlugin; > import org.eclipse.cdt.core.dom.ast.ASTNodeProperty; > import org.eclipse.cdt.core.dom.ast.DOMException; >@@ -609,7 +612,7 @@ > char [] p = fieldReference.getFieldName().toCharArray(); > IField [] fields = ((ICompositeType) type).getFields(); > for ( int i = 0; i < fields.length; i++ ) { >- if( CharArrayUtils.equals( fields[i].getNameCharArray(), 0, p.length, p ) ){ >+ if( CharArrayUtils.equals( fields[i].getNameCharArray(), 0, p.length, p, true ) ){ > result = (IBinding[]) ArrayUtil.append( IBinding.class, result, fields[i] ); > } > } >@@ -706,7 +709,7 @@ > int op = ((IASTUnaryExpression)expression).getOperator(); > if( op == IASTUnaryExpression.op_sizeof ){ > IScope scope = getContainingScope( expression ); >- IBinding [] bs = scope.find( SIZE_T ); >+ IBinding [] bs = scope.find( SIZE_T, false ); > if( bs.length > 0 && bs[0] instanceof IType ){ > return (IType) bs[0]; > } >@@ -741,7 +744,7 @@ > IASTTypeIdExpression typeidExp = (IASTTypeIdExpression) expression; > if( typeidExp.getOperator() == IASTTypeIdExpression.op_sizeof ){ > IScope scope = getContainingScope( typeidExp ); >- IBinding [] bs = scope.find( SIZE_T ); >+ IBinding [] bs = scope.find( SIZE_T, false ); > if( bs.length > 0 && bs[0] instanceof IType ){ > return (IType) bs[0]; > } >@@ -1415,7 +1418,7 @@ > char [] c = candidate.toCharArray(); > if( prefixMap == null && CharArrayUtils.equals( c, name ) ){ > return candidate; >- } else if( prefixMap != null && CharArrayUtils.equals( c, 0, name.length, name ) && !prefixMap.containsKey( c ) ){ >+ } else if( prefixMap != null && CharArrayUtils.equals( c, 0, name.length, name, true ) && !prefixMap.containsKey( c ) ){ > prefixMap.put( c, candidate ); > } > return prefixMap; >@@ -1437,7 +1440,7 @@ > char [] n = name.toCharArray(); > if( prefixMap == null && CharArrayUtils.equals( c, n ) ) > return tempName; >- else if( prefixMap != null && CharArrayUtils.equals( c, 0, n.length, n ) && !prefixMap.containsKey( c ) ) >+ else if( prefixMap != null && CharArrayUtils.equals( c, 0, n.length, n, true ) && !prefixMap.containsKey( c ) ) > prefixMap.put( c, tempName ); > } else { > return checkForBinding( scope, paramDecl.getDeclSpecifier(), name, typesOnly, prefixMap ); >@@ -1920,7 +1923,7 @@ > return (IBinding[]) ArrayUtil.trim( IBinding.class, result ); > } > >- public static IBinding[] findBindings( IScope scope, String name ) throws DOMException{ >+ public static IBinding[] findBindings( IScope scope, String name, boolean prefixLookup ) throws DOMException{ > IASTNode node = ASTInternal.getPhysicalNodeOfScope(scope); > if( node instanceof IASTFunctionDefinition ) > node = ((IASTFunctionDefinition)node).getBody(); >@@ -1930,39 +1933,58 @@ > > //normal names > astName.setPropertyInParent( STRING_LOOKUP_PROPERTY ); >- IBinding b1 = (IBinding) findBinding( astName, astName, COMPLETE ); >+ int flags = prefixLookup ? COMPLETE | PREFIX_LOOKUP : COMPLETE; >+ Object o1 = findBinding( astName, astName, flags ); > >+ IBinding[] b1 = null; >+ if (o1 instanceof IBinding) { >+ b1 = new IBinding[] { (IBinding) o1 }; >+ } else { >+ b1 = (IBinding[]) o1; >+ } >+ > //structure names > astName.setPropertyInParent( STRING_LOOKUP_TAGS_PROPERTY ); >- IBinding b2 = (IBinding) findBinding( astName, astName, COMPLETE | TAGS ); >+ flags = prefixLookup ? COMPLETE | TAGS | PREFIX_LOOKUP : COMPLETE | TAGS; >+ Object o2 = findBinding( astName, astName, flags ); > >+ IBinding[] b2 = null; >+ if (o2 instanceof IBinding) { >+ b2 = new IBinding[] { (IBinding) o2 }; >+ } else { >+ b2 = (IBinding[]) o2; >+ } >+ > //label names >- ILabel b3 = null; >+ List b3 = new ArrayList(); > do{ > char [] n = name.toCharArray(); > if( scope instanceof ICFunctionScope ){ > ILabel [] labels = ((CFunctionScope)scope).getLabels(); > for( int i = 0; i < labels.length; i++ ){ > ILabel label = labels[i]; >- if( CharArrayUtils.equals( label.getNameCharArray(), n) ){ >- b3 = label; >- break; >+ if( CharArrayUtils.equals( label.getNameCharArray(), n, prefixLookup) ){ >+ b3.add(label); >+ if (!prefixLookup) break; > } > } >- break; >+ if (!prefixLookup) break; > } > scope = scope.getParent(); > } while( scope != null ); > >- int c = (( b1 != null ) ? 1 : 0) + (( b2 != null ) ? 1 : 0) + (( b3 != null ) ? 1 : 0); >+ int c = (b1 == null ? 0 : b1.length) + (b2 == null ? 0 :b2.length) + (b3 == null ? 0 : b3.size()); >+ > IBinding [] result = new IBinding [c]; >- c = 0; >- if( b1 != null ) >- result[c++] = b1; >- if( b2 != null ) >- result[c++] = b2; >- if( b3 != null ) >- result[c] = b3; >+ >+ if (b1 != null) >+ ArrayUtil.addAll(IBinding.class, result, b1); >+ >+ if (b2 != null) >+ ArrayUtil.addAll(IBinding.class, result, b2); >+ >+ if (b3 != null) >+ ArrayUtil.addAll(IBinding.class, result, b3.toArray(new IBinding[b3.size()])); > > return result; > } >Index: parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTName.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTName.java,v >retrieving revision 1.16 >diff -u -r1.16 CASTName.java >--- parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTName.java 20 Dec 2006 20:59:44 -0000 1.16 >+++ parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTName.java 19 Jan 2007 20:07:45 -0000 >@@ -19,6 +19,7 @@ > import org.eclipse.cdt.core.dom.ast.IASTNode; > import org.eclipse.cdt.core.dom.ast.IBinding; > import org.eclipse.cdt.internal.core.dom.Linkage; >+import org.eclipse.cdt.internal.core.dom.parser.IASTCompletionContext; > > /** > * @author jcamelon >@@ -56,7 +57,16 @@ > } > > public IBinding[] resolvePrefix() { >- return CVisitor.prefixLookup(this); >+ IASTNode node = getParent(); >+ while (!(node instanceof IASTCompletionContext)) { >+ if (node == null) { >+ return null; >+ } >+ node = node.getParent(); >+ } >+ >+ IASTCompletionContext context = (IASTCompletionContext) node; >+ return context.resolvePrefix(this); > } > > public void setBinding(IBinding binding) { >Index: parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTFieldReference.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTFieldReference.java,v >retrieving revision 1.10 >diff -u -r1.10 CASTFieldReference.java >--- parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTFieldReference.java 20 Dec 2006 20:59:43 -0000 1.10 >+++ parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTFieldReference.java 19 Jan 2007 20:07:45 -0000 >@@ -11,18 +11,28 @@ > *******************************************************************************/ > package org.eclipse.cdt.internal.core.dom.parser.c; > >+import java.util.ArrayList; >+import java.util.List; >+ > import org.eclipse.cdt.core.dom.ast.ASTVisitor; >+import org.eclipse.cdt.core.dom.ast.DOMException; > import org.eclipse.cdt.core.dom.ast.IASTExpression; > import org.eclipse.cdt.core.dom.ast.IASTFieldReference; > import org.eclipse.cdt.core.dom.ast.IASTName; > import org.eclipse.cdt.core.dom.ast.IASTNode; >+import org.eclipse.cdt.core.dom.ast.IBinding; >+import org.eclipse.cdt.core.dom.ast.ICompositeType; >+import org.eclipse.cdt.core.dom.ast.IField; > import org.eclipse.cdt.core.dom.ast.IType; >+import org.eclipse.cdt.core.parser.util.CharArrayUtils; > import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent; >+import org.eclipse.cdt.internal.core.dom.parser.IASTCompletionContext; >+import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPSemantics; > > /** > * @author jcamelon > */ >-public class CASTFieldReference extends CASTNode implements IASTFieldReference, IASTAmbiguityParent { >+public class CASTFieldReference extends CASTNode implements IASTFieldReference, IASTAmbiguityParent, IASTCompletionContext { > > private IASTExpression owner; > private IASTName name; >@@ -92,5 +102,31 @@ > public IType getExpressionType() { > return CVisitor.getExpressionType(this); > } >- >+ >+ public IBinding[] resolvePrefix(IASTName n) { >+ IASTExpression expression = getFieldOwner(); >+ IType type = expression.getExpressionType(); >+ type = CPPSemantics.getUltimateType(type, true); //stop at pointer to member? >+ >+ if (type instanceof ICompositeType) { >+ ICompositeType compType = (ICompositeType) type; >+ List bindings = new ArrayList(); >+ char[] name = n.toCharArray(); >+ >+ try { >+ IField[] fields = compType.getFields(); >+ for (int i = 0; i < fields.length; i++) { >+ char[] potential = fields[i].getNameCharArray(); >+ if (CharArrayUtils.equals(potential, 0, name.length, name, true)) { >+ bindings.add(fields[i]); >+ } >+ } >+ } catch (DOMException e) { >+ } >+ >+ return (IBinding[]) bindings.toArray(new IBinding[bindings.size()]); >+ } >+ >+ return null; >+ } > } >Index: parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPBase.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPBase.java,v >retrieving revision 1.4 >diff -u -r1.4 PDOMCPPBase.java >--- parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPBase.java 19 Jan 2007 12:37:42 -0000 1.4 >+++ parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPBase.java 19 Jan 2007 20:07:46 -0000 >@@ -16,6 +16,7 @@ > import org.eclipse.cdt.core.dom.ast.cpp.ICPPBase; > import org.eclipse.cdt.internal.core.pdom.PDOM; > import org.eclipse.cdt.internal.core.pdom.db.Database; >+import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding; > import org.eclipse.cdt.internal.core.pdom.dom.PDOMName; > import org.eclipse.core.runtime.CoreException; > >@@ -83,8 +84,13 @@ > public IBinding getBaseClass() { > try { > PDOMName name= getBaseClassSpecifierImpl(); >- if (name != null) >- return name.getPDOMBinding(); >+ if (name != null) { >+ PDOMBinding b = name.getPDOMBinding(); >+ while( b instanceof PDOMCPPTypedef && ((PDOMCPPTypedef)b).getType() instanceof PDOMBinding ){ >+ b = (PDOMBinding) ((PDOMCPPTypedef)b).getType(); >+ } >+ return b; >+ } > } catch (CoreException e) { > CCorePlugin.log(e); > } >Index: parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassType.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassType.java,v >retrieving revision 1.37 >diff -u -r1.37 PDOMCPPClassType.java >--- parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassType.java 19 Jan 2007 12:37:42 -0000 1.37 >+++ parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPClassType.java 19 Jan 2007 20:07:46 -0000 >@@ -35,6 +35,7 @@ > import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor; > import org.eclipse.cdt.core.dom.ast.cpp.ICPPField; > import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod; >+import org.eclipse.cdt.core.parser.util.CharArrayUtils; > import org.eclipse.cdt.internal.core.Util; > import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding; > import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPClassScope; >@@ -166,9 +167,10 @@ > public ICPPMethod[] getMethods() throws DOMException { > try { > MethodCollector methods = new MethodCollector(true); >- accept(methods); >+ acceptInHierarchy(new HashSet(), methods); > return methods.getMethods(); > } catch (CoreException e) { >+ CCorePlugin.log(e); > return new ICPPMethod[0]; > } > } >@@ -401,12 +403,49 @@ > return null; > } > >+ private static class BindingFinder implements IPDOMVisitor { >+ private List fBindings = new ArrayList(); >+ private char[] fName; >+ private boolean fPrefixLookup; >+ >+ public BindingFinder(char[] name, boolean prefiexLookup) { >+ fName= name; >+ fPrefixLookup= prefiexLookup; >+ } >+ >+ public boolean visit(IPDOMNode node) throws CoreException { >+ if (node instanceof PDOMNamedNode && node instanceof IBinding >+ && !(node instanceof ICPPConstructor)) { >+ PDOMNamedNode nn= (PDOMNamedNode) node; >+ if (CharArrayUtils.equals(nn.getDBName().getChars(), fName, fPrefixLookup)) { >+ fBindings.add(node); >+ } >+ } >+ return false; >+ } >+ public void leave(IPDOMNode node) throws CoreException { >+ } >+ public IBinding[] getBindings() { >+ return (IBinding[])fBindings.toArray(new IBinding[fBindings.size()]); >+ } >+ } >+ >+ public IBinding[] find(String name, boolean prefixLookup) throws DOMException { >+ try { >+ BindingFinder visitor= new BindingFinder(name.toCharArray(), prefixLookup); >+ acceptInHierarchy(new HashSet(), visitor); >+ return visitor.getBindings(); >+ } catch (CoreException e) { >+ CCorePlugin.log(e); >+ } >+ return null; >+ } >+ > // Not implemented > > public Object clone() {fail();return null;} > public IField findField(String name) throws DOMException {fail();return null;} > public IBinding[] getFriends() throws DOMException {fail();return null;} >- public IBinding[] find(String name) throws DOMException {fail();return null;} > > public IScope getParent() throws DOMException { > try { >Index: parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPNamespace.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPNamespace.java,v >retrieving revision 1.24 >diff -u -r1.24 PDOMCPPNamespace.java >--- parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPNamespace.java 15 Dec 2006 11:30:00 -0000 1.24 >+++ parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPNamespace.java 19 Jan 2007 20:07:46 -0000 >@@ -13,7 +13,11 @@ > > package org.eclipse.cdt.internal.core.pdom.dom.cpp; > >+import java.util.ArrayList; >+import java.util.List; >+ > import org.eclipse.cdt.core.CCorePlugin; >+import org.eclipse.cdt.core.dom.IPDOMNode; > import org.eclipse.cdt.core.dom.IPDOMVisitor; > import org.eclipse.cdt.core.dom.ast.DOMException; > import org.eclipse.cdt.core.dom.ast.IASTName; >@@ -28,6 +32,7 @@ > import org.eclipse.cdt.internal.core.pdom.db.IBTreeVisitor; > import org.eclipse.cdt.internal.core.pdom.dom.FindBindingsInBTree; > import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding; >+import org.eclipse.cdt.internal.core.pdom.dom.PDOMNamedNode; > import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode; > import org.eclipse.core.runtime.CoreException; > >@@ -92,9 +97,9 @@ > return new IASTNode[0]; > } > >- public IBinding[] find(String name) { >+ public IBinding[] find(String name, boolean prefixLookup) { > try { >- FindBindingsInBTree visitor = new FindBindingsInBTree(getLinkageImpl(), name.toCharArray()); >+ FindBindingsInBTree visitor = new FindBindingsInBTree(getLinkageImpl(), name.toCharArray(), null, prefixLookup); > getIndex().accept(visitor); > return visitor.getBinding(); > } catch (CoreException e) { >@@ -124,6 +129,31 @@ > return true; > } > >- public IBinding[] getMemberBindings() throws DOMException {fail(); return null;} >+ private static class BindingCollector implements IPDOMVisitor { >+ private List fBindings = new ArrayList(); >+ >+ public boolean visit(IPDOMNode node) throws CoreException { >+ if (node instanceof PDOMNamedNode && node instanceof IBinding) { >+ fBindings.add(node); >+ } >+ return false; >+ } >+ public void leave(IPDOMNode node) throws CoreException { >+ } >+ public IBinding[] getBindings() { >+ return (IBinding[])fBindings.toArray(new IBinding[fBindings.size()]); >+ } >+ } >+ >+ public IBinding[] getMemberBindings() throws DOMException { >+ BindingCollector visitor= new BindingCollector(); >+ try { >+ accept(visitor); >+ } catch (CoreException e) { >+ CCorePlugin.log(e); >+ } >+ return visitor.getBindings(); >+ } >+ > public void addUsingDirective(IASTNode directive) throws DOMException {fail();} > } >Index: parser/org/eclipse/cdt/core/parser/util/CharArrayUtils.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/util/CharArrayUtils.java,v >retrieving revision 1.7 >diff -u -r1.7 CharArrayUtils.java >--- parser/org/eclipse/cdt/core/parser/util/CharArrayUtils.java 6 Dec 2006 10:41:32 -0000 1.7 >+++ parser/org/eclipse/cdt/core/parser/util/CharArrayUtils.java 19 Jan 2007 20:07:45 -0000 >@@ -117,6 +117,14 @@ > return true; > } > >+ public static final boolean equals(char[] str1, char[] str2, boolean prefixLookup ) { >+ if( prefixLookup ) { >+ return equals(str1, 0, str2.length, str2, true); >+ } else { >+ return equals(str1, str2); >+ } >+ } >+ > public static final char[] extract(char[] str, int start, int length) { > if (start == 0 && length == str.length) > return str; >Index: parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCField.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCField.java,v >retrieving revision 1.8 >diff -u -r1.8 PDOMCField.java >--- parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCField.java 27 Oct 2006 10:08:06 -0000 1.8 >+++ parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCField.java 19 Jan 2007 20:07:46 -0000 >@@ -14,10 +14,8 @@ > > import org.eclipse.cdt.core.dom.ast.DOMException; > import org.eclipse.cdt.core.dom.ast.IField; >-import org.eclipse.cdt.core.dom.ast.IType; > import org.eclipse.cdt.internal.core.pdom.PDOM; > import org.eclipse.cdt.internal.core.pdom.dom.IPDOMMemberOwner; >-import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding; > import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode; > import org.eclipse.core.runtime.CoreException; > >@@ -25,10 +23,10 @@ > * @author Doug Schaefer > * > */ >-class PDOMCField extends PDOMBinding implements IField { >+class PDOMCField extends PDOMCVariable implements IField { > > public PDOMCField(PDOM pdom, IPDOMMemberOwner parent, IField field) throws CoreException { >- super(pdom, (PDOMNode) parent, field.getNameCharArray()); >+ super(pdom, (PDOMNode) parent, field); > } > > public PDOMCField(PDOM pdom, int record) { >@@ -42,12 +40,6 @@ > public int getNodeType() { > return PDOMCLinkage.CFIELD; > } >- >- public IType getType() throws DOMException { >- return null; >- // TODO - do we need the real type? >- //throw new PDOMNotImplementedError(); >- } > > public boolean isStatic() throws DOMException { > // ISO/IEC 9899:TC1 6.7.2.1 >Index: parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCStructure.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCStructure.java,v >retrieving revision 1.16 >diff -u -r1.16 PDOMCStructure.java >--- parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCStructure.java 6 Dec 2006 10:41:25 -0000 1.16 >+++ parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCStructure.java 19 Jan 2007 20:07:46 -0000 >@@ -28,12 +28,14 @@ > import org.eclipse.cdt.core.dom.ast.IType; > import org.eclipse.cdt.core.dom.ast.ITypedef; > import org.eclipse.cdt.core.dom.ast.c.ICCompositeTypeScope; >+import org.eclipse.cdt.core.parser.util.CharArrayUtils; > import org.eclipse.cdt.internal.core.Util; > import org.eclipse.cdt.internal.core.index.IIndexType; > import org.eclipse.cdt.internal.core.pdom.PDOM; > import org.eclipse.cdt.internal.core.pdom.db.PDOMNodeLinkedList; > import org.eclipse.cdt.internal.core.pdom.dom.IPDOMMemberOwner; > import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding; >+import org.eclipse.cdt.internal.core.pdom.dom.PDOMNamedNode; > import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode; > import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError; > import org.eclipse.core.runtime.CoreException; >@@ -196,11 +198,44 @@ > fail(); return null; > } > >- public IBinding[] find(String name) throws DOMException { >- fail(); return null; >- } >- > public IBinding getBinding(IASTName name, boolean resolve) throws DOMException { > fail(); return null; > } >+ >+ private static class BindingFinder implements IPDOMVisitor { >+ private List fBindings = new ArrayList(); >+ private char[] fName; >+ private boolean fPrefixLookup; >+ >+ public BindingFinder(char[] name, boolean prefiexLookup) { >+ fName= name; >+ fPrefixLookup= prefiexLookup; >+ } >+ >+ public boolean visit(IPDOMNode node) throws CoreException { >+ if (node instanceof PDOMNamedNode && node instanceof IBinding) { >+ PDOMNamedNode nn= (PDOMNamedNode) node; >+ if (CharArrayUtils.equals(nn.getDBName().getChars(), fName, fPrefixLookup)) { >+ fBindings.add(node); >+ } >+ } >+ return false; >+ } >+ public void leave(IPDOMNode node) throws CoreException { >+ } >+ public IBinding[] getBindings() { >+ return (IBinding[])fBindings.toArray(new IBinding[fBindings.size()]); >+ } >+ } >+ >+ public IBinding[] find(String name, boolean prefixLookup) throws DOMException { >+ try { >+ BindingFinder visitor= new BindingFinder(name.toCharArray(), prefixLookup); >+ accept(visitor); >+ return visitor.getBindings(); >+ } catch (CoreException e) { >+ CCorePlugin.log(e); >+ } >+ return null; >+ } > } >Index: parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCFunction.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCFunction.java,v >retrieving revision 1.8 >diff -u -r1.8 PDOMCFunction.java >--- parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCFunction.java 27 Oct 2006 10:08:06 -0000 1.8 >+++ parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCFunction.java 19 Jan 2007 20:07:46 -0000 >@@ -44,20 +44,35 @@ > public static final int FIRST_PARAM = PDOMBinding.RECORD_SIZE + 4; > > /** >+ * Offset for return type of this function (relative to >+ * the beginning of the record). >+ */ >+ private static final int RETURN_TYPE = PDOMBinding.RECORD_SIZE + 8; >+ >+ /** > * Offset of annotation information (relative to the beginning of the > * record). > */ >- private static final int ANNOTATIONS = PDOMBinding.RECORD_SIZE + 8; // byte >+ private static final int ANNOTATIONS = PDOMBinding.RECORD_SIZE + 12; // byte > > /** > * The size in bytes of a PDOMCPPFunction record in the database. > */ >- public static final int RECORD_SIZE = PDOMBinding.RECORD_SIZE + 9; >+ public static final int RECORD_SIZE = PDOMBinding.RECORD_SIZE + 13; > > public PDOMCFunction(PDOM pdom, PDOMNode parent, IFunction function) throws CoreException { > super(pdom, parent, function.getNameCharArray()); > > try { >+ IFunctionType ft= function.getType(); >+ IType rt= ft.getReturnType(); >+ if (rt != null) { >+ PDOMNode typeNode = getLinkageImpl().addType(this, rt); >+ if (typeNode != null) { >+ pdom.getDB().putInt(record + RETURN_TYPE, typeNode.getRecord()); >+ } >+ } >+ > IParameter[] params = function.getParameters(); > pdom.getDB().putInt(record + NUM_PARAMS, params.length); > for (int i = 0; i < params.length; ++i) { >@@ -173,8 +188,19 @@ > return getBit(getByte(record + ANNOTATIONS), PDOMCAnnotation.VARARGS_OFFSET); > } > >+ public IType getReturnType() throws DOMException { >+ try { >+ PDOMNode node = getLinkageImpl().getNode(pdom.getDB().getInt(record + RETURN_TYPE)); >+ if (node instanceof IType) { >+ return (IType) node; >+ } >+ } catch (CoreException e) { >+ CCorePlugin.log(e); >+ } >+ return null; >+ } >+ > public IScope getFunctionScope() throws DOMException {fail(); return null;} >- public IType getReturnType() throws DOMException {fail();return null;} > public boolean isSameType(IType type) {fail(); return false;} > public Object clone() {fail(); return null;} > } >Index: parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCVariable.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCVariable.java,v >retrieving revision 1.9 >diff -u -r1.9 PDOMCVariable.java >--- parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCVariable.java 27 Oct 2006 10:08:06 -0000 1.9 >+++ parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCVariable.java 19 Jan 2007 20:07:46 -0000 >@@ -12,11 +12,13 @@ > > package org.eclipse.cdt.internal.core.pdom.dom.c; > >+import org.eclipse.cdt.core.CCorePlugin; > import org.eclipse.cdt.core.dom.ast.DOMException; > import org.eclipse.cdt.core.dom.ast.IType; > import org.eclipse.cdt.core.dom.ast.IVariable; > import org.eclipse.cdt.internal.core.Util; > import org.eclipse.cdt.internal.core.pdom.PDOM; >+import org.eclipse.cdt.internal.core.pdom.db.Database; > import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding; > import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode; > import org.eclipse.core.runtime.CoreException; >@@ -28,20 +30,32 @@ > class PDOMCVariable extends PDOMBinding implements IVariable { > > /** >+ * Offset of pointer to type information for this parameter >+ * (relative to the beginning of the record). >+ */ >+ private static final int TYPE_OFFSET = PDOMBinding.RECORD_SIZE + 0; >+ >+ /** > * Offset of annotation information (relative to the beginning of the > * record). > */ >- private static final int ANNOTATIONS = PDOMBinding.RECORD_SIZE + 0; >+ private static final int ANNOTATIONS = PDOMBinding.RECORD_SIZE + 4; > > /** > * The size in bytes of a PDOMCVariable record in the database. > */ >- protected static final int RECORD_SIZE = PDOMBinding.RECORD_SIZE + 1; >+ protected static final int RECORD_SIZE = PDOMBinding.RECORD_SIZE + 5; > > public PDOMCVariable(PDOM pdom, PDOMNode parent, IVariable variable) throws CoreException { > super(pdom, parent, variable.getNameCharArray()); > > try { >+ // Find the type record >+ Database db = pdom.getDB(); >+ PDOMNode typeNode = parent.getLinkageImpl().addType(this, variable.getType()); >+ if (typeNode != null) >+ db.putInt(record + TYPE_OFFSET, typeNode.getRecord()); >+ > pdom.getDB().putByte(record + ANNOTATIONS, PDOMCAnnotation.encodeAnnotation(variable)); > } catch (DOMException e) { > throw new CoreException(Util.createStatus(e)); >@@ -61,9 +75,13 @@ > } > > public IType getType() throws DOMException { >- return null; >- // TODO - do we need the real type? >- //throw new PDOMNotImplementedError(); >+ try { >+ int typeRec = pdom.getDB().getInt(record + TYPE_OFFSET); >+ return (IType)getLinkageImpl().getNode(typeRec); >+ } catch (CoreException e) { >+ CCorePlugin.log(e); >+ return null; >+ } > } > > public boolean isStatic() throws DOMException { >Index: parser/org/eclipse/cdt/internal/core/pdom/PDOM.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java,v >retrieving revision 1.47 >diff -u -r1.47 PDOM.java >--- parser/org/eclipse/cdt/internal/core/pdom/PDOM.java 19 Jan 2007 12:37:42 -0000 1.47 >+++ parser/org/eclipse/cdt/internal/core/pdom/PDOM.java 19 Jan 2007 20:07:46 -0000 >@@ -607,7 +607,7 @@ > if (ns instanceof ICPPNamespace) { > try { > ICPPNamespaceScope scope = ((ICPPNamespace)ns).getNamespaceScope(); >- return scope.find(new String(name)); >+ return scope.find(new String(name), false); > } catch(DOMException de) { > CCorePlugin.log(de); > } >Index: parser/org/eclipse/cdt/internal/core/pdom/dom/FindBindingsInBTree.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/FindBindingsInBTree.java,v >retrieving revision 1.4 >diff -u -r1.4 FindBindingsInBTree.java >--- parser/org/eclipse/cdt/internal/core/pdom/dom/FindBindingsInBTree.java 20 Oct 2006 13:19:52 -0000 1.4 >+++ parser/org/eclipse/cdt/internal/core/pdom/dom/FindBindingsInBTree.java 19 Jan 2007 20:07:46 -0000 >@@ -14,6 +14,7 @@ > import java.util.List; > > import org.eclipse.cdt.core.dom.ast.IBinding; >+import org.eclipse.cdt.core.parser.util.CharArrayUtils; > import org.eclipse.cdt.internal.core.pdom.db.IBTreeVisitor; > import org.eclipse.core.runtime.CoreException; > >@@ -24,11 +25,16 @@ > > public int compare(int record) throws CoreException { > PDOMNamedNode node = ((PDOMNamedNode)linkage.getNode(record)); >- return node.getDBName().compare(name); >+ if (prefixLookup) { >+ return CharArrayUtils.equals(node.getDBName().getChars(), name, true) ? 0 : 1; >+ } else { >+ return node.getDBName().compare(name); >+ } > } > > private List bindings = new ArrayList(); > private final int[] desiredType; >+ private boolean prefixLookup; > > /** > * Matches all types. >@@ -37,7 +43,7 @@ > * @param name > */ > public FindBindingsInBTree(PDOMLinkage linkage, char[] name) { >- this(linkage, name, null); >+ this(linkage, name, null, false); > } > > /** >@@ -48,7 +54,7 @@ > * @param desiredType > */ > public FindBindingsInBTree(PDOMLinkage linkage, char[] name, int desiredType) { >- this(linkage, name, new int[] { desiredType }); >+ this(linkage, name, new int[] { desiredType }, false); > } > > /** >@@ -59,9 +65,21 @@ > * @param desiredType > */ > public FindBindingsInBTree(PDOMLinkage linkage, char[] name, int[] desiredType) { >+ this(linkage, name, desiredType, false); >+ } >+ >+ /** >+ * Match a prefix. >+ * >+ * @param pdom >+ * @param name >+ * @param desiredType >+ */ >+ public FindBindingsInBTree(PDOMLinkage linkage, char[] name, int[] desiredType, boolean prefixLookup) { > this.name = name; > this.desiredType = desiredType; > this.linkage= linkage; >+ this.prefixLookup = prefixLookup; > } > > public boolean visit(int record) throws CoreException { >@@ -69,7 +87,10 @@ > return true; > > PDOMBinding tBinding = linkage.getPDOM().getBinding(record); >- if (!tBinding.hasName(name)) >+ if (!CharArrayUtils.equals( >+ tBinding.getNameCharArray(), >+ name, >+ prefixLookup)) > // no more bindings with our desired name > return false; > >Index: parser/org/eclipse/cdt/core/index/IIndex.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IIndex.java,v >retrieving revision 1.4 >diff -u -r1.4 IIndex.java >--- parser/org/eclipse/cdt/core/index/IIndex.java 6 Dec 2006 10:41:26 -0000 1.4 >+++ parser/org/eclipse/cdt/core/index/IIndex.java 19 Jan 2007 20:07:45 -0000 >@@ -224,6 +224,19 @@ > public IIndexBinding[] findBindings(Pattern[] patterns, boolean isFullyQualified, IndexFilter filter, IProgressMonitor monitor) throws CoreException; > > /** >+ * Searches all top level bindings for names that have the given prefix in >+ * the given linkage. The filter collects all of the resulting bindings that >+ * it finds to be valid. >+ * >+ * @param prefix the prefix to be included in all resulting bindings >+ * @param linkage the linkage to be searched >+ * @param filter adds additional conditions to whether or not a binding is >+ * collected >+ * @throws CoreException >+ */ >+ public void filterBindings(char[] prefix, ILinkage linkage, BindingFilter filter) throws CoreException; >+ >+ /** > * Searches the global scope for all bindings of a given name and linkage. > * In case a binding exists in multiple projects, no duplicate bindings are returned. > * @param linkage the linkage to be searched >Index: parser/org/eclipse/cdt/internal/core/index/CIndex.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/CIndex.java,v >retrieving revision 1.7 >diff -u -r1.7 CIndex.java >--- parser/org/eclipse/cdt/internal/core/index/CIndex.java 6 Dec 2006 10:41:24 -0000 1.7 >+++ parser/org/eclipse/cdt/internal/core/index/CIndex.java 19 Jan 2007 20:07:46 -0000 >@@ -25,6 +25,7 @@ > import org.eclipse.cdt.core.dom.IName; > import org.eclipse.cdt.core.dom.ast.IASTName; > import org.eclipse.cdt.core.dom.ast.IBinding; >+import org.eclipse.cdt.core.index.BindingFilter; > import org.eclipse.cdt.core.index.IIndex; > import org.eclipse.cdt.core.index.IIndexBinding; > import org.eclipse.cdt.core.index.IIndexFile; >@@ -34,6 +35,7 @@ > import org.eclipse.cdt.core.index.IndexFilter; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.NullProgressMonitor; > import org.eclipse.core.runtime.SubProgressMonitor; > > public class CIndex implements IIndex { >@@ -155,7 +157,28 @@ > return (IIndexBinding[]) result.toArray(new IIndexBinding[result.size()]); > } > >- >+ public void filterBindings(char[] prefix, ILinkage linkage, >+ BindingFilter filter) throws CoreException { >+ IIndexBinding[] bindings = findBindings( >+ Pattern.compile( >+ createIgnoreCasePattern(new String(prefix)) + "((\\w)*)"), >+ true, >+ IndexFilter.getFilter(linkage), >+ new NullProgressMonitor()); >+ >+ filter.handleBindings(bindings); >+ } >+ >+ private String createIgnoreCasePattern(String name) { >+ String name1 = name.toLowerCase(); >+ String name2 = name.toUpperCase(); >+ StringBuffer buffer = new StringBuffer(name.length()*5); >+ for (int i = 0; i < name.length(); i++) { >+ buffer.append("(" + name1.charAt(i) + "|" + name2.charAt(i) + ")"); >+ } >+ return buffer.toString(); >+ } >+ > public IIndexName[] findNames(IBinding binding, int flags) throws CoreException { > ArrayList result= new ArrayList(); > for (int i = 0; i < fPrimaryFragmentCount; i++) { >Index: parser/org/eclipse/cdt/internal/core/index/EmptyCIndex.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/EmptyCIndex.java,v >retrieving revision 1.4 >diff -u -r1.4 EmptyCIndex.java >--- parser/org/eclipse/cdt/internal/core/index/EmptyCIndex.java 6 Dec 2006 10:41:24 -0000 1.4 >+++ parser/org/eclipse/cdt/internal/core/index/EmptyCIndex.java 19 Jan 2007 20:07:46 -0000 >@@ -16,6 +16,7 @@ > import org.eclipse.cdt.core.dom.ILinkage; > import org.eclipse.cdt.core.dom.IName; > import org.eclipse.cdt.core.dom.ast.IBinding; >+import org.eclipse.cdt.core.index.BindingFilter; > import org.eclipse.cdt.core.index.IIndex; > import org.eclipse.cdt.core.index.IIndexBinding; > import org.eclipse.cdt.core.index.IIndexFile; >@@ -94,6 +95,10 @@ > return IIndexFragmentBinding.EMPTY_INDEX_BINDING_ARRAY; > } > >+ public void filterBindings(char[] prefix, ILinkage linkage, >+ BindingFilter filter) throws CoreException { >+ } >+ > public IIndexBinding adaptBinding(IBinding binding) throws CoreException { > return null; > } >Index: parser/org/eclipse/cdt/core/dom/ast/gnu/c/GCCLanguage.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/gnu/c/GCCLanguage.java,v >retrieving revision 1.27 >diff -u -r1.27 GCCLanguage.java >--- parser/org/eclipse/cdt/core/dom/ast/gnu/c/GCCLanguage.java 5 Jan 2007 13:12:22 -0000 1.27 >+++ parser/org/eclipse/cdt/core/dom/ast/gnu/c/GCCLanguage.java 19 Jan 2007 20:07:45 -0000 >@@ -97,7 +97,8 @@ > scanner, > ParserMode.COMPLETION_PARSE, > ParserUtil.getParserLogService(), >- new GCCParserExtensionConfiguration()); >+ new GCCParserExtensionConfiguration(), >+ index); > > // Run the parse and return the completion node > parser.parse(); >Index: parser/org/eclipse/cdt/core/dom/ast/IScope.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IScope.java,v >retrieving revision 1.15 >diff -u -r1.15 IScope.java >--- parser/org/eclipse/cdt/core/dom/ast/IScope.java 20 Oct 2006 15:02:43 -0000 1.15 >+++ parser/org/eclipse/cdt/core/dom/ast/IScope.java 19 Jan 2007 20:07:45 -0000 >@@ -44,7 +44,7 @@ > * @param searchString > * @return List of IBinding > */ >- public IBinding[] find(String name) throws DOMException; >+ public IBinding[] find(String name, boolean prefixLookup) throws DOMException; > > /** > * Get the binding in this scope that the given name would resolve to. Could >Index: parser/org/eclipse/cdt/internal/core/parser/scanner2/LocationMap.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/LocationMap.java,v >retrieving revision 1.67 >diff -u -r1.67 LocationMap.java >--- parser/org/eclipse/cdt/internal/core/parser/scanner2/LocationMap.java 4 Dec 2006 07:53:38 -0000 1.67 >+++ parser/org/eclipse/cdt/internal/core/parser/scanner2/LocationMap.java 19 Jan 2007 20:07:46 -0000 >@@ -2281,6 +2281,17 @@ > count += value; > startAt += value; > } >+ >+ if (source instanceof _TranslationUnit) { >+ IMacroDefinition[] m = ((_TranslationUnit) source).getBuiltinMacroDefinitions(); >+ for (int i = 0; i < m.length; ++i) { >+ if (m[i] instanceof _ObjectMacroDefinition || m[i] instanceof _FunctionMacroDefinition) { >+ int value = collectContexts(key, (_Context) m[i], result, startAt); >+ count += value; >+ startAt += value; >+ } >+ } >+ } > } > return count; > } >Index: parser/org/eclipse/cdt/internal/core/dom/parser/ProblemBinding.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ProblemBinding.java,v >retrieving revision 1.24 >diff -u -r1.24 ProblemBinding.java >--- parser/org/eclipse/cdt/internal/core/dom/parser/ProblemBinding.java 6 Dec 2006 10:41:32 -0000 1.24 >+++ parser/org/eclipse/cdt/internal/core/dom/parser/ProblemBinding.java 19 Jan 2007 20:07:45 -0000 >@@ -138,7 +138,7 @@ > /* (non-Javadoc) > * @see org.eclipse.cdt.core.dom.ast.IScope#find(java.lang.String) > */ >- public IBinding[] find( String name ) throws DOMException { >+ public IBinding[] find( String name, boolean prefixLookup ) throws DOMException { > throw new DOMException( this ); > } > >Index: parser/org/eclipse/cdt/internal/core/dom/parser/IASTCompletionContext.java >=================================================================== >RCS file: parser/org/eclipse/cdt/internal/core/dom/parser/IASTCompletionContext.java >diff -N parser/org/eclipse/cdt/internal/core/dom/parser/IASTCompletionContext.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ parser/org/eclipse/cdt/internal/core/dom/parser/IASTCompletionContext.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,44 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 QNX Software Systems and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * QNX - Initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.cdt.internal.core.dom.parser; >+ >+import org.eclipse.cdt.core.dom.ast.IASTName; >+import org.eclipse.cdt.core.dom.ast.IBinding; >+ >+/** >+ * Interface for a code completion's context. Used for context-sensitive >+ * finding of bindings with a certain prefix. >+ * >+ * <p> >+ * This interface is not intended to be implemented by clients. >+ * </p> >+ * <p> >+ * <strong>EXPERIMENTAL</strong>. This class or interface has been added as >+ * part of a work in progress. There is no guarantee that this API will work or >+ * that it will remain the same. Please do not use this API without consulting >+ * with the CDT team. >+ * </p> >+ * >+ * @author Bryan Wilkinson >+ * @since 4.0 >+ */ >+public interface IASTCompletionContext { >+ >+ /** >+ * Returns bindings that start with the given prefix, only considering those >+ * that are valid for this context. >+ * >+ * @param n the name containing a prefix >+ * @return valid bindings in this context for the given prefix >+ */ >+ IBinding[] resolvePrefix(IASTName n); >+} >Index: parser/org/eclipse/cdt/core/index/BindingFilter.java >=================================================================== >RCS file: parser/org/eclipse/cdt/core/index/BindingFilter.java >diff -N parser/org/eclipse/cdt/core/index/BindingFilter.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ parser/org/eclipse/cdt/core/index/BindingFilter.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,85 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 QNX Software Systems and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * QNX - Initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.cdt.core.index; >+ >+import java.util.ArrayList; >+import java.util.List; >+ >+import org.eclipse.cdt.core.dom.ast.IBinding; >+ >+/** >+ * Objects of this class act as a filter to decide whether or not bindings are >+ * valid. Subclasses must implement the isValidBinding(IBinding) method. Any >+ * bindings that are handled and that satisfy the conditions of >+ * isValidBinding(IBinding) will ge returned as an array when the getBinding() >+ * method is called. >+ * >+ * Subclasses can implement a filter with multiple behaviours by overridding the >+ * changeFilter() method. >+ * >+ * @author bwilkinson >+ */ >+public abstract class BindingFilter { >+ >+ /** >+ * The valid bindings that have been collected so far. >+ */ >+ protected List bindings = new ArrayList(); >+ >+ /** >+ * Determines whether or not a binding is valid. >+ * >+ * @param binding the binding being checked for validity >+ * @return whether or not the binding is valid >+ */ >+ protected abstract boolean isValidBinding(IBinding binding); >+ >+ /** >+ * Checks the validity of the binding, and collects it if it is valid. >+ * >+ * @param binding the binding to handle >+ */ >+ public void handleBinding(IBinding binding) { >+ if (isValidBinding(binding)) { >+ bindings.add(binding); >+ } >+ } >+ >+ /** >+ * Checks the validity of an array of bindings, and collects those that are >+ * valid. >+ * >+ * @param bindings >+ * the bindings to handle >+ */ >+ public void handleBindings(IBinding[] bindings) { >+ for (int i = 0; i < bindings.length; i++) { >+ handleBinding(bindings[i]); >+ } >+ } >+ >+ /** >+ * Gets the valid bindings that have been collected. >+ * >+ * @return an array of valid bindings >+ */ >+ public IBinding[] getBindings() { >+ return (IBinding[]) bindings.toArray(new IBinding[bindings.size()]); >+ } >+ >+ /** >+ * Alters the behaviour of the filter. >+ */ >+ public void changeFilter() { >+ //By default, do not alter the behaviour >+ } >+} >#P org.eclipse.cdt.refactoring >Index: src/org/eclipse/cdt/internal/refactoring/ASTManager.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.refactoring/src/org/eclipse/cdt/internal/refactoring/ASTManager.java,v >retrieving revision 1.16 >diff -u -r1.16 ASTManager.java >--- src/org/eclipse/cdt/internal/refactoring/ASTManager.java 12 Oct 2006 13:23:50 -0000 1.16 >+++ src/org/eclipse/cdt/internal/refactoring/ASTManager.java 19 Jan 2007 20:07:46 -0000 >@@ -746,7 +746,7 @@ > if (baseType != null) { > IScope baseScope= baseType.getCompositeScope(); > if (baseScope != null) { >- IBinding[] alternates= baseScope.find(method.getName()); >+ IBinding[] alternates= baseScope.find(method.getName(), false); > for (int j = 0; j < alternates.length; j++) { > IBinding binding = alternates[j]; > if (binding instanceof CPPMethod) { >@@ -795,7 +795,7 @@ > public static IBinding[] findInScope(final IScope scope, String name, > boolean removeGlobalsWhenClassScope) throws DOMException { > IBinding[] result= null; >- result = scope.find(name); >+ result = scope.find(name, false); > if (result == null || result.length==0) { > return result; > } >Index: src/org/eclipse/cdt/internal/refactoring/CRenameClassProcessor.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.refactoring/src/org/eclipse/cdt/internal/refactoring/CRenameClassProcessor.java,v >retrieving revision 1.1 >diff -u -r1.1 CRenameClassProcessor.java >--- src/org/eclipse/cdt/internal/refactoring/CRenameClassProcessor.java 9 Mar 2005 21:49:02 -0000 1.1 >+++ src/org/eclipse/cdt/internal/refactoring/CRenameClassProcessor.java 19 Jan 2007 20:07:46 -0000 >@@ -45,7 +45,7 @@ > > IScope scope= ctype.getCompositeScope(); > if (scope != null) { >- IBinding[] dtors= scope.find("~" + argument.getName()); //$NON-NLS-1$ >+ IBinding[] dtors= scope.find("~" + argument.getName(), false); //$NON-NLS-1$ > if (dtors != null) { > bindings.addAll(Arrays.asList(dtors)); > } >#P org.eclipse.cdt.core.tests >Index: parser/org/eclipse/cdt/internal/pdom/tests/ClassTests.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/ClassTests.java,v >retrieving revision 1.12 >diff -u -r1.12 ClassTests.java >--- parser/org/eclipse/cdt/internal/pdom/tests/ClassTests.java 10 Nov 2006 10:55:11 -0000 1.12 >+++ parser/org/eclipse/cdt/internal/pdom/tests/ClassTests.java 19 Jan 2007 20:07:48 -0000 >@@ -97,7 +97,7 @@ > IBinding[] bindings = pdom.findBindings(Pattern.compile("pr147903"), false, new IndexFilter(), new NullProgressMonitor()); > assertEquals(1, bindings.length); > ICPPNamespaceScope ns = ((ICPPNamespace)bindings[0]).getNamespaceScope(); >- bindings = ns.find("testRef"); >+ bindings = ns.find("testRef", false); > assertEquals(1, bindings.length); > IName[] refs = pdom.findNames(bindings[0], IIndex.FIND_REFERENCES); > for (int i = 0; i < refs.length; ++i) >Index: parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java,v >retrieving revision 1.110 >diff -u -r1.110 AST2Tests.java >--- parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java 3 Jan 2007 12:01:47 -0000 1.110 >+++ parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java 19 Jan 2007 20:07:48 -0000 >@@ -3001,11 +3001,11 @@ > > IScope scope = f.getFunctionScope(); > >- IBinding[] bs = scope.find("par"); //$NON-NLS-1$ >+ IBinding[] bs = scope.find("par", false); //$NON-NLS-1$ > assertEquals(bs.length, 1); > assertSame(bs[0], p); > >- bs = scope.find("v1"); //$NON-NLS-1$ >+ bs = scope.find("v1", false); //$NON-NLS-1$ > assertEquals(bs.length, 1); > assertSame(bs[0], v1); > } >@@ -3033,7 +3033,7 @@ > > IScope scope = f.getFunctionScope(); > >- IBinding[] bs = scope.find("S"); //$NON-NLS-1$ >+ IBinding[] bs = scope.find("S", false); //$NON-NLS-1$ > > assertNotNull(S2); > assertEquals(bs.length, 3); >Index: parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java,v >retrieving revision 1.173 >diff -u -r1.173 AST2CPPTests.java >--- parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java 29 Sep 2006 07:19:50 -0000 1.173 >+++ parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java 19 Jan 2007 20:07:48 -0000 >@@ -3049,7 +3049,7 @@ > assertFalse(v2.isGloballyQualified()); > > ICPPBlockScope scope = (ICPPBlockScope) v2.getScope(); >- IBinding[] bs = scope.find("v1"); //$NON-NLS-1$ >+ IBinding[] bs = scope.find("v1", false); //$NON-NLS-1$ > assertEquals(bs.length, 1); > assertSame(bs[0], v1); > } >@@ -3072,16 +3072,16 @@ > ICPPMethod f = (ICPPMethod) col.getName(7).resolveBinding(); > > IScope scope = f.getFunctionScope(); >- IBinding[] bs = scope.find("a"); //$NON-NLS-1$ >+ IBinding[] bs = scope.find("a", false); //$NON-NLS-1$ > assertEquals(bs.length, 1); > assertSame(bs[0], a); > >- bs = scope.find("~B"); //$NON-NLS-1$ >+ bs = scope.find("~B", false); //$NON-NLS-1$ > assertEquals(bs.length, 1); > assertTrue(bs[0] instanceof ICPPMethod); > assertTrue(bs[0].getName().equals("~B")); //$NON-NLS-1$ > >- bs = scope.find("A"); //$NON-NLS-1$ >+ bs = scope.find("A", false); //$NON-NLS-1$ > assertEquals(bs.length, 1); > assertSame(bs[0], A); > } >@@ -3108,7 +3108,7 @@ > IASTFunctionDefinition def = (IASTFunctionDefinition) col.getName(5) > .getParent().getParent(); > IScope scope = ((IASTCompoundStatement) def.getBody()).getScope(); >- IBinding[] bs = scope.find("f"); //$NON-NLS-1$ >+ IBinding[] bs = scope.find("f", false); //$NON-NLS-1$ > assertEquals(bs.length, 3); > assertSame(bs[0], f3); > assertSame(((ICPPDelegate) bs[1]).getBinding(), f1); >@@ -3157,7 +3157,7 @@ > IASTFunctionDefinition def = (IASTFunctionDefinition) col.getName(8) > .getParent().getParent(); > IScope scope = ((IASTCompoundStatement) def.getBody()).getScope(); >- IBinding[] bs = scope.find("f"); //$NON-NLS-1$ >+ IBinding[] bs = scope.find("f", false); //$NON-NLS-1$ > assertEquals(bs.length, 3); > assertSame(bs[0], f); > assertSame(bs[1], f1); >@@ -3395,7 +3395,7 @@ > IFunction f2 = (IFunction) col.getName(3).resolveBinding(); > > IScope scope = tu.getScope(); >- IBinding[] bs = scope.find("f"); //$NON-NLS-1$ >+ IBinding[] bs = scope.find("f", false); //$NON-NLS-1$ > assertEquals(bs.length, 2); > assertSame(bs[0], f1); > assertSame(bs[1], f2); >#P org.eclipse.cdt.ui.tests >Index: ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests.java,v >retrieving revision 1.1 >diff -u -r1.1 CompletionTests.java >--- ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests.java 9 Jan 2007 14:41:30 -0000 1.1 >+++ ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests.java 19 Jan 2007 20:07:49 -0000 >@@ -42,11 +42,11 @@ > //C2* gfC2(); > //static C3* gfC3(); > // >-//enum E1 {e11, e12}; >+//enum N1 {e11, e12}; > // > //class C1 { > //public: >-// enum E2 {e21, e22}; >+// enum N2 {e21, e22}; > // > // C1* fMySelf; > // void iam1(); >@@ -239,7 +239,7 @@ > //void f() {gf/*cursor*/ > public void testGlobalFunctions_GlobalScope() throws Exception { > final String[] expected= { >- "gfC1(void)", "gfC2(void)", "gfC3(void)" >+ "gfC1(void)", "gfC2(void)" > }; > assertCompletionResults(fCursorOffset, expected, true); > } >@@ -247,7 +247,7 @@ > //void C3::f() {gf/*cursor*/ > public void testGlobalFunctions_MethodScope() throws Exception { > final String[] expected= { >- "gfC1(void)", "gfC2(void)", "gfC3(void)" >+ "gfC1(void)", "gfC2(void)" > }; > assertCompletionResults(fCursorOffset, expected, true); > } >Index: ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_ClassReference_Prefix.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_ClassReference_Prefix.java,v >retrieving revision 1.5 >diff -u -r1.5 CompletionTest_ClassReference_Prefix.java >--- ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_ClassReference_Prefix.java 9 Jan 2007 10:39:04 -0000 1.5 >+++ ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_ClassReference_Prefix.java 19 Jan 2007 20:07:49 -0000 >@@ -30,22 +30,10 @@ > private final String[] expectedResults = { > "aClass", //$NON-NLS-1$ > "anotherClass" //$NON-NLS-1$ >- /* FIXME: Additional results which should not be there. Run with trace enabled to reproduce: >- Result: aFirstEnum >- Result: aFunction(void) bool >- Result: aNamespace >- Result: anEnumeration >- Result: anotherFunction(void) void >- Result: aSecondEnum >- Result: aThirdEnum >- Result: aVariable : int >- */ > }; > > public CompletionTest_ClassReference_Prefix(String name) { > super(name); >- // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=88787 >- setExpectFailure(88787); > } > > public static Test suite() { >Index: ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_ArgumentType_Prefix.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_ArgumentType_Prefix.java,v >retrieving revision 1.6 >diff -u -r1.6 CompletionTest_ArgumentType_Prefix.java >--- ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_ArgumentType_Prefix.java 9 Jan 2007 10:39:04 -0000 1.6 >+++ ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_ArgumentType_Prefix.java 19 Jan 2007 20:07:49 -0000 >@@ -31,23 +31,11 @@ > "anotherClass", > "aNamespace", > "anEnumeration", >- // missing proposal: > "AStruct" >- /* FIXME: Additional results which should not be there. Run with trace enabled to reproduce: >-Result: aFirstEnum >-Result: aFunction(void) bool >-Result: anotherFunction(void) void >-Result: aSecondEnum >-Result: aThirdEnum >-Result: aVariable : int >- */ > }; > > public CompletionTest_ArgumentType_Prefix(String name) { > super(name); >- // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=109724 >- // and https://bugs.eclipse.org/bugs/show_bug.cgi?id=88787 >- setExpectFailure(109724); > } > > public static Test suite() { >Index: ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_VariableType_Prefix.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_VariableType_Prefix.java,v >retrieving revision 1.6 >diff -u -r1.6 CompletionTest_VariableType_Prefix.java >--- ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_VariableType_Prefix.java 9 Jan 2007 10:39:04 -0000 1.6 >+++ ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_VariableType_Prefix.java 19 Jan 2007 20:07:49 -0000 >@@ -29,23 +29,11 @@ > "anotherClass", > "aNamespace", > "anEnumeration", >- // missing proposal: > "AStruct" >- /* Superfluous proposals: >- "aFirstEnum", >- "aFunction(void) bool", >- "aSecondEnum", >- "aThirdEnum", >- "aVariable : int", >- "anotherFunction(void) void" >- */ > }; > > public CompletionTest_VariableType_Prefix(String name) { > super(name); >- // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=109724 >- // and https://bugs.eclipse.org/bugs/show_bug.cgi?id=88787 >- setExpectFailure(109724); > } > > public static Test suite() { >Index: ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_FieldType_Prefix.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_FieldType_Prefix.java,v >retrieving revision 1.4 >diff -u -r1.4 CompletionTest_FieldType_Prefix.java >--- ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_FieldType_Prefix.java 9 Jan 2007 10:39:04 -0000 1.4 >+++ ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_FieldType_Prefix.java 19 Jan 2007 20:07:49 -0000 >@@ -30,23 +30,11 @@ > "aThirdClass", > "aNamespace", > "anEnumeration", >- // missing proposal: > "AStruct" >- /* FIXME: Additional results which should not be returned. Run with tracing enabled to reproduce: >-Result: aFirstEnum >-Result: aFunction(void) bool >-Result: anotherFunction(void) void >-Result: aSecondEnum >-Result: aThirdEnum >-Result: aVariable : int >- */ > }; > > public CompletionTest_FieldType_Prefix(String name) { > super(name); >- // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=109724 >- // and https://bugs.eclipse.org/bugs/show_bug.cgi?id=88787 >- setExpectFailure(109724); > } > > public static Test suite() { >Index: ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_FunctionReference_Prefix.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_FunctionReference_Prefix.java,v >retrieving revision 1.7 >diff -u -r1.7 CompletionTest_FunctionReference_Prefix.java >--- ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_FunctionReference_Prefix.java 10 Jan 2007 08:28:07 -0000 1.7 >+++ ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_FunctionReference_Prefix.java 19 Jan 2007 20:07:49 -0000 >@@ -40,14 +40,12 @@ > "xSecondEnum", > "xThirdEnum", > "xEnumeration", >- /* FIXME: DOM search is currently case sensitive? */ >- "XMacro(x,y)" >+ "XMacro(x, y)", >+ "XStruct" > }; > > public CompletionTest_FunctionReference_Prefix(String name) { > super(name); >- // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=109724 >- setExpectFailure(109724); > } > > public static Test suite() { >Index: ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_SingleName_Prefix2.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_SingleName_Prefix2.java,v >retrieving revision 1.6 >diff -u -r1.6 CompletionTest_SingleName_Prefix2.java >--- ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_SingleName_Prefix2.java 9 Jan 2007 10:39:04 -0000 1.6 >+++ ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_SingleName_Prefix2.java 19 Jan 2007 20:07:49 -0000 >@@ -35,14 +35,12 @@ > "aFirstEnum", > "aSecondEnum", > "aThirdEnum", >- // missing proposal: >- "AMacro(x)" >+ "AMacro(x)", >+ "AStruct" > }; > > public CompletionTest_SingleName_Prefix2(String name) { > super(name); >- // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=109724 >- setExpectFailure(109724); > } > > public static Test suite() { >Index: ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_ArgumentType_Prefix2.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_ArgumentType_Prefix2.java,v >retrieving revision 1.6 >diff -u -r1.6 CompletionTest_ArgumentType_Prefix2.java >--- ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_ArgumentType_Prefix2.java 9 Jan 2007 10:39:04 -0000 1.6 >+++ ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_ArgumentType_Prefix2.java 19 Jan 2007 20:07:49 -0000 >@@ -31,23 +31,11 @@ > "anotherClass", > "aNamespace", > "anEnumeration", >- // missing proposal: > "AStruct" >- /* FIXME: Additional results which should not be there. Run with trace enabled to reproduce: >-Result: aFirstEnum >-Result: aFunction(void) bool >-Result: anotherFunction(void) void >-Result: aSecondEnum >-Result: aThirdEnum >-Result: aVariable : int >- */ > }; > > public CompletionTest_ArgumentType_Prefix2(String name) { > super(name); >- // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=109724 >- // and https://bugs.eclipse.org/bugs/show_bug.cgi?id=88787 >- setExpectFailure(109724); > } > > public static Test suite() { >Index: ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_TypeRef_NoPrefix.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_TypeRef_NoPrefix.java,v >retrieving revision 1.5 >diff -u -r1.5 CompletionTest_TypeRef_NoPrefix.java >--- ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_TypeRef_NoPrefix.java 9 Jan 2007 10:39:04 -0000 1.5 >+++ ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_TypeRef_NoPrefix.java 19 Jan 2007 20:07:49 -0000 >@@ -29,32 +29,10 @@ > private final String[] expectedResults = { > "aNamespace", > "xNamespace" >- /* FIXME: Additional results which should not be there. Run with trace enabled to reproduce: >-Result: aClass >-Result: aFirstEnum >-Result: aFunction(void) bool >-Result: anEnumeration >-Result: anotherClass >-Result: anotherFunction(void) void >-Result: aSecondEnum >-Result: AStruct >-Result: aThirdEnum >-Result: aVariable : int >-Result: xEnumeration >-Result: xFirstEnum >-Result: xFunction(void) bool >-Result: xOtherClass >-Result: xOtherFunction(void) void >-Result: xSecondEnum >-Result: XStruct >-Result: xThirdEnum >-Result: xVariable : int >- */ }; >+ }; > > public CompletionTest_TypeRef_NoPrefix(String name) { > super(name); >- // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=88787 >- setExpectFailure(88787); > } > > public static Test suite() { >Index: ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_NamespaceRef_Prefix.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_NamespaceRef_Prefix.java,v >retrieving revision 1.3 >diff -u -r1.3 CompletionTest_NamespaceRef_Prefix.java >--- ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_NamespaceRef_Prefix.java 9 Jan 2007 10:39:04 -0000 1.3 >+++ ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_NamespaceRef_Prefix.java 19 Jan 2007 20:07:49 -0000 >@@ -29,13 +29,10 @@ > private final String expectedPrefix = "a"; > private final String[] expectedResults = { > "aNamespace" >- /* FIXME: extra results */ > }; > > public CompletionTest_NamespaceRef_Prefix(String name) { > super(name); >- // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=88787 >- setExpectFailure(88787); > } > > public static Test suite() { >Index: ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_ExceptionReference_Prefix.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_ExceptionReference_Prefix.java,v >retrieving revision 1.6 >diff -u -r1.6 CompletionTest_ExceptionReference_Prefix.java >--- ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_ExceptionReference_Prefix.java 9 Jan 2007 10:39:04 -0000 1.6 >+++ ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_ExceptionReference_Prefix.java 19 Jan 2007 20:07:49 -0000 >@@ -33,25 +33,11 @@ > "anotherClass", > "aNamespace", > "anEnumeration", >- // missing proposal: > "AStruct" >- /* FIXME: Additional results which should not be there. Run with trace enabled to reproduce: >-Result: aFirstEnum >-Result: aFunction(void) bool >-Result: anotherField : int >-Result: anotherFunction(void) void >-Result: anotherMethod(void) void >-Result: aSecondEnum >-Result: aThirdEnum >-Result: aVariable : int >- */ > }; > > public CompletionTest_ExceptionReference_Prefix(String name) { > super(name); >- // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=109724 >- // and https://bugs.eclipse.org/bugs/show_bug.cgi?id=88787 >- setExpectFailure(109724); > } > > public static Test suite() { >Index: ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_TypeRef_Prefix.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_TypeRef_Prefix.java,v >retrieving revision 1.5 >diff -u -r1.5 CompletionTest_TypeRef_Prefix.java >--- ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_TypeRef_Prefix.java 9 Jan 2007 10:39:04 -0000 1.5 >+++ ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_TypeRef_Prefix.java 19 Jan 2007 20:07:49 -0000 >@@ -29,22 +29,10 @@ > private final String expectedPrefix = "a"; > private final String[] expectedResults = { > "aNamespace" >- /* FIXME: Additional results which should not be there. Run with trace enabled to reproduce: >-Result: aClass >-Result: aFirstEnum >-Result: aFunction(void) bool >-Result: anEnumeration >-Result: anotherClass >-Result: anotherFunction(void) void >-Result: aSecondEnum >-Result: aThirdEnum >-Result: aVariable : int >- */ }; >+ }; > > public CompletionTest_TypeRef_Prefix(String name) { > super(name); >- // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=88787 >- setExpectFailure(88787); > } > > public static Test suite() { >Index: ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_SingleName_Method_Prefix.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_SingleName_Method_Prefix.java,v >retrieving revision 1.6 >diff -u -r1.6 CompletionTest_SingleName_Method_Prefix.java >--- ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_SingleName_Method_Prefix.java 9 Jan 2007 10:39:04 -0000 1.6 >+++ ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_SingleName_Method_Prefix.java 19 Jan 2007 20:07:49 -0000 >@@ -38,15 +38,12 @@ > "aFirstEnum", > "aSecondEnum", > "aThirdEnum", >- // missing proposals: > "AStruct", > "AMacro(x)" > }; > > public CompletionTest_SingleName_Method_Prefix(String name) { > super(name); >- // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=109724 >- setExpectFailure(109724); > } > > public static Test suite() {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 169860
:
57170
|
57533
|
57624