function hoistFunctions(program) {
	var functions = [];
	var body = [];
	for (let line of program.body) {
		if (line.type === 'ExportDefaultDeclaration') {
			if (line.declaration.type === 'FunctionDeclaration') {
				functions.push(line);
			} else {
				body.push(line);
			}

			continue;
		}

		if (line.type === 'ExportNamedDeclaration') {
			if (!!line.declaration &&
				line.declaration.type === 'FunctionDeclaration') {

				functions.push(line);
			} else {
				body.push(line);
			}

			continue;
		}

		if (line.type === 'FunctionDeclaration') {
			functions.push(line);
		} else {
			body.push(line);
		}
	}

	return makeProgram([...functions, ...body]);
}
function hoistFunctions(program) {
	var functions = [];
	var body = [];
	for (let line of program.body) {
		if (line.type === 'ExportDefaultDeclaration') {
			if (line.declaration.type === 'FunctionDeclaration') {
				functions.push(line);
			} else {
				body.push(line);
			}

			continue;
		}

		if (line.type === 'ExportNamedDeclaration') {
			if (!!line.declaration &&
				line.declaration.type === 'FunctionDeclaration') {

				functions.push(line);
			} else {
				body.push(line);
			}

			continue;
		}

		if (line.type === 'FunctionDeclaration') {
			functions.push(line);
		} else {
			body.push(line);
		}
	}

	return makeProgram([...functions, ...body]);
}
function hoistFunctions ( program ) { var functions = [ ] ; var body = [ ] ; for ( let line of program . body ) { if ( line . type === 'ExportDefaultDeclaration' ) { if ( line . declaration . type === 'FunctionDeclaration' ) { functions . push ( line ) ; } else { body . push ( line ) ; } continue ; } if ( line . type === 'ExportNamedDeclaration' ) { if ( ! ! line . declaration && line . declaration . type === 'FunctionDeclaration' ) { functions . push ( line ) ; } else { body . push ( line ) ; } continue ; } if ( line . type === 'FunctionDeclaration' ) { functions . push ( line ) ; } else { body . push ( line ) ; } } return makeProgram ( [ ... functions , ... body ] ) ; }
bring all function declarations and exports containing them to top of the program
bring all function declarations and exports containing them to top of the program