mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Cosmetics.
This commit is contained in:
parent
0a90b65e97
commit
d8a5f2dfb4
1 changed files with 3 additions and 5 deletions
|
@ -365,7 +365,6 @@ public class ExtractLocalVariableRefactoring extends CRefactoring {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int visit(IASTExpression expression) {
|
public int visit(IASTExpression expression) {
|
||||||
|
|
||||||
// If the expression starts with a function call with a name, we should only need to guess this name
|
// If the expression starts with a function call with a name, we should only need to guess this name
|
||||||
if (expression == target && expression instanceof ICPPASTFunctionCallExpression) {
|
if (expression == target && expression instanceof ICPPASTFunctionCallExpression) {
|
||||||
ICPPASTFunctionCallExpression functionCallExpression = (ICPPASTFunctionCallExpression) expression;
|
ICPPASTFunctionCallExpression functionCallExpression = (ICPPASTFunctionCallExpression) expression;
|
||||||
|
@ -382,7 +381,7 @@ public class ExtractLocalVariableRefactoring extends CRefactoring {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (expression instanceof CPPASTLiteralExpression) {
|
if (expression instanceof CPPASTLiteralExpression) {
|
||||||
CPPASTLiteralExpression literal = (CPPASTLiteralExpression)expression;
|
CPPASTLiteralExpression literal = (CPPASTLiteralExpression) expression;
|
||||||
String name = null;
|
String name = null;
|
||||||
char[] value = literal.getValue();
|
char[] value = literal.getValue();
|
||||||
switch (literal.getKind()) {
|
switch (literal.getKind()) {
|
||||||
|
@ -446,13 +445,13 @@ public class ExtractLocalVariableRefactoring extends CRefactoring {
|
||||||
String lower = name.toLowerCase();
|
String lower = name.toLowerCase();
|
||||||
int start = 0;
|
int start = 0;
|
||||||
for (String prefix : getPrefixes()) {
|
for (String prefix : getPrefixes()) {
|
||||||
if(lower.startsWith(prefix)) {
|
if (lower.startsWith(prefix)) {
|
||||||
if (name.length() > prefix.length()) {
|
if (name.length() > prefix.length()) {
|
||||||
start = prefix.length();
|
start = prefix.length();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
prefix = prefix + "_"; //$NON-NLS-1$
|
prefix = prefix + "_"; //$NON-NLS-1$
|
||||||
if(lower.startsWith(prefix)) {
|
if (lower.startsWith(prefix)) {
|
||||||
if (name.length() > prefix.length()) {
|
if (name.length() > prefix.length()) {
|
||||||
start = prefix.length();
|
start = prefix.length();
|
||||||
}
|
}
|
||||||
|
@ -460,7 +459,6 @@ public class ExtractLocalVariableRefactoring extends CRefactoring {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (start > 0) {
|
if (start > 0) {
|
||||||
|
|
||||||
String nameWithoutPrefix = name.substring(start);
|
String nameWithoutPrefix = name.substring(start);
|
||||||
if (Character.isUpperCase(nameWithoutPrefix.charAt(0))) {
|
if (Character.isUpperCase(nameWithoutPrefix.charAt(0))) {
|
||||||
nameWithoutPrefix = nameWithoutPrefix.substring(0, 1).toLowerCase()
|
nameWithoutPrefix = nameWithoutPrefix.substring(0, 1).toLowerCase()
|
||||||
|
|
Loading…
Add table
Reference in a new issue