diff options
author | Andrew Niefer | 2004-05-21 21:08:40 +0000 |
---|---|---|
committer | Andrew Niefer | 2004-05-21 21:08:40 +0000 |
commit | a4bc1beabc387bf085a4c3d5a36205fbda38a5ff (patch) | |
tree | da7ac5e7105cb6abba837a43c1eff44024f47c4e | |
parent | 4b1ecbf65bb678389b4b1c10e9689458753d9194 (diff) | |
download | org.eclipse.cdt-a4bc1beabc387bf085a4c3d5a36205fbda38a5ff.tar.gz org.eclipse.cdt-a4bc1beabc387bf085a4c3d5a36205fbda38a5ff.tar.xz org.eclipse.cdt-a4bc1beabc387bf085a4c3d5a36205fbda38a5ff.zip |
fix bug 63478
3 files changed, 23 insertions, 1 deletions
diff --git a/core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/FunctionMethodPatternTests.java b/core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/FunctionMethodPatternTests.java index 0f0672dee91..c10ca4bde46 100644 --- a/core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/FunctionMethodPatternTests.java +++ b/core/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/FunctionMethodPatternTests.java @@ -224,4 +224,14 @@ public class FunctionMethodPatternTests extends BaseSearchTest { matches = resultCollector.getSearchResults(); assertEquals( matches.size(), 0 ); } + + public void testBug63478(){ + ICSearchPattern pattern = SearchEngine.createSearchPattern( "A::B::f(*)", METHOD, DECLARATIONS, true ); + + search( workspace, pattern, scope, resultCollector ); + + Set matches = resultCollector.getSearchResults(); + + assertEquals( matches.size(), 4 ); + } } diff --git a/core/org.eclipse.cdt.core/search/ChangeLog b/core/org.eclipse.cdt.core/search/ChangeLog index 8dff347ebb9..f3d725a490e 100644 --- a/core/org.eclipse.cdt.core/search/ChangeLog +++ b/core/org.eclipse.cdt.core/search/ChangeLog @@ -1,3 +1,6 @@ +2004-05-21 Andrw Niefer + fix bug 63478 + 2004-05-21 Andrew Niefer Indexer problems reporting: group problems under the indexer job in progress view diff --git a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/CSearchPattern.java b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/CSearchPattern.java index 2f8792d4f83..2b10908c47f 100644 --- a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/CSearchPattern.java +++ b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/CSearchPattern.java @@ -39,9 +39,11 @@ import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException; import org.eclipse.cdt.core.parser.ast.ASTPointerOperator; import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier; import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit; +import org.eclipse.cdt.core.parser.ast.IASTDeclaration; import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier; import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier; import org.eclipse.cdt.core.parser.ast.IASTFunction; +import org.eclipse.cdt.core.parser.ast.IASTOffsetableElement; import org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration; import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier; import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier; @@ -500,7 +502,14 @@ public abstract class CSearchPattern implements ICSearchConstants, ICSearchPatte if( declarations == null || ! declarations.hasNext() ) return null; - IASTFunction function = (IASTFunction) declarations.next(); + + IASTDeclaration decl = (IASTDeclaration) declarations.next(); + if( !(decl instanceof IASTFunction) ){ + //if the user puts something not so good in the brackets, we might not get a function back + return list; + } + + IASTFunction function = (IASTFunction) decl; Iterator parameters = function.getParameters(); char [] param = null; |