How to use @babel/helper-optimise-call-expression - 3 common examples

To help you get started, we’ve selected a few @babel/helper-optimise-call-expression examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github babel / babel / packages / babel-helper-create-class-features-plugin / src / fields.js View on Github external
call(member, args) {
    // The first access (the get) should do the memo assignment.
    this.memoise(member, 1);

    return optimiseCall(this.get(member), this.receiver(member), args);
  },
};
github babel / babel / packages / babel-plugin-transform-classes / src / transformClass.js View on Github external
// special case single arguments spread
        bareSuperNode.arguments[1] = bareSuperNode.arguments[1].argument;
        bareSuperNode.callee = t.memberExpression(
          t.cloneNode(superRef),
          t.identifier("apply"),
        );
      } else {
        bareSuperNode.callee = t.memberExpression(
          t.cloneNode(superRef),
          t.identifier("call"),
        );
      }

      call = t.logicalExpression("||", bareSuperNode, t.thisExpression());
    } else {
      bareSuperNode = optimiseCall(
        t.callExpression(classState.file.addHelper("getPrototypeOf"), [
          t.cloneNode(classState.classRef),
        ]),
        t.thisExpression(),
        bareSuperNode.arguments,
      );

      call = t.callExpression(
        classState.file.addHelper("possibleConstructorReturn"),
        [t.thisExpression(), bareSuperNode],
      );
    }

    if (
      bareSuper.parentPath.isExpressionStatement() &&
      bareSuper.parentPath.container === body.node.body &&
github babel / babel / packages / babel-helper-replace-supers / src / index.js View on Github external
call(superMember, args) {
    return optimiseCall(this.get(superMember), t.thisExpression(), args);
  },
};

@babel/helper-optimise-call-expression

Helper function to optimise call expression

MIT
Latest version published 11 months ago

Package Health Score

91 / 100
Full package analysis

Popular @babel/helper-optimise-call-expression functions

Similar packages