How to use the ast-types.builders.callExpression function in ast-types

To help you get started, we’ve selected a few ast-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 probmods / webppl / src / transforms / naming.js View on Github external
function naming(node) {
  switch (node.type) {
    case Syntax.FunctionExpression:
      return build.functionExpression(node.id,
          [addresses.shift()].concat(node.params),
          node.body);

    // add a gensym onto the address variable
    case Syntax.CallExpression:
      if (isPrimitive(node.callee)) {
        return node;
      } else {
        return build.callExpression(node.callee,
            [makeAddressExtension(addresses[0])].concat(node.arguments));
      }

    default:
  }
}
github probmods / webppl / src / transforms / trampoline.js View on Github external
return inProgram(function(node) {
    return build.callExpression(driver, [replace(node, {
      enter: skip,
      leave: trampoline
    })]);
  })(node, fail('trampoline', node));
}
github rexxars / sql-to-graphql / steps / generate-types.js View on Github external
function generateRelayReferenceField(reference) {
        return generateField({
            name: reference.field,
            description: reference.description || opts.defaultDescription + ' (reference)',
            resolve: b.callExpression(
                b.identifier('getConnectionResolver'),
                [b.literal(reference.model.name)]
            ),
            args: b.property('init', b.identifier('args'), b.identifier('connectionArgs'))
        }, b.callExpression(
            b.identifier('getConnection'),
            [b.literal(reference.model.name)]
        ));
    }
github styleguidist / react-styleguidist / src / loaders / utils / requireIt.js View on Github external
value() {
			return b.callExpression(b.identifier('require'), [b.literal(filepath)]);
		},
	});
github rexxars / sql-to-graphql / steps / ast-builders / schema-imports.js View on Github external
b.variableDeclaration('var',
            [b.variableDeclarator(
                b.identifier('getEntityResolver'),
                b.callExpression(
                    b.identifier('require'),
                    [b.literal('./util/entity-resolver')]
                )
            )]
        )
    ];

    if (graphql.length) {
        declarations.push(b.variableDeclaration('var',
            [b.variableDeclarator(
                b.identifier('GraphQL'),
                b.callExpression(
                    b.identifier('require'),
                    [b.literal('graphql')]
                )
            )]
        ));
    }

    if (opts.relay) {
        declarations.push(b.variableDeclaration('var',
            [b.variableDeclarator(
                b.identifier('Node'),
                b.callExpression(
                    b.identifier('require'),
                    [b.literal('./types/Node')]
                )
            )]
github rainforestapp / decaf / src / parser.js View on Github external
function mapSlice(node: CRange, meta: Object) {
  return b.callExpression(
    b.identifier('slice'),
    [
      mapExpression(node.range.from, meta),
      mapExpression(node.range.to, meta),
    ]
  );
}
github rexxars / sql-to-graphql / steps / ast-builders / resolver.js View on Github external
module.exports = function buildResolver(model) {
    return b.callExpression(
        b.identifier('getEntityResolver'),
        [b.literal(model.name)]
    );
};
github paeckchen / paeckchen / packages / paeckchen-core / src / globals.ts View on Github external
if (bufferPath === undefined) {
    return Promise.resolve();
  }
  const bufferModulePath = await getModulePath('.', 'buffer', context);
  const bufferIndex = getModuleIndex(bufferModulePath, state);
  const body = bufferPath.get('body');
  body.get(body.value.length - 1).insertBefore(
    b.variableDeclaration(
      'var',
      [
        b.variableDeclarator(
          b.identifier('Buffer'),
          b.memberExpression(
            b.memberExpression(
              b.callExpression(
                b.identifier('__paeckchen_require__'),
                [
                  b.literal(bufferIndex)
                ]
              ),
              b.identifier('exports'),
              false
            ),
            b.identifier('Buffer'),
            false
          )
        )
      ]
    )
  );
  enqueueModule(bufferModulePath, state, context);