Skip to content

Commit

Permalink
Merge 36e6554 into 01507a9
Browse files Browse the repository at this point in the history
  • Loading branch information
meixg committed Apr 14, 2022
2 parents 01507a9 + 36e6554 commit 7117033
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"mkdirp": "^1.0.4",
"mustache": "^4.0.1",
"san": "^3.10.0",
"san-html-cases": "^3.10.23",
"san-html-cases": "^3.10.26",
"san-ssr-target-fake-cmd": "^1.0.0",
"san-ssr-target-fake-esm": "^1.0.0",
"source-map-support": "^0.5.19",
Expand Down
8 changes: 4 additions & 4 deletions src/compilers/anode-compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class ANodeCompiler {

compile (aNode: ANode, isRootElement: boolean): Generator<Statement> {
if (TypeGuards.isATextNode(aNode)) return this.compileText(aNode)
if (TypeGuards.isAIfNode(aNode)) return this.compileIf(aNode)
if (TypeGuards.isAIfNode(aNode)) return this.compileIf(aNode, isRootElement)
if (TypeGuards.isAForNode(aNode)) return this.compileFor(aNode)
if (TypeGuards.isASlotNode(aNode)) return this.compileSlot(aNode)
if (TypeGuards.isAFragmentNode(aNode) && aNode.tagName === 'template') return this.compileTemplate(aNode)
Expand Down Expand Up @@ -112,7 +112,7 @@ export class ANodeCompiler {
yield new Else(this.compileElement(aNode, dynamicTagName, isRootElement))
}

private * compileIf (aNode: AIfNode): Generator<Statement> {
private * compileIf (aNode: AIfNode, isRootElement: boolean): Generator<Statement> {
const ifDirective = aNode.directives.if

// 动态节点 s-is 的子节点,会被编译两次。期间不能被修改。
Expand All @@ -124,11 +124,11 @@ export class ANodeCompiler {
// @ts-ignore
delete aNodeWithoutIf.directives.if

yield new If(sanExpr(ifDirective.value), this.compile(aNodeWithoutIf, false))
yield new If(sanExpr(ifDirective.value), this.compile(aNodeWithoutIf, isRootElement))

for (const elseANode of aNode.elses || []) {
const elifDirective = elseANode.directives.elif
const body = this.compile(elseANode, false)
const body = this.compile(elseANode, isRootElement)
yield elifDirective ? new ElseIf(sanExpr(elifDirective.value), body) : new Else(body)
}
}
Expand Down

0 comments on commit 7117033

Please sign in to comment.