Remove the unused 'scope' param from 'traverse.hasType'.

This commit is contained in:
Logan Smyth 2017-09-12 16:28:52 -07:00
parent 1cdacf85ae
commit 20679979fc
3 changed files with 9 additions and 13 deletions

View File

@ -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,
);

View File

@ -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,
);

View File

@ -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() {