Sha256: a1784dc05d7aaf141dddb95e5a286cff81814d45c61df4f5a664963ba2804f94

Contents?: true

Size: 758 Bytes

Versions: 4

Compression:

Stored size: 758 Bytes

Contents

import Node from '../Node.js';

export default class IfStatement extends Node {
	initialise(transforms) {
		super.initialise(transforms);
	}

	transpile(code, transforms) {
		if (
			this.consequent.type !== 'BlockStatement' ||
			(this.consequent.type === 'BlockStatement' && this.consequent.synthetic)
		) {
			code.appendLeft(this.consequent.start, '{ ');
			code.prependRight(this.consequent.end, ' }');
		}

		if (
			this.alternate &&
			this.alternate.type !== 'IfStatement' &&
			(this.alternate.type !== 'BlockStatement' ||
				(this.alternate.type === 'BlockStatement' && this.alternate.synthetic))
		) {
			code.appendLeft(this.alternate.start, '{ ');
			code.prependRight(this.alternate.end, ' }');
		}

		super.transpile(code, transforms);
	}
}

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
jass-0.9.5 vendor/node_modules/buble/src/program/types/IfStatement.js
jass-0.9.4 vendor/node_modules/buble/src/program/types/IfStatement.js
jass-0.9.3 vendor/node_modules/buble/src/program/types/IfStatement.js
jass-0.9.1 vendor/node_modules/buble/src/program/types/IfStatement.js