[squeak-dev] Side effect of script _ -> :=

Lukas Renggli renggli at gmail.com
Sat Aug 22 21:01:34 UTC 2009


> It's a dumb text replacement, that just checks no literal $_ was in the
> method. An actual parser-based replacement would have been nice, but nobody
> worked on it.

The refactoring browser can trivially do this, it does pretty print
the code afterwards though:

ParseTreeRewriter new
	replace: '`var _ ``@object' with: '`var := ``@object' when: [ :node |
		node position notNil
			and: [ node methodNode sourceText notNil
			and: [ (node methodNode sourceText at: node position ifAbsent: [ ])
= $_ ] ] ];
	yourself

Lukas

-- 
Lukas Renggli
http://www.lukas-renggli.ch



More information about the Squeak-dev mailing list