8000 Detect when args are always redundant because of another argument · Issue #27 · mvdan/unparam · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Detect when args are always redundant because of another argument #27
Open
@mvdan

Description

@mvdan

For example, take this Golang CL: https://go-review.googlesource.com/c/go/+/100455

The func was always called like:

mkinlcall(n, n.Left, n.Isddd())
mkinlcall(n, f, n.Isddd())
etc

Since the func always receives n, receiving n.Method() is redundant.

Other redundant cases that come to mind, when a func receives x:

x.Field
x[i]
x[i:j]
*x

And of course, any combination of the above.

I'm leaving x.PureMethod() and PureFunc(x) out of the list as that's a much more complex one - we'd have to figure out that the func has no side effects. I don't think SSA does this just yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0