Skip to content

Commit 0dd9658

Browse files
committed
refactor: minor improvements
1 parent bdf1fc7 commit 0dd9658

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

packages/utilities/var/src/is-node-value-equal.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ const thisBlockTypes = [
2626
export function isNodeValueEqual(
2727
a: TSESTree.Node,
2828
b: TSESTree.Node,
29-
initialScopes: [Scope, Scope],
29+
initialScopes: [
30+
aScope: Scope,
31+
bScope: Scope,
32+
],
3033
): boolean {
3134
const [aScope, bScope] = initialScopes;
3235
switch (true) {
@@ -97,9 +100,9 @@ export function isNodeValueEqual(
97100
case a.type === AST_NODE_TYPES.ThisExpression
98101
&& b.type === AST_NODE_TYPES.ThisExpression: {
99102
if (aScope.block === bScope.block) return true;
100-
const fa = AST.traverseUp(a, AST.isOneOf(thisBlockTypes));
101-
const fb = AST.traverseUp(a, AST.isOneOf(thisBlockTypes));
102-
return O.isSome(fa) && O.isSome(fb) && fa.value === fb.value;
103+
const aFunction = AST.traverseUp(a, AST.isOneOf(thisBlockTypes));
104+
const bFunction = AST.traverseUp(a, AST.isOneOf(thisBlockTypes));
105+
return O.isSome(aFunction) && O.isSome(bFunction) && aFunction.value === bFunction.value;
103106
}
104107
default: {
105108
const aStatic = getStaticValue(a, aScope);

0 commit comments

Comments
 (0)