Skip to content

Commit 0a3130b

Browse files
committed
Support non-nested twig function calls
1 parent 42e6c55 commit 0a3130b

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/index.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -912,9 +912,14 @@ function transformTwig(ast: any, { env, changes }: TransformerContext) {
912912
},
913913

914914
CallExpression(node, _path, meta) {
915-
if (node.callee.type !== 'MemberExpression') return
916-
if (!node.callee.property) return
917-
if (!functions.has(node.callee.property.name)) return
915+
if (node.callee.type === 'MemberExpression') {
916+
if (!node.callee.property) return
917+
if (!functions.has(node.callee.property.name)) return
918+
} else if (node.callee.type === 'Identifier') {
919+
if (!functions.has(node.callee.name)) return
920+
} else {
921+
return
922+
}
918923

919924
meta.sortTextNodes = true
920925
},

0 commit comments

Comments
 (0)