How to use the @babel/types.callExpression function in @babel/types

To help you get started, we’ve selected a few @babel/types 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 infernojs / babel-plugin-inferno / lib / index.js View on Github external
}
      return t.callExpression(
        t.identifier(opts.pragmaFragmentVNode || 'createFragment'),
        createFragmentVNodeArgs(
          vChildren,
          childFlags,
          vProps.key,
          defineAll
        )
      );
    }

    // NormalizeProps will normalizeChildren too
    if (vProps.needsNormalization) {
      fileState.set('normalizeProps', true);
      createVNodeCall = t.callExpression(
        t.identifier(opts.pragmaNormalizeProps || 'normalizeProps'),
        [createVNodeCall]
      );
    }

    return createVNodeCall;
  case 'JSXText':
    text = handleWhiteSpace(astNode.value);

    if (text !== '') {
      return t.StringLiteral(text);
    }
    break;
  case 'JSXExpressionContainer':
    var expression = astNode.expression;
github wix / react-autodocs-utils / src / prepare-story / index.js View on Github external
}

          configObject.properties.push(
            types.objectProperty(types.identifier('_config'), types.objectExpression(configProperties))
          );

          return types.callExpression(types.identifier('story'), [node]);
        }

        if (exportsObject) {
          node.properties.push(
            types.objectProperty(types.identifier('_config'), types.objectExpression(configProperties))
          );

          // wrap exported object with `story()`
          return types.callExpression(types.identifier('story'), [node]);
        }
      };
github infernojs / babel-plugin-inferno / lib / index.js View on Github external
vChildren = transformTextNodes(vChildren, childrenResults, opts, fileState);
    }

    if (vProps.childFlags) {
      // If $ChildFlag is provided it is runtime dependant
      childFlags = vProps.childFlags;
    } else {
      childFlags = vNodeType !== TYPE_COMPONENT && childrenResults.requiresNormalization && !vProps.childrenKnown ? ChildFlags.UnknownChildren : childFlags;
    }

    var createVNodeCall;

    switch (vNodeType) {
    case TYPE_COMPONENT:
      fileState.set('createComponentVNode', true);
      createVNodeCall = t.callExpression(
        t.identifier(opts.pragmaCreateComponentVNode || 'createComponentVNode'),
        createComponentVNodeArgs(
          vProps.flagsOverride || flags,
          vType.type,
          props,
          vProps.key,
          vProps.ref,
          defineAll
        )
      );
      break;
    case TYPE_ELEMENT:
      fileState.set('createVNode', true);
      createVNodeCall = t.callExpression(
        t.identifier(opts.pragma || 'createVNode'),
        createVNodeArgs(
github alan-ai / alan-sdk-reactnative / testtools / node_modules / @babel / helper-builder-react-jsx-experimental / src / index.js View on Github external
options.pre(state, file);
    }

    const attribs = buildCreateElementOpeningElementAttributes(
      path,
      openingPath.node.attributes,
    );

    args.push(attribs, ...path.node.children);

    if (options.post) {
      options.post(state, file);
    }

    const call =
      state.call || t.callExpression(state.createElementCallee, args);
    if (state.pure) annotateAsPure(call);

    return call;
  }
github peakchen90 / babel-plugin-react-directives / src / directives / model.js View on Github external
} else {
    const mergeResult = getMergeValueExpression({
      attrPath,
      stateBindingStack,
      newValExpression,
      prevState,
      useType: 'hook'
    });
    statements = mergeResult.statements;
    result = mergeResult.result;
  }

  return [
    ...statements,
    t.expressionStatement(
      t.callExpression(
        updateFn,
        [result]
      )
    )
  ];
}
github peakchen90 / babel-plugin-react-directives / src / directives / model.js View on Github external
const {
    statements,
    result
  } = getMergeValueExpression({
    attrPath,
    stateBindingStack,
    newValExpression,
    prevState: prevStateVar,
    useType: 'class'
  });


  return [
    t.expressionStatement(
      t.callExpression(
        builder.buildMemberExpression(
          t.thisExpression(),
          t.identifier('setState')
        ),
        [
          t.arrowFunctionExpression(
            [prevStateVar],
            t.blockStatement([
              ...statements,
              t.returnStatement(result)
            ])
          )
        ]
      )
    )
  ];
github ismail-codar / fidan / packages / deprecated-babel-plugin-transform-jsx / build / modify.js View on Github external
const dynamicExpressionInitComputeValues = (expression, fComputeParameters) => {
    return t.callExpression(t.memberExpression(t.identifier("fidan"), t.identifier("initCompute")), [
        t.functionExpression(t.identifier(""), [], t.blockStatement([t.returnStatement(expression)]))
    ].concat(fComputeParameters));
};
const fidanAssignmentExpressionSetCompute = (expression, fComputeParameters) => {
github Gregoor / tofu / src / actions.ts View on Github external
execute: ({ ast }) => {
                const expressionPath = path.slice().reverse();
                getNodeFromPath(ast, expressionPath.slice(0, -1))[
                  expressionPath[expressionPath.length - 1]
                ] = t.callExpression(t.identifier('call'), [node]);
                return ast =>
                  selectName(
                    getNodeFromPath(ast, expressionPath.concat('callee'))
                  );
              }
            }
github facebook / prepack / src / serializer / ResidualOperationSerializer.js View on Github external
_serializeConsoleLog(
    {  }: OperationDescriptorData,
    [propName, ...nodes]: Array
  ): BabelNodeStatement {
    let propString = ((propName: any): BabelNodeStringLiteral).value;
    return t.expressionStatement(
      t.callExpression(t.memberExpression(t.identifier("console"), t.identifier(propString)), [...nodes])
    );
  }