mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Add IASTQualifiedNameElement.getFullyQualifiedNameCharArrays()
and modify Search to take advantage of the IAST providing char[]s.
This commit is contained in:
parent
a23d2613ac
commit
04b2ae06b5
22 changed files with 78 additions and 74 deletions
|
@ -17,4 +17,5 @@ package org.eclipse.cdt.core.parser.ast;
|
||||||
public interface IASTQualifiedNameElement
|
public interface IASTQualifiedNameElement
|
||||||
{
|
{
|
||||||
public String[] getFullyQualifiedName();
|
public String[] getFullyQualifiedName();
|
||||||
|
public char[][] getFullyQualifiedNameCharArrays();
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,6 +74,10 @@ public class ASTQualifiedNamedElement implements IASTQualifiedNameElement
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public char[][] getFullyQualifiedNameCharArrays(){
|
||||||
|
return qualifiedNames;
|
||||||
|
}
|
||||||
|
|
||||||
private final char[][] qualifiedNames;
|
private final char[][] qualifiedNames;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -212,6 +212,9 @@ public class ASTClassSpecifier extends ASTScope implements IASTClassSpecifier
|
||||||
{
|
{
|
||||||
return qualifiedName.getFullyQualifiedName();
|
return qualifiedName.getFullyQualifiedName();
|
||||||
}
|
}
|
||||||
|
public char[][] getFullyQualifiedNameCharArrays(){
|
||||||
|
return qualifiedName.getFullyQualifiedNameCharArrays();
|
||||||
|
}
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.parser.ast.IASTScopedElement#getOwnerScope()
|
* @see org.eclipse.cdt.core.parser.ast.IASTScopedElement#getOwnerScope()
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -109,7 +109,9 @@ public class ASTElaboratedTypeSpecifier extends ASTSymbol implements IASTElabora
|
||||||
{
|
{
|
||||||
return qualifiedName.getFullyQualifiedName();
|
return qualifiedName.getFullyQualifiedName();
|
||||||
}
|
}
|
||||||
|
public char[][] getFullyQualifiedNameCharArrays(){
|
||||||
|
return qualifiedName.getFullyQualifiedNameCharArrays();
|
||||||
|
}
|
||||||
public List getReferences()
|
public List getReferences()
|
||||||
{
|
{
|
||||||
return references;
|
return references;
|
||||||
|
|
|
@ -124,6 +124,9 @@ public class ASTEnumerationSpecifier
|
||||||
{
|
{
|
||||||
return qualifiedName.getFullyQualifiedName();
|
return qualifiedName.getFullyQualifiedName();
|
||||||
}
|
}
|
||||||
|
public char[][] getFullyQualifiedNameCharArrays(){
|
||||||
|
return qualifiedName.getFullyQualifiedNameCharArrays();
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier#freeReferences(org.eclipse.cdt.core.parser.ast.IReferenceManager)
|
* @see org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier#freeReferences(org.eclipse.cdt.core.parser.ast.IReferenceManager)
|
||||||
|
|
|
@ -160,6 +160,9 @@ public class ASTFunction extends ASTScope implements IASTFunction
|
||||||
{
|
{
|
||||||
return qualifiedName.getFullyQualifiedName();
|
return qualifiedName.getFullyQualifiedName();
|
||||||
}
|
}
|
||||||
|
public char[][] getFullyQualifiedNameCharArrays(){
|
||||||
|
return qualifiedName.getFullyQualifiedNameCharArrays();
|
||||||
|
}
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
|
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -108,6 +108,9 @@ public class ASTNamespaceDefinition
|
||||||
{
|
{
|
||||||
return qualifiedName.getFullyQualifiedName();
|
return qualifiedName.getFullyQualifiedName();
|
||||||
}
|
}
|
||||||
|
public char[][] getFullyQualifiedNameCharArrays(){
|
||||||
|
return qualifiedName.getFullyQualifiedNameCharArrays();
|
||||||
|
}
|
||||||
|
|
||||||
public Iterator getDeclarations()
|
public Iterator getDeclarations()
|
||||||
{
|
{
|
||||||
|
|
|
@ -115,6 +115,9 @@ public class ASTTypedef extends ASTSymbol implements IASTTypedefDeclaration
|
||||||
{
|
{
|
||||||
return qualifiedName.getFullyQualifiedName();
|
return qualifiedName.getFullyQualifiedName();
|
||||||
}
|
}
|
||||||
|
public char[][] getFullyQualifiedNameCharArrays(){
|
||||||
|
return qualifiedName.getFullyQualifiedNameCharArrays();
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration#getFinalTypeSpecifier()
|
* @see org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration#getFinalTypeSpecifier()
|
||||||
|
|
|
@ -144,6 +144,9 @@ public class ASTVariable extends ASTSymbol implements IASTVariable
|
||||||
{
|
{
|
||||||
return qualifiedName.getFullyQualifiedName();
|
return qualifiedName.getFullyQualifiedName();
|
||||||
}
|
}
|
||||||
|
public char[][] getFullyQualifiedNameCharArrays(){
|
||||||
|
return qualifiedName.getFullyQualifiedNameCharArrays();
|
||||||
|
}
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.parser.ast.IASTScopedElement#getOwnerScope()
|
* @see org.eclipse.cdt.core.parser.ast.IASTScopedElement#getOwnerScope()
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -81,6 +81,9 @@ public class ASTElaboratedTypeSpecifier extends ASTNode implements IASTElaborate
|
||||||
{
|
{
|
||||||
return qualifiedName.getFullyQualifiedName();
|
return qualifiedName.getFullyQualifiedName();
|
||||||
}
|
}
|
||||||
|
public char[][] getFullyQualifiedNameCharArrays(){
|
||||||
|
return qualifiedName.getFullyQualifiedNameCharArrays();
|
||||||
|
}
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
|
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -148,6 +148,9 @@ public class ASTFunction extends ASTDeclaration implements IASTFunction
|
||||||
{
|
{
|
||||||
return qualifiedName.getFullyQualifiedName();
|
return qualifiedName.getFullyQualifiedName();
|
||||||
}
|
}
|
||||||
|
public char[][] getFullyQualifiedNameCharArrays(){
|
||||||
|
return qualifiedName.getFullyQualifiedNameCharArrays();
|
||||||
|
}
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#accept(org.eclipse.cdt.core.parser.ISourceElementRequestor)
|
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#accept(org.eclipse.cdt.core.parser.ISourceElementRequestor)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -74,6 +74,9 @@ public class ASTNamespaceDefinition extends ASTDeclaration implements IASTNamesp
|
||||||
{
|
{
|
||||||
return qualifiedNameElement.getFullyQualifiedName();
|
return qualifiedNameElement.getFullyQualifiedName();
|
||||||
}
|
}
|
||||||
|
public char[][] getFullyQualifiedNameCharArrays(){
|
||||||
|
return qualifiedNameElement.getFullyQualifiedNameCharArrays();
|
||||||
|
}
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#accept(org.eclipse.cdt.core.parser.ISourceElementRequestor)
|
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#accept(org.eclipse.cdt.core.parser.ISourceElementRequestor)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -75,6 +75,9 @@ public class ASTTypedefDeclaration extends ASTDeclaration implements IASTTypedef
|
||||||
{
|
{
|
||||||
return qualifiedName.getFullyQualifiedName();
|
return qualifiedName.getFullyQualifiedName();
|
||||||
}
|
}
|
||||||
|
public char[][] getFullyQualifiedNameCharArrays(){
|
||||||
|
return qualifiedName.getFullyQualifiedNameCharArrays();
|
||||||
|
}
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#accept(org.eclipse.cdt.core.parser.ISourceElementRequestor)
|
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#accept(org.eclipse.cdt.core.parser.ISourceElementRequestor)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -147,6 +147,9 @@ public class ASTVariable extends ASTDeclaration implements IASTVariable
|
||||||
{
|
{
|
||||||
return qualifiedName.getFullyQualifiedName();
|
return qualifiedName.getFullyQualifiedName();
|
||||||
}
|
}
|
||||||
|
public char[][] getFullyQualifiedNameCharArrays(){
|
||||||
|
return qualifiedName.getFullyQualifiedNameCharArrays();
|
||||||
|
}
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#accept(org.eclipse.cdt.core.parser.ISourceElementRequestor)
|
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#accept(org.eclipse.cdt.core.parser.ISourceElementRequestor)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -630,11 +630,13 @@ public abstract class CSearchPattern implements ICSearchConstants, ICSearchPatte
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean matchQualifications( char[][] qualifications, char[][] candidate ){
|
protected boolean matchQualifications( char[][] qualifications, char[][] candidate ){
|
||||||
|
return matchQualifications( qualifications, candidate, false );
|
||||||
|
}
|
||||||
|
protected boolean matchQualifications( char[][] qualifications, char[][] candidate, boolean skipLastName ){
|
||||||
|
|
||||||
int qualLength = qualifications != null ? qualifications.length : 0;
|
int qualLength = qualifications != null ? qualifications.length : 0;
|
||||||
int candidateLength = candidate != null ? candidate.length : 0;
|
int candidateLength = candidate != null ? candidate.length - ( skipLastName ? 1 : 0 ) : 0;
|
||||||
|
|
||||||
if( qualLength == 0 ){
|
if( qualLength == 0 ){
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -86,32 +86,27 @@ public class ClassDeclarationPattern extends CSearchPattern {
|
||||||
if( ! canAccept( limit ) )
|
if( ! canAccept( limit ) )
|
||||||
return IMPOSSIBLE_MATCH;
|
return IMPOSSIBLE_MATCH;
|
||||||
|
|
||||||
String nodeName = null;
|
char[] nodeName = null;
|
||||||
if (node instanceof IASTElaboratedTypeSpecifier)
|
if (node instanceof IASTElaboratedTypeSpecifier)
|
||||||
{
|
{
|
||||||
nodeName = ((IASTElaboratedTypeSpecifier)node).getName();
|
nodeName = ((IASTElaboratedTypeSpecifier)node).getNameCharArray();
|
||||||
}
|
}
|
||||||
else if( node instanceof IASTOffsetableNamedElement )
|
else if( node instanceof IASTOffsetableNamedElement )
|
||||||
{
|
{
|
||||||
nodeName = ((IASTOffsetableNamedElement)node).getName();
|
nodeName = ((IASTOffsetableNamedElement)node).getNameCharArray();
|
||||||
} else {
|
} else {
|
||||||
return IMPOSSIBLE_MATCH;
|
return IMPOSSIBLE_MATCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
//check name, if simpleName == null, its treated the same as "*"
|
//check name, if simpleName == null, its treated the same as "*"
|
||||||
if( simpleName != null && !matchesName( simpleName, nodeName.toCharArray() ) ){
|
if( simpleName != null && !matchesName( simpleName, nodeName ) ){
|
||||||
return IMPOSSIBLE_MATCH;
|
return IMPOSSIBLE_MATCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( node instanceof IASTQualifiedNameElement ){
|
if( node instanceof IASTQualifiedNameElement ){
|
||||||
//create char[][] out of full name,
|
char [][] qualName = ((IASTQualifiedNameElement) node).getFullyQualifiedNameCharArrays();
|
||||||
String [] fullName = ((IASTQualifiedNameElement) node).getFullyQualifiedName();
|
|
||||||
char [][] qualName = new char [ fullName.length - 1 ][];
|
|
||||||
for( int i = 0; i < fullName.length - 1; i++ ){
|
|
||||||
qualName[i] = fullName[i].toCharArray();
|
|
||||||
}
|
|
||||||
//check containing scopes
|
//check containing scopes
|
||||||
if( !matchQualifications( qualifications, qualName ) ){
|
if( !matchQualifications( qualifications, qualName, true ) ){
|
||||||
return IMPOSSIBLE_MATCH;
|
return IMPOSSIBLE_MATCH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,24 +86,16 @@ public class DerivedTypesPattern extends ClassDeclarationPattern {
|
||||||
} catch (ASTNotImplementedException e) {}
|
} catch (ASTNotImplementedException e) {}
|
||||||
if (typeSpec instanceof IASTClassSpecifier){
|
if (typeSpec instanceof IASTClassSpecifier){
|
||||||
IASTClassSpecifier baseClassSpec = (IASTClassSpecifier) typeSpec;
|
IASTClassSpecifier baseClassSpec = (IASTClassSpecifier) typeSpec;
|
||||||
String[] baseFullyQualifiedName = baseClassSpec.getFullyQualifiedName();
|
|
||||||
|
|
||||||
//check name, if simpleName == null, its treated the same as "*"
|
//check name, if simpleName == null, its treated the same as "*"
|
||||||
if( simpleName != null && !matchesName( simpleName, baseClassSpec.getName().toCharArray() ) ){
|
if( simpleName != null && !matchesName( simpleName, baseClassSpec.getNameCharArray() ) ){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
char [][] qualName = baseClassSpec.getFullyQualifiedNameCharArrays();
|
||||||
|
|
||||||
char [][] qualName = new char [ baseFullyQualifiedName.length - 1 ][];
|
|
||||||
for( int j = 0; j < baseFullyQualifiedName.length - 1; j++ ){
|
|
||||||
qualName[j] = baseFullyQualifiedName[j].toCharArray();
|
|
||||||
}
|
|
||||||
//check containing scopes
|
//check containing scopes
|
||||||
if( !matchQualifications( qualifications, qualName ) ){
|
if( !matchQualifications( qualifications, qualName, true ) ){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
matchFlag = true;
|
matchFlag = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,42 +75,30 @@ public class FieldDeclarationPattern extends CSearchPattern {
|
||||||
} else return IMPOSSIBLE_MATCH;
|
} else return IMPOSSIBLE_MATCH;
|
||||||
|
|
||||||
|
|
||||||
String nodeName = ((IASTOffsetableNamedElement)node).getName();
|
char[] nodeName = ((IASTOffsetableNamedElement)node).getNameCharArray();
|
||||||
|
|
||||||
//check name, if simpleName == null, its treated the same as "*"
|
//check name, if simpleName == null, its treated the same as "*"
|
||||||
if( simpleName != null && !matchesName( simpleName, nodeName.toCharArray() ) ){
|
if( simpleName != null && !matchesName( simpleName, nodeName ) ){
|
||||||
return IMPOSSIBLE_MATCH;
|
return IMPOSSIBLE_MATCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
//check containing scopes
|
//check containing scopes
|
||||||
//create char[][] out of full name,
|
//create char[][] out of full name,
|
||||||
String [] fullName = null;
|
char [][] qualName = null;
|
||||||
|
|
||||||
if( node instanceof IASTEnumerator ){
|
if( node instanceof IASTEnumerator ){
|
||||||
//Enumerators don't derive from IASTQualifiedElement, so make the fullName
|
//Enumerators don't derive from IASTQualifiedElement, so make the fullName
|
||||||
//from the enumerations name.
|
//from the enumerations name.
|
||||||
// 7.2 - 10 : each enumerator declared by an enum-specifier is declared in the
|
// 7.2 - 10 : each enumerator declared by an enum-specifier is declared in the
|
||||||
//scope that immediately contains the enum-specifier.
|
//scope that immediately contains the enum-specifier.
|
||||||
IASTEnumerationSpecifier enumeration = ((IASTEnumerator)node).getOwnerEnumerationSpecifier();
|
IASTEnumerationSpecifier enumeration = ((IASTEnumerator)node).getOwnerEnumerationSpecifier();
|
||||||
fullName = enumeration.getFullyQualifiedName();
|
qualName = enumeration.getFullyQualifiedNameCharArrays();
|
||||||
|
|
||||||
String[] enumeratorFullName = new String[ fullName.length ];
|
|
||||||
|
|
||||||
System.arraycopy( fullName, 0, enumeratorFullName, 0, fullName.length);
|
|
||||||
enumeratorFullName[ fullName.length - 1 ] = nodeName;
|
|
||||||
|
|
||||||
fullName = enumeratorFullName;
|
|
||||||
} else if( node instanceof IASTQualifiedNameElement ){
|
} else if( node instanceof IASTQualifiedNameElement ){
|
||||||
fullName = ((IASTQualifiedNameElement) node).getFullyQualifiedName();
|
qualName = ((IASTQualifiedNameElement) node).getFullyQualifiedNameCharArrays();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( fullName != null ){
|
if( qualName != null ){
|
||||||
char [][] qualName = new char [ fullName.length - 1 ][];
|
|
||||||
for( int i = 0; i < fullName.length - 1; i++ ){
|
|
||||||
qualName[i] = fullName[i].toCharArray();
|
|
||||||
}
|
|
||||||
//check containing scopes
|
//check containing scopes
|
||||||
if( !matchQualifications( qualifications, qualName ) ){
|
if( !matchQualifications( qualifications, qualName, true ) ){
|
||||||
return IMPOSSIBLE_MATCH;
|
return IMPOSSIBLE_MATCH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,37 +76,33 @@ public class FriendPattern extends ClassDeclarationPattern {
|
||||||
Iterator i = tempNode.getFriends();
|
Iterator i = tempNode.getFriends();
|
||||||
|
|
||||||
boolean matchFlag=false;
|
boolean matchFlag=false;
|
||||||
String[] fullName=null;
|
|
||||||
while (i.hasNext()){
|
while (i.hasNext()){
|
||||||
Object friend = i.next();
|
Object friend = i.next();
|
||||||
String[] baseFullyQualifiedName = null;
|
char [][] qualName = null;
|
||||||
if (friend instanceof IASTClassSpecifier)
|
if (friend instanceof IASTClassSpecifier)
|
||||||
{
|
{
|
||||||
IASTClassSpecifier classSpec = (IASTClassSpecifier) friend;
|
IASTClassSpecifier classSpec = (IASTClassSpecifier) friend;
|
||||||
baseFullyQualifiedName = classSpec.getFullyQualifiedName();
|
qualName = classSpec.getFullyQualifiedNameCharArrays();
|
||||||
|
|
||||||
//check name, if simpleName == null, its treated the same as "*"
|
//check name, if simpleName == null, its treated the same as "*"
|
||||||
if( simpleName != null && !matchesName( simpleName, classSpec.getName().toCharArray() ) ){
|
if( simpleName != null && !matchesName( simpleName, classSpec.getNameCharArray() ) ){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (friend instanceof IASTElaboratedTypeSpecifier ){
|
else if (friend instanceof IASTElaboratedTypeSpecifier ){
|
||||||
IASTElaboratedTypeSpecifier elabType = (IASTElaboratedTypeSpecifier) friend;
|
IASTElaboratedTypeSpecifier elabType = (IASTElaboratedTypeSpecifier) friend;
|
||||||
baseFullyQualifiedName = elabType.getFullyQualifiedName();
|
qualName = elabType.getFullyQualifiedNameCharArrays();
|
||||||
|
|
||||||
//check name, if simpleName == null, its treated the same as "*"
|
//check name, if simpleName == null, its treated the same as "*"
|
||||||
if( simpleName != null && !matchesName( simpleName, elabType.getName().toCharArray() ) ){
|
if( simpleName != null && !matchesName( simpleName, elabType.getNameCharArray() ) ){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (baseFullyQualifiedName != null){
|
if (qualName!= null){
|
||||||
char [][] qualName = new char [ baseFullyQualifiedName.length - 1 ][];
|
|
||||||
for( int j = 0; j < baseFullyQualifiedName.length - 1; j++ ){
|
|
||||||
qualName[j] = baseFullyQualifiedName[j].toCharArray();
|
|
||||||
}
|
|
||||||
//check containing scopes
|
//check containing scopes
|
||||||
if( !matchQualifications( qualifications, qualName ) ){
|
if( !matchQualifications( qualifications, qualName, true ) ){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,10 +54,10 @@ public class MacroDeclarationPattern extends CSearchPattern {
|
||||||
return IMPOSSIBLE_MATCH;
|
return IMPOSSIBLE_MATCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
String nodeName = ((IASTOffsetableNamedElement)node).getName();
|
char[] nodeName = ((IASTOffsetableNamedElement)node).getNameCharArray();
|
||||||
|
|
||||||
//check name, if simpleName == null, its treated the same as "*"
|
//check name, if simpleName == null, its treated the same as "*"
|
||||||
if( simpleName != null && !matchesName( simpleName, nodeName.toCharArray() ) ){
|
if( simpleName != null && !matchesName( simpleName, nodeName ) ){
|
||||||
return IMPOSSIBLE_MATCH;
|
return IMPOSSIBLE_MATCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,23 +74,18 @@ public class MethodDeclarationPattern extends CSearchPattern {
|
||||||
}
|
}
|
||||||
|
|
||||||
IASTFunction function = (IASTFunction) node;
|
IASTFunction function = (IASTFunction) node;
|
||||||
String nodeName = function.getName();
|
char[] nodeName = function.getNameCharArray();
|
||||||
|
|
||||||
//check name, if simpleName == null, its treated the same as "*"
|
//check name, if simpleName == null, its treated the same as "*"
|
||||||
if( simpleName != null && !matchesName( simpleName, nodeName.toCharArray() ) ){
|
if( simpleName != null && !matchesName( simpleName, nodeName ) ){
|
||||||
return IMPOSSIBLE_MATCH;
|
return IMPOSSIBLE_MATCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( node instanceof IASTQualifiedNameElement ){
|
if( node instanceof IASTQualifiedNameElement ){
|
||||||
//create char[][] out of full name,
|
//create char[][] out of full name,
|
||||||
String [] fullName = ((IASTQualifiedNameElement) node).getFullyQualifiedName();
|
char [][] qualName = ((IASTQualifiedNameElement) node).getFullyQualifiedNameCharArrays();
|
||||||
char [][] qualName = new char [ fullName.length - 1 ][];
|
|
||||||
for( int i = 0; i < fullName.length - 1; i++ ){
|
|
||||||
qualName[i] = fullName[i].toCharArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
//check containing scopes
|
//check containing scopes
|
||||||
if( !matchQualifications( qualifications, qualName ) ){
|
if( !matchQualifications( qualifications, qualName, true ) ){
|
||||||
return IMPOSSIBLE_MATCH;
|
return IMPOSSIBLE_MATCH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,18 +57,14 @@ public class NamespaceDeclarationPattern extends CSearchPattern {
|
||||||
|
|
||||||
IASTNamespaceDefinition namespace = (IASTNamespaceDefinition)node;
|
IASTNamespaceDefinition namespace = (IASTNamespaceDefinition)node;
|
||||||
|
|
||||||
if( simpleName != null && !matchesName( simpleName, namespace.getName().toCharArray() ) ){
|
if( simpleName != null && !matchesName( simpleName, namespace.getNameCharArray() ) ){
|
||||||
return IMPOSSIBLE_MATCH;
|
return IMPOSSIBLE_MATCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
//create char[][] out of full name,
|
//create char[][] out of full name,
|
||||||
String [] fullName = namespace.getFullyQualifiedName();
|
char [] [] qualName = namespace.getFullyQualifiedNameCharArrays();
|
||||||
char [] [] qualName = new char [ fullName.length - 1 ][];
|
|
||||||
for( int i = 0; i < fullName.length - 1; i++ ){
|
|
||||||
qualName[i] = fullName[i].toCharArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !matchQualifications( qualifications, qualName ) ){
|
if( !matchQualifications( qualifications, qualName, true ) ){
|
||||||
return IMPOSSIBLE_MATCH;
|
return IMPOSSIBLE_MATCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue