|
From: <cal...@us...> - 2007-02-21 11:41:06
|
Revision: 1990
http://svn.sourceforge.net/rubyeclipse/?rev=1990&view=rev
Author: callandor1983
Date: 2007-02-21 03:41:02 -0800 (Wed, 21 Feb 2007)
Log Message:
-----------
Inline local var doesn't eliminate selected asgnNode when no target was found.
Modified Paths:
--------------
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/inlinetemp/InlineTempConditionChecker.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.refactoring.tests/resources/core/inlinetemp/conditionchecks/inline_temp_checker_test_7.test_properties
trunk/org.rubypeople.rdt.refactoring.tests/resources/core/inlinetemp/conditionchecks/inline_temp_checker_test_7.test_source
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/inlinetemp/InlineTempConditionChecker.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/inlinetemp/InlineTempConditionChecker.java 2007-02-21 10:04:53 UTC (rev 1989)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/inlinetemp/InlineTempConditionChecker.java 2007-02-21 11:41:02 UTC (rev 1990)
@@ -117,9 +117,15 @@
addError("Cannot inline a local variable that uses its own value in the assignment.");
} else if (isMultipleAsgnNode()) {
addError("Inline in multiple assignments not jet supported.");
+ } else if (!hasTarget()) {
+ addError("No target found to inline the selected variable.");
}
}
+ private boolean hasTarget() {
+ return !config.getLocalOccurrences().isEmpty();
+ }
+
private boolean isBlockArgument() {
IterNode enclosingIterNode = (IterNode) SelectionNodeProvider.getSelectedNodeOfType(rootNode, config.getCaretPosition(), IterNode.class);
if(enclosingIterNode == null) {
Added: trunk/org.rubypeople.rdt.refactoring.tests/resources/core/inlinetemp/conditionchecks/inline_temp_checker_test_7.test_properties
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/resources/core/inlinetemp/conditionchecks/inline_temp_checker_test_7.test_properties (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring.tests/resources/core/inlinetemp/conditionchecks/inline_temp_checker_test_7.test_properties 2007-02-21 11:41:02 UTC (rev 1990)
@@ -0,0 +1,3 @@
+cursorPosition=43
+newName=dd
+initialError0=No target found to inline the selected variable.
Added: trunk/org.rubypeople.rdt.refactoring.tests/resources/core/inlinetemp/conditionchecks/inline_temp_checker_test_7.test_source
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/resources/core/inlinetemp/conditionchecks/inline_temp_checker_test_7.test_source (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring.tests/resources/core/inlinetemp/conditionchecks/inline_temp_checker_test_7.test_source 2007-02-21 11:41:02 UTC (rev 1990)
@@ -0,0 +1,5 @@
+class Triangle
+ def hypotenuse a, b
+ cSquare = a ** 2 + b ** 2
+ end
+end
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|