Sha256: 76bf49dadc94107c6759aec9e89812efadc5386afacf51b5e89e79ecbd0f51d7

Contents?: true

Size: 850 Bytes

Versions: 8

Compression:

Stored size: 850 Bytes

Contents

/**
 * Prints ComprehensionBlock, prints left and right.
 */

"use strict";

exports.__esModule = true;
exports.ComprehensionBlock = ComprehensionBlock;
exports.ComprehensionExpression = ComprehensionExpression;

function ComprehensionBlock(node, print) {
  this.keyword("for");
  this.push("(");
  print.plain(node.left);
  this.push(" of ");
  print.plain(node.right);
  this.push(")");
}

/**
 * Prints ComprehensionExpression, prints blocks, filter, and body. Handles generators.
 */

function ComprehensionExpression(node, print) {
  this.push(node.generator ? "(" : "[");

  print.join(node.blocks, { separator: " " });
  this.space();

  if (node.filter) {
    this.keyword("if");
    this.push("(");
    print.plain(node.filter);
    this.push(")");
    this.space();
  }

  print.plain(node.body);

  this.push(node.generator ? ")" : "]");
}

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
ilog-0.4.1 node_modules/babel/node_modules/babel-core/lib/generation/generators/comprehensions.js
ilog-0.4.0 node_modules/babel/node_modules/babel-core/lib/generation/generators/comprehensions.js
ilog-0.3.3 node_modules/babel/node_modules/babel-core/lib/generation/generators/comprehensions.js
xcodebuild-helper-1.2.5 externals/ios-sim-master/node_modules/babel-core/lib/generation/generators/comprehensions.js
xcodebuild-helper-1.2.3 externals/ios-sim-master/node_modules/babel-core/lib/generation/generators/comprehensions.js
es6_tilt-0.1.2 test/dummy/app/assets/javascripts/node_modules/babel-core/lib/generation/generators/comprehensions.js
es6_tilt-0.1.1 test/dummy/app/assets/javascripts/node_modules/babel-core/lib/generation/generators/comprehensions.js
es6_tilt-0.1.0 test/dummy/app/assets/javascripts/node_modules/babel-core/lib/generation/generators/comprehensions.js