diff --git a/packages/code/src/function.js b/packages/code/src/function.js index 2606337..5d4a02f 100644 --- a/packages/code/src/function.js +++ b/packages/code/src/function.js @@ -74,7 +74,6 @@ export function hasExternalDependency(ast) { const locals = flattenParams(ast); locals.push( 'global', - 'super', 'window', 'Math', // ... @todo @@ -98,6 +97,9 @@ export function hasExternalDependency(ast) { hasExternal ||= -1 === locals.indexOf(name); } }, + Super: () => { + hasExternal = true; + }, })(ast.body); return hasExternal; } diff --git a/packages/code/test/function.js b/packages/code/test/function.js index 630dc46..b93a14d 100644 --- a/packages/code/test/function.js +++ b/packages/code/test/function.js @@ -58,6 +58,11 @@ it('can identify external dependencies', () => { )) .to.be.false; + expect(hasExternalDependency( + extractFunction(parse('function test(a, b) { super.whatever; }', {allowSuperOutsideMethod: true})), + )) + .to.be.true; + expect(hasExternalDependency( extractFunction(parse('function test(a, b) { this.whatever; }')), ))