Skip to content

Commit

Permalink
Fix super handling
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Oct 9, 2024
1 parent cbb5780 commit 658feef
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ export default declare(api => {
}

function maybeMemoize(node: t.Expression, scope: Scope) {
if (scope.isPure(node)) return { assign: node, ref: t.cloneNode(node) };
if (scope.isPure(node) || t.isSuper(node)) {
return { assign: node, ref: t.cloneNode(node) };
}

const id = scope.generateUidIdentifierBasedOnNode(node);
scope.push({ id });
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
foo = {
bar() {
return super.baz **= 12;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"plugins": ["transform-exponentiation-operator"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
foo = {
bar() {
return super.baz = Math.pow(super.baz, 12);
}
};

0 comments on commit 658feef

Please sign in to comment.