Skip to content

Commit c088169

Browse files
authored
style(compiler-core): while/expression instead of while/true (#680)
1 parent c02e7bc commit c088169

File tree

1 file changed

+10
-14
lines changed
  • packages/compiler-core/src/transforms

1 file changed

+10
-14
lines changed

packages/compiler-core/src/transforms/vIf.ts

+10-14
Original file line numberDiff line numberDiff line change
@@ -108,21 +108,17 @@ export const transformIf = createStructuralDirectiveTransform(
108108
// attach this branch's codegen node to the v-if root.
109109
let parentCondition = sibling.codegenNode
110110
.expressions[1] as ConditionalExpression
111-
while (true) {
112-
if (
113-
parentCondition.alternate.type ===
114-
NodeTypes.JS_CONDITIONAL_EXPRESSION
115-
) {
116-
parentCondition = parentCondition.alternate
117-
} else {
118-
parentCondition.alternate = createCodegenNodeForBranch(
119-
branch,
120-
sibling.branches.length - 1,
121-
context
122-
)
123-
break
124-
}
111+
while (
112+
parentCondition.alternate.type ===
113+
NodeTypes.JS_CONDITIONAL_EXPRESSION
114+
) {
115+
parentCondition = parentCondition.alternate
125116
}
117+
parentCondition.alternate = createCodegenNodeForBranch(
118+
branch,
119+
sibling.branches.length - 1,
120+
context
121+
)
126122
} else {
127123
context.onError(
128124
createCompilerError(ErrorCodes.X_V_ELSE_NO_ADJACENT_IF, node.loc)

0 commit comments

Comments
 (0)