Skip to content

Commit

Permalink
refactor: rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed May 23, 2023
1 parent 563ec33 commit fca1703
Showing 1 changed file with 28 additions and 14 deletions.
42 changes: 28 additions & 14 deletions lib/javascript/JavascriptParser.js
Expand Up @@ -277,7 +277,7 @@ class JavascriptParser extends Parser {
]),
/** @type {SyncBailHook<[MethodDefinition | PropertyDefinition | StaticBlock, ClassExpression | ClassDeclaration], boolean | void>} */
classBodyElement: new SyncBailHook(["element", "classDefinition"]),
/** @type {SyncBailHook<[Expression, MethodDefinition | PropertyDefinition, ClassExpression | ClassDeclaration], boolean | void>} */
/** @type {SyncBailHook<[Expression, MethodDefinition | PropertyDefinition | StaticBlock, ClassExpression | ClassDeclaration], boolean | void>} */
classBodyValue: new SyncBailHook([
"expression",
"element",
Expand Down Expand Up @@ -3963,20 +3963,34 @@ class JavascriptParser extends Parser {
return false;
}
const items =
/** @type {(MethodDefinition | PropertyDefinition)[]} */
/** @type {TODO[]} */
(expr.body.body);
return items.every(
item =>
(!item.computed ||
!item.key ||
this.isPure(item.key, item.range[0])) &&
(!item.static ||
!item.value ||
this.isPure(
item.value,
item.key ? item.key.range[1] : item.range[0]
))
);
return items.every(item => {
if (
item.computed &&
item.key &&
!this.isPure(item.key, item.range[0])
) {
return false;
}

if (
item.static &&
item.value &&
!this.isPure(
item.value,
item.key ? item.key.range[1] : item.range[0]
)
) {
return false;
}

if (item.type === "StaticBlock") {
return false;
}

return true;
});
}

case "FunctionDeclaration":
Expand Down

0 comments on commit fca1703

Please sign in to comment.