misti icon indicating copy to clipboard operation
misti copied to clipboard

`PreferSenderFunction`: Highlight `ctx.sender` call instead of `ctx` definition

Open jubnzv opened this issue 7 months ago • 2 comments

Current behavior:

[LOW] PreferSenderFunction: Code can be optimized by using `sender()` instead of accessing context
contracts/proof_of_capital.tact:236:13:
  235 |     receive(msg: TakeWalletAddress) {
> 236 |         let ctx: Context = context();
                    ^~~

jubnzv avatar May 20 '25 11:05 jubnzv

This is an easy task, let me handle this for you.

lucifer1017 avatar Sep 15 '25 13:09 lucifer1017

Hey @lucifer1017,

Sure, feel free to ask questions if you need any help.

I would save the location of the context variable when it first appears in the dataflow into a new map defined in ContextVariablesState. For example, you may want to create a new map (e.g. contextLocations) that maps the names of local Context variables with their locations in the source code (SrcInfo objects present in the Tact AST).

jubnzv avatar Sep 16 '25 06:09 jubnzv