How to use babel-helper-replace-supers - 2 common examples

To help you get started, we’ve selected a few babel-helper-replace-supers 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-plugin-transform-es2015-object-super / src / index.js View on Github external
function Property(path, node, scope, getObjectRef, file) {
    let replaceSupers = new ReplaceSupers({
      getObjectRef: getObjectRef,
      methodNode:   node,
      methodPath:   path,
      isStatic:     true,
      scope:        scope,
      file:         file
    });

    replaceSupers.replace();
  }
github babel / babel / packages / babel-plugin-transform-es2015-classes / src / vanilla.js View on Github external
if (node.decorators) {
        throw path.buildCodeFrameError("Method has decorators, put the decorator plugin before the classes one.");
      }

      if (t.isClassMethod(node)) {
        let isConstructor = node.kind === "constructor";

        if (isConstructor) {
          path.traverse(verifyConstructorVisitor, this);

          if (!this.hasBareSuper && this.isDerived) {
            throw path.buildCodeFrameError("missing super() call in constructor");
          }
        }

        let replaceSupers = new ReplaceSupers({
          forceSuperMemoisation: isConstructor,
          methodPath:            path,
          methodNode:            node,
          objectRef:             this.classRef,
          superRef:              this.superName,
          isStatic:              node.static,
          isLoose:               this.isLoose,
          scope:                 this.scope,
          file:                  this.file
        }, true);

        replaceSupers.replace();

        if (isConstructor) {
          this.pushConstructor(replaceSupers, node, path);
        } else {

babel-helper-replace-supers

Helper function to replace supers

MIT
Latest version published 8 years ago

Package Health Score

82 / 100
Full package analysis

Popular babel-helper-replace-supers functions

Similar packages