Skip to content

Commit

Permalink
Check for super context when not an AssignmentExpression
Browse files Browse the repository at this point in the history
  • Loading branch information
shrirambalaji committed Nov 12, 2019
1 parent 5f1210c commit ddc6466
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/babel-plugin-proposal-optional-chaining/src/index.js
Expand Up @@ -82,14 +82,12 @@ export default declare((api, options) => {
let context = scope.maybeGenerateMemoised(object);
if (context) {
chain.object = t.assignmentExpression("=", context, object);
} else if (t.isSuper(object)) {
context = t.thisExpression();
} else {
context = object;
}

if (t.isSuper(context)) {
context = t.thisExpression();
}

node.arguments.unshift(t.cloneNode(context));
node.callee = t.memberExpression(
node.callee,
Expand Down

0 comments on commit ddc6466

Please sign in to comment.