Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getNodeHandler(
visitor: NodeVisitor,
nodeType: N['type']
): NodeTraversal | NodeTraversal | undefined {
if (nodeType === 'Template' || nodeType === 'Block') {
if (visitor.Program) {
if (DEVMODE) {
deprecate(`TODO`);
}
return visitor.Program as any;
}
}
let handler = visitor[nodeType];
if (handler !== undefined) {
return (handler as unknown) as NodeTraversal;
}
return visitor.All;
}
path: BuilderHead,
params: Option,
hash: Option,
_defaultBlock: AST.PossiblyDeprecatedBlock,
_elseBlock?: Option,
loc?: AST.SourceLocation,
openStrip?: AST.StripFlags,
inverseStrip?: AST.StripFlags,
closeStrip?: AST.StripFlags
): AST.BlockStatement {
let defaultBlock: AST.Block;
let elseBlock: Option | undefined;
if (_defaultBlock.type === 'Template') {
if (DEVMODE) {
deprecate(`b.program is deprecated. Use b.blockItself instead.`);
}
defaultBlock = (assign({}, _defaultBlock, { type: 'Block' }) as unknown) as AST.Block;
} else {
defaultBlock = _defaultBlock;
}
if (_elseBlock !== undefined && _elseBlock !== null && _elseBlock.type === 'Template') {
if (DEVMODE) {
deprecate(`b.program is deprecated. Use b.blockItself instead.`);
}
elseBlock = (assign({}, _elseBlock, { type: 'Block' }) as unknown) as AST.Block;
} else {
elseBlock = _elseBlock;
}