[Cuis-dev] Encoder changes re: #addMultiRange:for: and #noteSourceRange:forNode:

Hernan Wilkinson hernan.wilkinson at 10pines.com
Sun Apr 21 05:10:22 PDT 2019


Hi Phill,
 let me tell you the story about it :-)
 Originally, the encoder only kept the ranges of message nodes because they
are used in the debugger to highlight the message send when steeping.
 As part of the implementation of refactorings, I changed the parser to
keep the ranges of all parse nodes.
 The thing is, there are parse nodes like a variable node or a literal node
that can be reused in the AST and therefore for the same node you can have
multiple ranges, that is where the ordered collection of ranges comes from.
 I did not change how ranges for message send were stored to avoid further
changes and keep compatibility with the rest of the tools that assumed that.
 I know it is not nice to get an interval for some node types and a
collection of intervals for others, they are not polymorphic and therefore
it breaks encapsulation, but it was the "safest" way to do it due to the
lack of tests and the difficulty to analyze a major change.
 In the change set I sent that allows renames in the class definition, I
added a message to MethodNode, #isMultipleRanges: that encapsulates the
fact that a node can have one or multiple ranges.
 Writing this email I realized we could add a new message to get node
ranges that would always return a collection and at least for that message
the return would be polymorphic always, no matter the node type... but
making all the tools to use that message is another story :-)

 Cheers!
 Hernan.

On Sun, Apr 21, 2019 at 1:55 AM Phil B via Cuis-dev <cuis-dev at lists.cuis.st>
wrote:

> I see that not too long ago that Encoder was modified to have
> #addMultiRange:for: use collections of Intervals for ranges in the
> sourceRanges dictionary.  However, #noteSourceRange:forNode: still adds
> singular Intervals to sourceRanges which causes problems.  Not sure how to
> best resolve this... (I tried a quick hack of having it also wrap its
> Intervals in collections which as expected caused problems elsewhere so
> figured I'd ask before going further)
> --
> Cuis-dev mailing list
> Cuis-dev at lists.cuis.st
> https://lists.cuis.st/mailman/listinfo/cuis-dev
>


-- 

*HernĂ¡n WilkinsonAgile Software Development, Teaching & Coaching*
*Phone: +54-011*-4893-2057
*Twitter: @HernanWilkinson*
*site: http://www.10Pines.com <http://www.10pines.com/>*
Address: Alem 896, Floor 6, Buenos Aires, Argentina
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20190421/a06c939d/attachment.html>


More information about the Cuis-dev mailing list