How to use the esprima-fb.Syntax.BlockStatement function in esprima-fb

To help you get started, we’ve selected a few esprima-fb 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 Lapple / ErrorBoard / node_modules / react-tools / node_modules / jstransform / visitors / es6-arrow-function-visitors.js View on Github external
function visitArrowFunction(traverse, node, path, state) {
  var notInExpression = (path[0].type === Syntax.ExpressionStatement);

  // Wrap a function into a grouping operator, if it's not
  // in the expression position.
  if (notInExpression) {
    utils.append('(', state);
  }

  utils.append('function', state);
  renderParams(traverse, node, path, state);

  // Skip arrow.
  utils.catchupWhiteSpace(node.body.range[0], state);

  var renderBody = node.body.type == Syntax.BlockStatement
    ? renderStatementBody
    : renderExpressionBody;

  path.unshift(node);
  renderBody(traverse, node, path, state);
  path.shift();

  // Bind the function only if `this` value is used
  // inside it or inside any sub-expression.
  var containsBindingSyntax =
    utils.containsChildMatching(node.body, function(node) {
      return node.type === Syntax.ThisExpression
             || (node.type === Syntax.Identifier
                 && node.name === "super");
    });
github facebookarchive / jstransform / visitors / es6-for-of-visitors.js View on Github external
utils.append(variable + '=' + iter + '[' + k + '++];', state);

  // Iterators case.
  utils.append(
    '}else{' + k + '=' + iter + '.next();' +
    'if(' + k + '.done) break;',
    state
  );

  utils.append(variable + '=' + k + '.value;}', state);

  traverse(node.body, path, state);
  utils.catchup(node.body.range[1], state);

  if (node.body.type !== Syntax.BlockStatement) {
    utils.append('}', state);
  }

  return false;
}
github Caltech-IPAC / firefly / node_modules / react / node_modules / envify / node_modules / jstransform / visitors / es6-arrow-function-visitors.js View on Github external
function visitArrowFunction(traverse, node, path, state) {
  var notInExpression = (path[0].type === Syntax.ExpressionStatement);

  // Wrap a function into a grouping operator, if it's not
  // in the expression position.
  if (notInExpression) {
    utils.append('(', state);
  }

  utils.append('function', state);
  renderParams(traverse, node, path, state);

  // Skip arrow.
  utils.catchupWhiteSpace(node.body.range[0], state);

  var renderBody = node.body.type == Syntax.BlockStatement
    ? renderStatementBody
    : renderExpressionBody;

  path.unshift(node);
  renderBody(traverse, node, path, state);
  path.shift();

  // Bind the function only if `this` value is used
  // inside it or inside any sub-expression.
  var containsBindingSyntax =
    utils.containsChildMatching(node.body, function(node) {
      return node.type === Syntax.ThisExpression
             || (node.type === Syntax.Identifier
                 && node.name === "super");
    });
github facebookarchive / jstransform / visitors / es6-for-of-visitors.js View on Github external
utils.append(iter + '=', state);
  process(traverse, node.right, path, state);

  // Setup iterator with optimization for arrays.
  utils.append(
    ',' + isArray + '=Array.isArray(' + iter + '),' +
    k + '=0,' +
    iter + '=' + isArray + '?' + iter + ':' +
    iter + '[/*global Symbol*/typeof Symbol=="function"' +
      '?Symbol.iterator:"@@iterator"]();;',
    state
  );

  // Jump to the body creating block if needed.
  if (node.body.type === Syntax.BlockStatement) {
    utils.catchup(node.body.range[0] + 1, state);
  } else {
    utils.catchup(node.body.range[0], state);
    utils.append('{', state);
  }

  // Arrays case.
  utils.append(
    'if(' + isArray + '){' +
    'if(' + k + '>=' + iter + '.length) break;',
    state
  );

  utils.append(variable + '=' + iter + '[' + k + '++];', state);

  // Iterators case.
github guptag / FinCharts / app / node_modules / react / node_modules / envify / node_modules / jstransform / visitors / es6-rest-param-visitors.js View on Github external
visitFunctionBodyWithRestParam.test = function(node, path, state) {
  return node.type === Syntax.BlockStatement
         && _nodeIsFunctionWithRestParam(path[0]);
};
github andrewshawcare / thoughtworks-email-signature-generator / node_modules / jsxhint / node_modules / jstransform / visitors / es6-rest-param-visitors.js View on Github external
visitFunctionBodyWithRestParam.test = function(node, path, state) {
  return node.type === Syntax.BlockStatement
         && _nodeIsFunctionWithRestParam(path[0]);
};
github Caltech-IPAC / firefly / node_modules / react / node_modules / envify / node_modules / jstransform / visitors / es6-destructuring-visitors.js View on Github external
visitFunctionBodyForStructuredParameter.test = function(node, path, state) {
  return node.type === Syntax.BlockStatement && isFunctionNode(path[0]);
};
github Lapple / ErrorBoard / node_modules / react-tools / node_modules / jstransform / visitors / es6-rest-param-visitors.js View on Github external
visitFunctionBodyWithRestParam.test = function(node, path, state) {
  return node.type === Syntax.BlockStatement
         && _nodeIsFunctionWithRestParam(path[0]);
};
github joshuaslate / saas-tutorial / node_modules / jstransform / visitors / es6-rest-param-visitors.js View on Github external
visitFunctionBodyWithRestParam.test = function(node, path, state) {
  return node.type === Syntax.BlockStatement
         && _nodeIsFunctionWithRestParam(path[0]);
};
github facebookarchive / jstransform / visitors / es6-destructuring-visitors.js View on Github external
visitFunctionBodyForStructuredParameter.test = function(node, path, state) {
  return node.type === Syntax.BlockStatement && isFunctionNode(path[0]);
};