mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
cleaning up more strings
This commit is contained in:
parent
0dda631a21
commit
89010e954f
5 changed files with 20 additions and 15 deletions
|
@ -20,5 +20,6 @@ public interface IASTConstructorMemberInitializer extends ISourceElementCallback
|
|||
{
|
||||
public IASTExpression getExpressionList();
|
||||
public String getName();
|
||||
public char[] getNameCharArray();
|
||||
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ import org.eclipse.cdt.core.parser.ast.IASTTypeId;
|
|||
import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTExpression.Kind;
|
||||
import org.eclipse.cdt.core.parser.extension.IParserExtension;
|
||||
import org.eclipse.cdt.internal.core.parser.scanner2.CharArrayUtils;
|
||||
import org.eclipse.cdt.internal.core.parser.token.TokenFactory;
|
||||
import org.eclipse.cdt.internal.core.parser.util.TraceUtil;
|
||||
|
||||
|
@ -2300,7 +2301,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
.getIdExpressionCharArray());
|
||||
else if (firstExpression.getRHSExpression() != null
|
||||
&& firstExpression.getRHSExpression()
|
||||
.getIdExpression() != null) {
|
||||
.getIdExpressionCharArray() != null) {
|
||||
setCurrentFunctionName(firstExpression
|
||||
.getRHSExpression().getIdExpressionCharArray());
|
||||
context = astFactory
|
||||
|
@ -2386,7 +2387,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0;
|
||||
if (secondExpression != null
|
||||
&& secondExpression.getExpressionKind() == Kind.ID_EXPRESSION
|
||||
&& secondExpression.getIdExpression().indexOf('~') != -1)
|
||||
&& CharArrayUtils.indexOf( '~', secondExpression.getIdExpressionCharArray() ) != -1)
|
||||
memberCompletionKind = Kind.POSTFIX_DOT_DESTRUCTOR;
|
||||
|
||||
try {
|
||||
|
@ -2424,7 +2425,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
endOffset = ( lastToken != null ) ? lastToken.getEndOffset() : 0;
|
||||
if (secondExpression != null
|
||||
&& secondExpression.getExpressionKind() == Kind.ID_EXPRESSION
|
||||
&& secondExpression.getIdExpression().indexOf('~') != -1)
|
||||
&& CharArrayUtils.indexOf( '~', secondExpression.getIdExpressionCharArray() ) != -1)
|
||||
arrowCompletionKind = Kind.POSTFIX_ARROW_DESTRUCTOR;
|
||||
try {
|
||||
firstExpression = astFactory.createExpression(scope,
|
||||
|
|
|
@ -54,7 +54,7 @@ public class ASTConstructorMemberInitializer
|
|||
{
|
||||
return String.valueOf( name );
|
||||
}
|
||||
public char[] getNameArray(){
|
||||
public char[] getNameCharArray(){
|
||||
return name;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
|
|
|
@ -1197,7 +1197,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
while( i.hasNext() )
|
||||
{
|
||||
ReferenceCache.ASTReference ref = (ReferenceCache.ASTReference) i.next();
|
||||
if( ref.getName().equals( duple.toString() ) &&
|
||||
if( CharArrayUtils.equals( ref.getNameCharArray(), duple.toCharArray() ) &&
|
||||
ref.getOffset() == duple.getStartOffset() )
|
||||
{
|
||||
cache.returnReference( ref );
|
||||
|
@ -1256,13 +1256,13 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
{
|
||||
ASTExpression astExpression = (ASTExpression) rhs;
|
||||
Iterator refs = astExpression.getReferences().iterator();
|
||||
String idExpression = astExpression.getIdExpression();
|
||||
if( !idExpression.equals( "")) //$NON-NLS-1$
|
||||
char[] idExpression = astExpression.getIdExpressionCharArray();
|
||||
if( idExpression.length > 0 ) //$NON-NLS-1$
|
||||
{
|
||||
while( refs.hasNext() )
|
||||
{
|
||||
IASTReference r = (IASTReference) refs.next();
|
||||
if( r.getName().equals( idExpression ) )
|
||||
if( CharArrayUtils.equals( r.getNameCharArray(), idExpression ) )
|
||||
{
|
||||
refs.remove();
|
||||
cache.returnReference(r);
|
||||
|
@ -2633,13 +2633,13 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
while( initializers.hasNext())
|
||||
{
|
||||
IASTConstructorMemberInitializer initializer = (IASTConstructorMemberInitializer)initializers.next();
|
||||
if( !initializer.getName().equals( EMPTY_STRING) &&
|
||||
if( initializer.getNameCharArray().length > 0 &&
|
||||
initializer instanceof ASTConstructorMemberInitializer &&
|
||||
((ASTConstructorMemberInitializer)initializer).requiresNameResolution() )
|
||||
{
|
||||
ASTConstructorMemberInitializer realInitializer = ((ASTConstructorMemberInitializer)initializer);
|
||||
IDerivableContainerSymbol container = (IDerivableContainerSymbol) symbol.getContainingSymbol();
|
||||
lookupQualifiedName(container, realInitializer.getNameArray(), ITypeInfo.t_any, null, realInitializer.getNameOffset(), realInitializer.getReferences(), false, LookupType.QUALIFIED);
|
||||
lookupQualifiedName(container, realInitializer.getNameCharArray(), ITypeInfo.t_any, null, realInitializer.getNameOffset(), realInitializer.getReferences(), false, LookupType.QUALIFIED);
|
||||
// TODO try and resolve parameter references now in the expression list
|
||||
}
|
||||
}
|
||||
|
@ -3608,9 +3608,9 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
if( reference instanceof ASTExpression )
|
||||
{
|
||||
ASTExpression expression = (ASTExpression) reference;
|
||||
final String dupleAsString = duple.toString();
|
||||
final char[] dupleAsCharArray = duple.toCharArray();
|
||||
if( expression.getExpressionKind() == IASTExpression.Kind.ID_EXPRESSION &&
|
||||
expression.getLHSExpression().equals( dupleAsString ))
|
||||
CharArrayUtils.equals( expression.getLHSExpression().getIdExpressionCharArray(), dupleAsCharArray ))
|
||||
{
|
||||
try {
|
||||
s = lookupQualifiedName( scopeToSymbol( scope ), duple, null, false );
|
||||
|
@ -3653,7 +3653,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
|
||||
}
|
||||
else if( expression.getExpressionKind() == Kind.POSTFIX_FUNCTIONCALL &&
|
||||
expression.getLHSExpression().getIdExpression().equals( dupleAsString ))
|
||||
CharArrayUtils.equals( expression.getLHSExpression().getIdExpressionCharArray(), dupleAsCharArray ))
|
||||
{
|
||||
try {
|
||||
ISymbol symbol = getExpressionSymbol( scope, expression.getExpressionKind(), expression.getLHSExpression(), expression.getRHSExpression(), null, null );
|
||||
|
|
|
@ -26,14 +26,14 @@ public class ASTConstructorMemberInitializer
|
|||
* @param string
|
||||
* @param expressionList
|
||||
*/
|
||||
public ASTConstructorMemberInitializer(String name, IASTExpression expressionList)
|
||||
public ASTConstructorMemberInitializer(char[] name, IASTExpression expressionList)
|
||||
{
|
||||
this.name = name;
|
||||
this.expressionList = expressionList;
|
||||
}
|
||||
|
||||
private final IASTExpression expressionList;
|
||||
private final String name;
|
||||
private final char[] name;
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTConstructorMemberInitializer#getExpressionList()
|
||||
*/
|
||||
|
@ -46,6 +46,9 @@ public class ASTConstructorMemberInitializer
|
|||
*/
|
||||
public String getName()
|
||||
{
|
||||
return String.valueOf(name);
|
||||
}
|
||||
public char[] getNameCharArray(){
|
||||
return name;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
|
|
Loading…
Add table
Reference in a new issue