* Creates a contextify script. * @param {string} code - The code of the script. * @param {string} filename - The filename of the script. * @param {number} lineOffset - The line offset of the script. * @param {number} columnOffset - The column offset of the script. * @param {Buffer} cachedData -
(code,
filename,
lineOffset,
columnOffset,
cachedData,
produceCachedData,
parsingContext,
hostDefinedOptionId,
importModuleDynamically)
| 178 | * @returns {ContextifyScript} The created contextify script. |
| 179 | */ |
| 180 | function makeContextifyScript(code, |
| 181 | filename, |
| 182 | lineOffset, |
| 183 | columnOffset, |
| 184 | cachedData, |
| 185 | produceCachedData, |
| 186 | parsingContext, |
| 187 | hostDefinedOptionId, |
| 188 | importModuleDynamically) { |
| 189 | let script; |
| 190 | // Calling `ReThrow()` on a native TryCatch does not generate a new |
| 191 | // abort-on-uncaught-exception check. A dummy try/catch in JS land |
| 192 | // protects against that. |
| 193 | try { // eslint-disable-line no-useless-catch |
| 194 | script = new ContextifyScript(code, |
| 195 | filename, |
| 196 | lineOffset, |
| 197 | columnOffset, |
| 198 | cachedData, |
| 199 | produceCachedData, |
| 200 | parsingContext, |
| 201 | hostDefinedOptionId); |
| 202 | } catch (e) { |
| 203 | throw e; /* node-do-not-add-exception-line */ |
| 204 | } |
| 205 | |
| 206 | registerImportModuleDynamically(script, importModuleDynamically); |
| 207 | return script; |
| 208 | } |
| 209 | |
| 210 | /** |
| 211 | * Runs a script in the current context. |
no test coverage detected
searching dependent graphs…