Remove the unused 'scope' param from 'traverse.hasType'.
This commit is contained in:
parent
1cdacf85ae
commit
20679979fc
@ -480,7 +480,6 @@ class BlockScoping {
|
||||
// handle generators
|
||||
const hasYield = traverse.hasType(
|
||||
fn.body,
|
||||
this.scope,
|
||||
"YieldExpression",
|
||||
t.FUNCTION_TYPES,
|
||||
);
|
||||
@ -493,7 +492,6 @@ class BlockScoping {
|
||||
// handlers async functions
|
||||
const hasAsync = traverse.hasType(
|
||||
fn.body,
|
||||
this.scope,
|
||||
"AwaitExpression",
|
||||
t.FUNCTION_TYPES,
|
||||
);
|
||||
|
||||
@ -81,7 +81,6 @@ function hasBlacklistedType(path, state) {
|
||||
|
||||
traverse.hasType = function(
|
||||
tree: Object,
|
||||
scope: Object,
|
||||
type: Object,
|
||||
blacklistTypes: Array<string>,
|
||||
): boolean {
|
||||
@ -99,10 +98,11 @@ traverse.hasType = function(
|
||||
traverse(
|
||||
tree,
|
||||
{
|
||||
noScope: true,
|
||||
blacklist: blacklistTypes,
|
||||
enter: hasBlacklistedType,
|
||||
},
|
||||
scope,
|
||||
null,
|
||||
state,
|
||||
);
|
||||
|
||||
|
||||
@ -85,20 +85,18 @@ describe("traverse", function() {
|
||||
});
|
||||
|
||||
it("hasType", function() {
|
||||
assert.ok(traverse.hasType(ast, null, "ThisExpression"));
|
||||
assert.ok(traverse.hasType(ast, "ThisExpression"));
|
||||
assert.ok(
|
||||
!traverse.hasType(ast, null, "ThisExpression", ["AssignmentExpression"]),
|
||||
!traverse.hasType(ast, "ThisExpression", ["AssignmentExpression"]),
|
||||
);
|
||||
|
||||
assert.ok(traverse.hasType(ast, null, "ThisExpression"));
|
||||
assert.ok(traverse.hasType(ast, null, "Program"));
|
||||
assert.ok(traverse.hasType(ast, "ThisExpression"));
|
||||
assert.ok(traverse.hasType(ast, "Program"));
|
||||
|
||||
assert.ok(
|
||||
!traverse.hasType(ast, null, "ThisExpression", ["MemberExpression"]),
|
||||
);
|
||||
assert.ok(!traverse.hasType(ast, null, "ThisExpression", ["Program"]));
|
||||
assert.ok(!traverse.hasType(ast, "ThisExpression", ["MemberExpression"]));
|
||||
assert.ok(!traverse.hasType(ast, "ThisExpression", ["Program"]));
|
||||
|
||||
assert.ok(!traverse.hasType(ast, null, "ArrowFunctionExpression"));
|
||||
assert.ok(!traverse.hasType(ast, "ArrowFunctionExpression"));
|
||||
});
|
||||
|
||||
it("clearCache", function() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user