[Cuis-dev] [ChangeSet] source code intervals + changes on refactorings

Phil B pbpublist at gmail.com
Sun May 10 11:37:44 PDT 2020


Hi Nahuel,

Interesting timing as I was thinking along the same lines in the last few
days.  However, I think an Interval subclass is the wrong way to do it
given the relative inefficiency of Interval as the parent class.  How about
something along the lines of a SourceCodeRange class (a subclass of
Object?) which just stores the start/end (or first/last... whatever) of the
range and add whatever methods from Interval we find appropriate?  Then we
could make things like SHRange subclasses of it.  Basically the convenience
and (mostly) behavior of an Interval without the overhead.

What got me thinking about this is the OMeta uses Association to store
first/last of ranges to *avoid* using Interval.  But I've always disliked
using an Association this way and would like to switch to something else as
long as it's efficient.

Thanks,
Phil

On Sun, May 10, 2020 at 2:24 PM Nahuel Garbezza via Cuis-dev <
cuis-dev at lists.cuis.st> wrote:

> Hi!
>
> I'm attaching a changeset (+ tests changeset) with the following:
>
> Main changes:
>
> Introduce the SourceCodeInterval class as a specialization of Interval,
> capable of dealing with source code transformations. Start to use
> SourceCodeInterval in the source ranges reported by the Parser, and on the
> intervals created on refactorings. This helped us to reduce utility methods
> related to source code on the Refactoring and ParseNode classes.
>
> Changes on refactorings:
>
> * [extract temporary] allow extracting entire statements without
> introducing an unnecessary extra statement
> * [extract temporary] do not allow the user to extract on a smalltalk
> editor that does not contain a method
> * [extract temporary] change the #apply message to return the updated
> source code
> * [extract method] allow extracting expressions with multiple levels of
> parentheses and spaces between them
> --
> Cuis-dev mailing list
> Cuis-dev at lists.cuis.st
> https://lists.cuis.st/mailman/listinfo/cuis-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20200510/da2ae8e5/attachment.htm>


More information about the Cuis-dev mailing list