Identifying Un-used functions and commands

J. Landman Gay jacque at hyperactivesw.com
Thu Nov 28 12:52:39 EST 2019


We should verify whether we're looking for orphaned handlers or orphaned 
calls. If it's handlers I'd do something like:

Scan all scripts for "end" & space to get a list of handlers
Remove duplicates
Scan all scripts for each handler name and keep a count

If there's only two instances of the handler name, it's an orphan.

--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
On November 28, 2019 11:05:56 AM Mark Wieder via use-livecode 
<use-livecode at lists.runrev.com> wrote:

> On 11/28/19 8:25 AM, Richard Gaskin via use-livecode wrote:
>> Quentin Long wrote:
>>
>>  > Finding explicit function/command calls seems like it should be a
>>  > fairly straightforward task. However, the "do" keyword can also be
>>  > a source of function/command calls, which complicates matters a
>>  > wee bit. You'll also need to evaluate all the non-cleartext components
>>  > that can go into "do" statements—
>>  > do (VariableName)
>>  > do (the WhateverProp of ThisObject)
>>  > do (line 4 of fld "ThisField")
>>  > —etc etc etc.
>>
>> There are many reasons to resort to "do" only after all other more
>> with-the-grain approaches cannot be made to work.
>>
>> That it eludes static code analysis is just one more.
>>
>> If I get around to tidying up my old orphan-finder and adding it to
>> other code base management tools in devolution, I wouldn't bother
>> attempting to handle "do" cases.  Low ROI, and not handling them helps
>> draw attention to the technical debt many uses of "do" accrue.
>>
>
> Somewhat similar problem with "send" and "dispatch" commands as well.
> You can alleviate this a bit during parsing by seeing if what follows
> the "do" or "send" or "dispatch [function]" command is a quoted string.
>
> --
>  Mark Wieder
>  ahsoftware at gmail.com
>
> _______________________________________________
> 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