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 // handle generators
const hasYield = traverse.hasType( const hasYield = traverse.hasType(
fn.body, fn.body,
this.scope,
"YieldExpression", "YieldExpression",
t.FUNCTION_TYPES, t.FUNCTION_TYPES,
); );
@ -493,7 +492,6 @@ class BlockScoping {
// handlers async functions // handlers async functions
const hasAsync = traverse.hasType( const hasAsync = traverse.hasType(
fn.body, fn.body,
this.scope,
"AwaitExpression", "AwaitExpression",
t.FUNCTION_TYPES, t.FUNCTION_TYPES,
); );

View File

@ -81,7 +81,6 @@ function hasBlacklistedType(path, state) {
traverse.hasType = function( traverse.hasType = function(
tree: Object, tree: Object,
scope: Object,
type: Object, type: Object,
blacklistTypes: Array<string>, blacklistTypes: Array<string>,
): boolean { ): boolean {
@ -99,10 +98,11 @@ traverse.hasType = function(
traverse( traverse(
tree, tree,
{ {
noScope: true,
blacklist: blacklistTypes, blacklist: blacklistTypes,
enter: hasBlacklistedType, enter: hasBlacklistedType,
}, },
scope, null,
state, state,
); );

View File

@ -85,20 +85,18 @@ describe("traverse", function() {
}); });
it("hasType", function() { it("hasType", function() {
assert.ok(traverse.hasType(ast, null, "ThisExpression")); assert.ok(traverse.hasType(ast, "ThisExpression"));
assert.ok( 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, "ThisExpression"));
assert.ok(traverse.hasType(ast, null, "Program")); assert.ok(traverse.hasType(ast, "Program"));
assert.ok( assert.ok(!traverse.hasType(ast, "ThisExpression", ["MemberExpression"]));
!traverse.hasType(ast, null, "ThisExpression", ["MemberExpression"]), assert.ok(!traverse.hasType(ast, "ThisExpression", ["Program"]));
);
assert.ok(!traverse.hasType(ast, null, "ThisExpression", ["Program"]));
assert.ok(!traverse.hasType(ast, null, "ArrowFunctionExpression")); assert.ok(!traverse.hasType(ast, "ArrowFunctionExpression"));
}); });
it("clearCache", function() { it("clearCache", function() {