All files / src/compiler/phases/2-analyze/visitors/shared function.js

100% Statements 20/20
100% Branches 1/1
100% Functions 1/1
100% Lines 20/20

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 212x 2x 2x 2x 2x 2x 2x 2x 4030x 4030x 4030x 4030x 4030x 4030x 4030x 4030x 4030x 4030x 4030x 4030x  
/** @import { ArrowFunctionExpression, FunctionDeclaration, FunctionExpression } from 'estree' */
/** @import { Context } from '../../types' */
 
/**
 * @param {ArrowFunctionExpression | FunctionExpression | FunctionDeclaration} node
 * @param {Context} context
 */
export function visit_function(node, context) {
	// TODO retire this in favour of a more general solution based on bindings
	node.metadata = {
		hoisted: false,
		hoisted_params: [],
		scope: context.state.scope
	};
 
	context.next({
		...context.state,
		function_depth: context.state.function_depth + 1
	});
}