File: par_frame.Rd

package info (click to toggle)
r-cran-diffobj 0.3.5-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 2,432 kB
  • sloc: ansic: 455; javascript: 96; sh: 32; makefile: 8
file content (31 lines) | stat: -rwxr-xr-x 1,220 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/misc.R
\name{par_frame}
\alias{par_frame}
\title{Get Parent Frame of S4 Call Stack}
\usage{
par_frame()
}
\value{
an environment
}
\description{
Implementation of the \code{function(x=parent.frame()) ...} pattern for the
\code{\link[=diffPrint]{diff*}} methods since the normal pattern does not
work with S4 methods.  Works by looking through the call stack and
identifying what call likely initiated the S4 dispatch.
}
\details{
The function is not exported and intended only for use as the default value
for the \code{frame} argument for the \code{\link[=diffPrint]{diff*}}
methods.

Matching is done purely by looking for the last repeated call followed
by \code{.local(target, current, ...)} that is not a call to \code{eval}.
This pattern seems to match the correct call most of the time.
Since methods can be renamed by the user we make no attempt to verify method
names.  This method could potentially be tricked if you implement custom
\code{\link[=diffPrint]{diff*}} methods that somehow
issue two identical sequential calls before calling \code{callNextMethod}.
Failure in this case means the wrong \code{frame} will be returned.
}