From 224b4ef3a3d336cb56062a01c01dbfe30e2dadaf Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Fri, 25 May 2012 12:22:09 -0700 Subject: [PATCH] Code streamlining. --- .../core/dom/parser/cpp/CPPASTBinaryExpression.java | 13 ++++++------- .../ExtractLocalVariableRefactoring.java | 7 +------ 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBinaryExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBinaryExpression.java index 8b04d2b0929..0c98534b635 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBinaryExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBinaryExpression.java @@ -14,7 +14,10 @@ package org.eclipse.cdt.internal.core.dom.parser.cpp; import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.LVALUE; import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.PRVALUE; -import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExpressionTypes.*; +import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExpressionTypes.glvalueType; +import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExpressionTypes.prvalueType; +import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExpressionTypes.typeFromFunctionCall; +import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExpressionTypes.valueCategoryFromFunctionCall; import org.eclipse.cdt.core.dom.ast.ASTVisitor; import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression; @@ -44,7 +47,7 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr private IASTInitializerClause operand2; private IType type; private ICPPFunction overload= UNINITIALIZED_FUNCTION; - private IASTImplicitName[] implicitNames = null; + private IASTImplicitName[] implicitNames; public CPPASTBinaryExpression() { } @@ -66,11 +69,7 @@ public class CPPASTBinaryExpression extends ASTNode implements ICPPASTBinaryExpr copy.op = op; copy.setOperand1(operand1 == null ? null : operand1.copy(style)); copy.setInitOperand2(operand2 == null ? null : operand2.copy(style)); - copy.setOffsetAndLength(this); - if (style == CopyStyle.withLocations) { - copy.setCopyLocation(this); - } - return copy; + return copy(copy, style); } @Override diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractlocalvariable/ExtractLocalVariableRefactoring.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractlocalvariable/ExtractLocalVariableRefactoring.java index 37fd2cb8c18..61a77465292 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractlocalvariable/ExtractLocalVariableRefactoring.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractlocalvariable/ExtractLocalVariableRefactoring.java @@ -100,7 +100,7 @@ public class ExtractLocalVariableRefactoring extends CRefactoring { @Override public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException, OperationCanceledException { - SubMonitor sm = SubMonitor.convert(pm, 9); + SubMonitor sm = SubMonitor.convert(pm, 10); RefactoringStatus status = super.checkInitialConditions(sm.newChild(6)); if (status.hasError()) { @@ -128,11 +128,6 @@ public class ExtractLocalVariableRefactoring extends CRefactoring { if (isProgressMonitorCanceled(sm, initStatus)) return initStatus; - sm.worked(1); - - container.getNames(); //XXX Is this needed? - sm.worked(1); - info.addNamesToUsedNames(findAllDeclaredNames()); sm.worked(1);