Skip to content

Instantly share code, notes, and snippets.

@rayepeng
Created June 8, 2023 05:07
Show Gist options
  • Save rayepeng/a8ce84b76f61cf4b66e4144f60bc623c to your computer and use it in GitHub Desktop.
Save rayepeng/a8ce84b76f61cf4b66e4144f60bc623c to your computer and use it in GitHub Desktop.
function walkAST(ast, before, after, options){
parents.unshift(ast);
switch (ast.type) {
case 'NamedBlock':
case 'Block':
ast.nodes = walkAndMergeNodes(ast.nodes);
break;
case 'Case':
case 'Filter':
case 'Mixin':
case 'Tag':
case 'InterpolatedTag':
case 'When':
case 'Code':
case 'While':
if (ast.block) { // here!!!
ast.block = walkAST(ast.block, before, after, options);
}
break;
case 'Text':
break;
}
parents.shift();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment