MCPcopy Index your code
hub / github.com/nodejs/node / internalCompileFunction

Function internalCompileFunction

lib/internal/vm.js:133–165  ·  view source on GitHub ↗

* Compiles a function from the given code string. * @param {string} code - The code string to compile. * @param {string} filename - The filename to use for the compiled function. * @param {number} lineOffset - The line offset to use for the compiled function. * @param {number} columnOffset - The

(
  code, filename, lineOffset, columnOffset,
  cachedData, produceCachedData, parsingContext, contextExtensions,
  params, hostDefinedOptionId, importModuleDynamically)

Source from the content-addressed store, hash-verified

131 * @throws {ERR_INVALID_ARG_TYPE} If the parsing context is not a valid context object.
132 */
133function internalCompileFunction(
134 code, filename, lineOffset, columnOffset,
135 cachedData, produceCachedData, parsingContext, contextExtensions,
136 params, hostDefinedOptionId, importModuleDynamically) {
137 const result = compileFunction(
138 code,
139 filename,
140 lineOffset,
141 columnOffset,
142 cachedData,
143 produceCachedData,
144 parsingContext,
145 contextExtensions,
146 params,
147 hostDefinedOptionId,
148 );
149
150 if (produceCachedData) {
151 result.function.cachedDataProduced = result.cachedDataProduced;
152 }
153
154 if (result.cachedData) {
155 result.function.cachedData = result.cachedData;
156 }
157
158 if (typeof result.cachedDataRejected === 'boolean') {
159 result.function.cachedDataRejected = result.cachedDataRejected;
160 }
161
162 registerImportModuleDynamically(result.function, importModuleDynamically);
163
164 return result;
165}
166
167/**
168 * Creates a contextify script.

Callers 1

compileFunctionFunction · 0.85

Calls 2

compileFunctionFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…