Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[record_use] Correctness: Record dynamic invocations #2716

@dcharkes

Description

@dcharkes

Currently, the recording mechanism only captures statically-resolved calls (StaticInvocation) and tear-offs (StaticTearOffConstant). It does not record truly dynamic calls, such as foo.bar() where foo is a dynamic variable.

We should record these dynamic invocations. When the compiler encounters a dynamic call to a method name that matches one or more methods annotated with @RecordUse, it should generate a usage record.

Such a record would be similar to a tear-off, as no argument information can be captured. It could be represented by a new CallReference type:

{
  "@": 2,
  "type": "dynamic_invocation",
  "name": "bar" // The name of the method called dynamically
}

This would provide developers with insight into whether an annotated method might be invoked dynamically, even if the precise call site and arguments cannot be known.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Todo

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions