diff --git a/components/instrumentation/default/index.mjs b/components/instrumentation/default/index.mjs index d92fb6910..300130f84 100644 --- a/components/instrumentation/default/index.mjs +++ b/components/instrumentation/default/index.mjs @@ -83,6 +83,7 @@ export default (dependencies) => { parseEstree(content, { allowHashBang: true, sourceType: type, + allowAwaitOutsideFunction: type === "module", ecmaVersion: configuration.language.version, locations: true, }), diff --git a/components/instrumentation/default/visit.mjs b/components/instrumentation/default/visit.mjs index d1795c5b1..00ad827d2 100644 --- a/components/instrumentation/default/visit.mjs +++ b/components/instrumentation/default/visit.mjs @@ -305,6 +305,12 @@ export default (dependencies) => { type: "Program", sourceType: type, body: [ + makeVariableDeclaration("let", [ + makeVariableDeclarator( + makeIdentifier(`${runtime}_JUMP`), + makeLiteral(null), + ), + ]), makeVariableDeclaration("let", [ makeVariableDeclarator( makeIdentifier(`${runtime}_JUMP_ID`), diff --git a/components/instrumentation/default/visit.test.mjs b/components/instrumentation/default/visit.test.mjs index da08694d6..0fe022f56 100644 --- a/components/instrumentation/default/visit.test.mjs +++ b/components/instrumentation/default/visit.test.mjs @@ -218,7 +218,8 @@ assertEqual( ), normalize( ` - let $_JUMP_ID = null + let $_JUMP = null; + let $_JUMP_ID = null; try { } catch ($_ERROR) { if ($_JUMP_ID !== null) { $.recordAfterJump($_JUMP_ID);