pharo icon indicating copy to clipboard operation
pharo copied to clipboard

[ Refactoring ] Clean architecture of RBTemporaryToInstanceVariableRefactoring

Open Ducasse opened this issue 3 months ago • 3 comments

Once https://github.com/pharo-project/pharo/pull/18821/ is integrated we should fix the popup. We should not get a pop up in the refactoring.

TemporaryToInstanceVariableRefactoring >> preconditionNoSubclassDefinesVar [

	^ RBCondition
		  withBlock: [ (class allSubclasses anySatisfy: [ :cls | cls definesInstanceVariable: temporaryVariableName asString ]) not ]
 		  errorString:
			  ('One or more subclasses of <1p> already defines an<n>instance variable with the same name. Proceed anyway?'
				   expandMacrosWith: class name)

Ducasse avatar Nov 08 '25 08:11 Ducasse

When we call the refacorings in scripting mode we can get a warning and capturing the exception. Now in interactive mode the driver could do the same.

Ducasse avatar Nov 08 '25 08:11 Ducasse

In this refactoring this method is called by the driver in #18821 so there is no pop up there :) I tried to have a clean architecture exactly like the Remove class refactoring, preconditions are handled like this too

AlexisCnockaert avatar Nov 11 '25 15:11 AlexisCnockaert

If you agree we can close this issue then

AlexisCnockaert avatar Nov 11 '25 15:11 AlexisCnockaert