Identifying Un-used functions and commands

Mark Wieder ahsoftware at sonic.net
Thu Nov 28 12:03:57 EST 2019


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



More information about the use-livecode mailing list