refactor: mark super as external
This commit is contained in:
parent
c1d03764c1
commit
87e2f1b9ca
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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; }')),
|
||||
))
|
||||
|
|
Loading…
Reference in New Issue
Block a user