Skip to content

VB.NET extractor truncates methods containing multiline lambdas #808

Description

@zzet

Problem

The VB.NET extractor locates a callable's end with the first matching End Sub or End Function. A valid multiline lambda can use the same terminator inside its enclosing method, causing the outer method extent to end too early.

Discovered while reviewing #805 at head 8baf151.

Relevant code: https://github.com/conradcoffman/gortex/blob/8baf151/internal/parser/languages/vbnet.go#L256-L280

Reproduction

Public Class Worker
    Public Sub Run()
        Dim action = Sub()
                         Work()
                     End Sub

        client.Save()
    End Sub
End Class

The extracted Run node ends at the lambda's End Sub. Consequently, client.Save() is outside Run's function range and its CALLS edge is not emitted.

The same failure occurs with a multiline Function lambda inside a Function.

Expected behavior

The enclosing method should extend through its own terminator, and calls after a multiline lambda should remain attributed to that method.

Acceptance criteria

  • Callable extent detection accounts for same-kind multiline lambdas.
  • Add regression coverage for a Sub lambda inside a Sub.
  • Add regression coverage for a Function lambda inside a Function.
  • Assert that a qualified call after each lambda produces a CALLS edge from the enclosing method.
  • Preserve single-line extents for interface members, MustOverride members, and auto-properties.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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