Skip to content

Commit

Permalink
Eval compile function always return object with same shape [refactor]
Browse files Browse the repository at this point in the history
  • Loading branch information
overlookmotel committed Nov 9, 2023
1 parent 2f75f91 commit e95ff7c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/init/eval.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ function execEvalCode(exec, arg, shouldThrowSyntaxError, code, fn) {
* {string} .code - Instrumented code (or input code if parsing failed)
* {boolean} .shouldThrow - `true` if could not parse code, so calling `eval()` with this code
* should throw syntax error
* {boolean} .prefixNumChanged - `true` if prefix num inside `eval()` differs from outside
*/
function compile(code, tracker, filename, isIndirectEval, state, isStrict) {
// Parse code.
Expand All @@ -205,7 +206,7 @@ function compile(code, tracker, filename, isIndirectEval, state, isStrict) {
code, filename, false, false, !isIndirectEval, false, isStrict, false, undefined
).ast;
} catch (err) {
return {code, shouldThrow: true};
return {code, shouldThrow: true, prefixNumChanged: false};
}

// Instrument code.
Expand Down

0 comments on commit e95ff7c

Please sign in to comment.