Find all references to sim$
.parsingSim will pull out the various ways to use sim, e.g.,
sim$xxx, sim[['xxx']], sim[[P(sim)$xxx]]
.findElementsInEnv(envToFindSim = parent.frame(),
moduleEnv = parent.frame(), type).findElement(x, type)
.parsingSim(x, type)
An environment where sim is defined. This is used when
the element accessing the simList is actually a call, e.g.,
sim[[P(sim)$stackName]]
The environment where the module functions are
Either "get", "assign", or "globals". See details.
A call in which to search for sim
A character string with all sim objects found
.findElementsInEnv is a wrapper around .findElements. It will convert
function code to a call, and then pass it to .findElements. It also does
some cleaning for duplications, NA values, and cases where the element
inside a sim[["xxx"]] is a variable that should be evaluated, rather than
simply taken verbatim (e.g., sim[[P(sim)$stackName]]).
When type = "get", the function scans for sim$xxx or sim[["xxx"]]] on
the RHS of an assignment operator or when there is no assignment. When
type = "assign", the function scans for sim$xxx or sim[['xxx']] on the
LHS of an assignment operator. When type = "globals", the function
scans for all functions (i.e., "globals") being used. This is similar to
findGlobals, but faster.
.findElement will omit whatever it finds inside a is.null, when
type = "assign". Usually this is a test of existence of that object, in
order to assign to that object. It is only reading it to determine whether or
not it should write to it.