Skip to content

Commit

Permalink
fix: compile call expression twice got error
Browse files Browse the repository at this point in the history
  • Loading branch information
meixg committed Sep 26, 2021
1 parent 916550e commit 15b950f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/compilers/anode-compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ export class ANodeCompiler<T extends 'none' | 'typed'> {
const dynamicTagName = this.id.next('dynamicTagName')
yield DEF(dynamicTagName, sanExpr(aNode.directives.is.value))
const refs = BINARY(I('ctx'), '.', I('refs'))

// 这里会对 aNode 编译两次,期间一定不能有对 aNode 的修改,否则第二次会有问题
yield new If(
BINARY(refs, '[]', I(dynamicTagName)),
this.compileComponent(aNode, BINARY(refs, '[]', I(dynamicTagName)), isRootElement)
Expand Down

0 comments on commit 15b950f

Please sign in to comment.