Skip to content

ReCompactSourceCodeRule and ReMethodSourceCleaner identify and remove last dot in method body when is a valid character #22

Description

@vonbecmann

given the following methods:

printOn: aStream
	""head: body with dot.
	 head: ·. ""

	| middleDot |
	middleDot := Character value: 183.
	rule head printOn: aStream.
	aStream nextPutAll: ': '.
	rule body withIndexDo: [ :each :index |
		index = 1 ifFalse: [ aStream nextPutAll: ', ' ].
		index = self dotIndex ifTrue: [ aStream nextPut: middleDot ].
		each printOn: aStream ].
	self isFinal ifTrue: [ aStream nextPut: middleDot ].
	aStream nextPut: $.
printOn: aStream
	""head: body.
	 head: . ""

	head printOn: aStream.
	aStream nextPutAll: ': '.
	body
		do: [ :each | each printOn: aStream ]
		separatedBy: [ aStream nextPutAll: ', ' ].
	aStream nextPut: $.

the character $. is identified as unnecessary and can be transformed but the resulting code doesn't compile.

Expected result: those methods don't have unnecessary characters.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions