Sha256: bf9b1c09cfe7c6e6fe6d69d924a7729fb73637e4920fa89e89b44f32f4a71283

Contents?: true

Size: 717 Bytes

Versions: 4

Compression:

Stored size: 717 Bytes

Contents

import Node from '../Node.js';
import CompileError from '../../utils/CompileError.js';
import removeTrailingComma from '../../utils/removeTrailingComma.js';

export default class FunctionDeclaration extends Node {
	initialise(transforms) {
		if (this.generator && transforms.generator) {
			throw new CompileError('Generators are not supported', this);
		}

		this.body.createScope();

		if (this.id) {
			this.findScope(true).addDeclaration(this.id, 'function');
		}
		super.initialise(transforms);
	}

	transpile(code, transforms) {
		super.transpile(code, transforms);
		if (transforms.trailingFunctionCommas && this.params.length) {
			removeTrailingComma(code, this.params[this.params.length - 1].end);
		}
	}
}

Version data entries

4 entries across 4 versions & 1 rubygems

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