]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
style(compiler-core): while/expression instead of while/true (#680)
authorGabriel Loiácono <32134586+loiacon@users.noreply.github.com>
Fri, 31 Jan 2020 14:43:34 +0000 (11:43 -0300)
committerGitHub <noreply@github.com>
Fri, 31 Jan 2020 14:43:34 +0000 (09:43 -0500)
packages/compiler-core/src/transforms/vIf.ts

index 6389d8ea9a66b06d04cef0370aae2020cbd9dde5..3dcc345e4f41fa2e139dd26d768615b7421c6b88 100644 (file)
@@ -108,21 +108,17 @@ export const transformIf = createStructuralDirectiveTransform(
           // attach this branch's codegen node to the v-if root.
           let parentCondition = sibling.codegenNode
             .expressions[1] as ConditionalExpression
-          while (true) {
-            if (
-              parentCondition.alternate.type ===
-              NodeTypes.JS_CONDITIONAL_EXPRESSION
-            ) {
-              parentCondition = parentCondition.alternate
-            } else {
-              parentCondition.alternate = createCodegenNodeForBranch(
-                branch,
-                sibling.branches.length - 1,
-                context
-              )
-              break
-            }
+          while (
+            parentCondition.alternate.type ===
+            NodeTypes.JS_CONDITIONAL_EXPRESSION
+          ) {
+            parentCondition = parentCondition.alternate
           }
+          parentCondition.alternate = createCodegenNodeForBranch(
+            branch,
+            sibling.branches.length - 1,
+            context
+          )
         } else {
           context.onError(
             createCompilerError(ErrorCodes.X_V_ELSE_NO_ADJACENT_IF, node.loc)