[Cuis-dev] Error when declaring undef. temp var

Eric Brandwein brandweineric at gmail.com
Fri Dec 20 16:01:47 PST 2019


Found it! The bug was happening when there where two undeclared temporaries
being declared in the same block. Here's a ChangeSet that fixes that and
other related issue with the corresponding tests.

Cheers,
Eric

El vie., 20 dic. 2019 a las 14:44, Eric Brandwein (<brandweineric at gmail.com>)
escribió:

> Sure, I'll take a look at it later today.
>
> Il ven 20 dic 2019, 14:29 Hernan Wilkinson <hernan.wilkinson at 10pines.com>
> ha scritto:
>
>> Hi Eric,
>>  the other day I got an error when defining an undef. temp var when
>> saving a method. the method was:
>> -------
>>  SafelyRemoveClass class>>#assertNoReferencesTo: aClassToSafelyRemove
>>
>> | references withAllSubclasses withAllSubclassesNames referenced |
>>
>> withAllSubclasses := aClassToSafelyRemove withAllSubclasses.
>> withAllSubclassesNames := withAllSubclasses collect: [:aClass | aClass
>> name ].
>> references :=OrderedCollection new.
>> referenced := OrderedCollection new.
>> referencesToName := OrderedCollection new.
>> referencedByName := OrderedCollection new.
>>
>> withAllSubclasses do: [ :aClass | | allReferences
>> referencesOutsideHierarchy |
>> allReferences := aClass allCallsOn.
>> referencesOutsideHierarchy := allReferences reject: [ :aReference |
>> withAllSubclassesNames includes: aReference classSymbol ].
>> referencesToVariableBinding := referencesOutsideHierarchy select: [
>> :aReference | aReference hasVariableBindingTo: aClass ].
>> referencesToClassName := referencesOutsideHierarchy difference:
>> referencesToVariableBinding.
>>
>> referencesToVariableBinding notEmpty ifTrue: [
>> referenced add: aClass.
>> references addAll: referencesToVariableBinding ].
>> referencesToClassName notEmpty ifTrue: [
>> referencedByName add: aClass.
>> referencesToName addAll: referencesToClassName ].
>>
>> ].
>>
>> references notEmpty ifTrue: [ self signalCanNotRemove:
>> aClassToSafelyRemove dueToReferences: references toAll: referenced ].
>> --------
>> If you save it and answer to declare as method temp referencesToName
>> and referencedByName, and to define as
>> block-temp referencesToVariableBinding and referencesToClassName, the
>> debugger popups because #+ is sent to a BlockNode
>> Can you take a look at it? I did not have time to see it, but it is
>> really weird because tempsMark is returning a BlockNode instead of an
>> integer...
>> I verified that this is a new error added by the changes you made.
>>
>> Thanks!
>>
>> --
>>
>> *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/20191220/89f881d8/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DeclareMoreThanOneUndeclaredInSameBlock-BaseImageTests-EB.1.cs.st
Type: application/vnd.sailingtracker.track
Size: 1610 bytes
Desc: not available
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20191220/89f881d8/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 3983-DeclareMoreThanOneUndeclaredInSameBlock-EricBrandwein-2019Dec20-20h02m-EB.1.cs.st
Type: application/vnd.sailingtracker.track
Size: 3020 bytes
Desc: not available
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20191220/89f881d8/attachment-0001.bin>


More information about the Cuis-dev mailing list