packages/babel-plugin-proposal-decorators/src/transformer-legacy.js
function applyClassDecorators(classPath) {
  if (!hasClassDecorators(classPath.node)) return;

  const decorators = classPath.node.decorators || [];
  classPath.node.decorators = null;

  const name = classPath.scope.generateDeclaredUidIdentifier("class");

  return decorators
    .map(dec => dec.expression)
    .reverse()
    .reduce(function(acc, decorator) {
      return buildClassDecorator({
        CLASS_REF: t.cloneNode(name),
        DECORATOR: t.cloneNode(decorator),
        INNER: acc,
      }).expression;
    }, classPath.node);
}
function applyClassDecorators(classPath) {
  if (!hasClassDecorators(classPath.node)) return;

  const decorators = classPath.node.decorators || [];
  classPath.node.decorators = null;

  const name = classPath.scope.generateDeclaredUidIdentifier("class");

  return decorators
    .map(dec => dec.expression)
    .reverse()
    .reduce(function(acc, decorator) {
      return buildClassDecorator({
        CLASS_REF: t.cloneNode(name),
        DECORATOR: t.cloneNode(decorator),
        INNER: acc,
      }).expression;
    }, classPath.node);
}
function applyClassDecorators ( classPath ) { if ( ! hasClassDecorators ( classPath . node ) ) return ; const decorators = classPath . node . decorators || [ ] ; classPath . node . decorators = null ; const name = classPath . scope . generateDeclaredUidIdentifier ( "class" ) ; return decorators . map ( dec => dec . expression ) . reverse ( ) . reduce ( function ( acc , decorator ) { return buildClassDecorator ( { CLASS_REF : t . cloneNode ( name ) , DECORATOR : t . cloneNode ( decorator ) , INNER : acc , } ) . expression ; } , classPath . node ) ; }
Given a class expression with class-level decorators, create a new expression
with the proper decorated behavior.
Given a class expression with class - level decorators create a new expression with the proper decorated behavior .