Skip to content

Discriminating overdub calls for "same" function/args #179

@robertfeldt

Description

@robertfeldt

This can probably be done with a specific pass but I wonder if there is a simpler way to "tag" the calls to overdub so I can related them back to the original code of the overdubbed method?

One way to illustrate this is that for a function like:

function f(x, y)
  if x < y           # line 1
    return x + y     # line 2 
  else
    a = x + y        # line 4
    return a
  end
end

I would want a way to discriminate between the Cassette.overdub(ctx, :+, :x, :y) call on "line" 2 and the same call on "line" 4. So essentially something like a Cassette.overdub(context::Context, n::Int, f, args...) where n is unique Int for each unique call site of the overdubbed code.

What I'm trying to achieve here is a simple expression coverage calculation and even though the calls have the same arguments and returns the same result the calls correspond to different "call sites" so for some applications (like mine) we need to keep them apart.

Any ideas how to easily achieve this? Or have you seen anyone implementing a code/expression coverage tool using Cassette? Thanks in advance for any pointers/insight.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions