Copy chain

 home quick fix  example  edit

copy_chain

Description

Finds a local variable that only passes a value on from one variable to another

Extended Information

Reports DATA v TYPE ... [CLEAR v.] v = src. ... y = v. when all of the following hold:

* v is a local variable of a METHOD, FORM or FUNCTION, declared with DATA without VALUE
* v has exactly one write besides CLEAR: v = src., and all CLEARs are before it
* v has exactly one read, the complete source of y = v.
* src is a local variable, its address is never taken, and it is not written from v = src. until y = v.
* v = src. is executed before y = v. on every path: y = v. is in the same block or a nested block,
and both are in the same loop
* v and src are both reference types, or have identical types; for other types the copy into v can convert,
e.g. truncate a string into a c field. For DATA(y) = v. the types must be identical, else y changes its type
* the declaration, the CLEARs and v = src. are not chained

Objects with syntax errors, macros or unknown statements are skipped, as are procedures with dynamic code,
INCLUDE, test seams, enhancements or native SQL.

The quick fix deletes the declaration, the CLEARs and v = src., and changes the read to y = src.
No release requirement.

Default Configuration

Hover to see descriptions, Ctrl+Space for suggestions

Examples