Skip to content

Commit

Permalink
fix(transformElement): properly transform transformed nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
Calvin-LL authored and yyx990803 committed Mar 29, 2021
1 parent bb8cdca commit 58601db
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions packages/compiler-core/src/transforms/transformElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,21 @@ const directiveImportMap = new WeakMap<DirectiveNode, symbol>()

// generate a JavaScript AST for this element's codegen
export const transformElement: NodeTransform = (node, context) => {
if (
!(
node.type === NodeTypes.ELEMENT &&
(node.tagType === ElementTypes.ELEMENT ||
node.tagType === ElementTypes.COMPONENT)
)
) {
return
}
// perform the work on exit, after all child expressions have been
// processed and merged.
return function postTransformElement() {
node = context.currentNode!

if (
!(
node.type === NodeTypes.ELEMENT &&
(node.tagType === ElementTypes.ELEMENT ||
node.tagType === ElementTypes.COMPONENT)
)
) {
return
}

const { tag, props } = node
const isComponent = node.tagType === ElementTypes.COMPONENT

Expand Down

0 comments on commit 58601db

Please sign in to comment.