Search code examples
node.jsv8embedded-v8

I cannot find the definition of a method in node.js source code


I see 'env->context()' scattered throughout the node.js source code, where the variable 'env' is of a pointer to some Environment object (which I believe is defined in env.h). I cannot find the definition of this context() method associated with the Environment object anywhere in the source code. Can someone please point me in the right direction? I am looking for this simply out of curiosity.


Solution

  • It is generated via this macro: https://github.com/nodejs/node/blob/5fab50bdaf6d82abc8a15bc55685211431ef3b75/src/env.h#L331

    The function declaration is here: https://github.com/nodejs/node/blob/5fab50bdaf6d82abc8a15bc55685211431ef3b75/src/env.h#L837

    You'll find the implementation if you look for further uses of the ENVIRONMENT_STRONG_PERSISTENT_PROPERTIES macro.