how to check for unnecessary local declarations?

Bob Sneidar bobsneidar at iotecdigital.com
Thu Jul 2 17:18:52 EDT 2015


If you remove the asterisks, you would fail to find any code that uses the variable. Only lines containing *JUST* the variable name would be found, which wouldn’t work. You could add code to analyze the line by replacing “(“ and “) with space, then filter for “*” && variableName && “*”. Words at the end of the line would not be found however, so you would have to also filter for “*” && variableName. 

Bob S


> On Jul 1, 2015, at 23:09 , Kay C Lan <lan.kc.macmail at gmail.com> wrote:
> 
> Bob, I think you would need to remove the astrisks otherwise if you have
> single letter variables (many use them as counters in repeat loops) or
> words that may appear in other words - lStart, lStartSearch - you could
> easy miss some.
> 
> 
> 
> On Thu, Jul 2, 2015 at 5:47 AM, Bob Sneidar <bobsneidar at iotecdigital.com>
> wrote:
> 
>> Seems you could write a handler to do it pretty easily.
>> 
>> <pseudocode>
>> — get stack script
>> — find “local “
>> — get word 2 of found line
>> — filter with “*” & word 2 of found line & “*”
>> — count number of lines. if only 1 then delete that line
>> — get list of cards
>> — repeat for every card
>> — get card script
>> — what I just said
>> — get list of objects on card
>> — repeat for every object on card
>> — get script of object
>> — do I have to repeat myself again??
>> </pseudocode>
>> 
>> It might be a little more complicated if you have multiple local variable
>> declarations, but not much.
>> 
>> Bob S
>> 
>> 
>>> On Jul 1, 2015, at 06:44 , Tiemo Hollmann TB <toolbook at kestner.de>
>> wrote:
>>> 
>>> Hello,
>>> 
>>> I am using the strict compilation mode. When working over longer time on
>> a
>>> project it regularly happens that I have orphaned local variable
>>> declarations.
>>> 
>>> Actually they don't hurt, but I like to keep my code clean and wonder if
>>> there is any hidden feature, which checks for not any more needed local
>>> declarations (beside scripting a check myself)?
>>> 
>>> Thanks
>>> 
>>> Tiemo
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode



More information about the Use-livecode mailing list