Login  Register

Re: why RefactoringEnvironment requires AST-Core

Posted by Stéphane Ducasse on Mar 17, 2011; 2:50pm
URL: https://forum.world.st/why-RefactoringEnvironment-requires-AST-Core-tp3384727p3384751.html

I saw that

selectionIntervalFor:

        uses

selectionParseTreeIntervalFor: aString
        | parseTree answerBlock |
        parseTree := RBParser
                parseMethod: aString
                onError: [ :str :pos | ^ nil ].
        answerBlock := [ :aNode :answer | ^ aNode sourceInterval ].
        self searchStrings do: [ :each |
                | matcher tree |
                matcher := RBParseTreeSearcher new.
                matcher matchesTree: (RBLiteralNode value: each) do: answerBlock.
                each isSymbol
                        ifTrue: [
                                tree := RBParseTreeSearcher buildSelectorTree: each.
                                tree notNil ifTrue: [ matcher matchesTree: tree do: answerBlock ] ]
                        ifFalse: [
                                tree := RBVariableNode named: each.
                                matcher
                                        matchesTree: tree do: answerBlock;
                                        matchesArgumentTree: tree do: answerBlock ].
                matcher executeTree: parseTree ].
        ^ nil

and I was wondering where is used the selectionIntervalFor:

Then I saw that BrowserEnvironmentWrapper introduces environment (which is good)

Now the superclass uses directly Smalltalk globals so may be this would be good to move enviroment above
this way we can have a selection of the environemt as in BrowserEnvironment and also have a browser that can browse a remote
environment.

Stef