]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
chore: use ast node creation helper (#5255)
author阿崔cxr <cui_xiaorui@126.com>
Fri, 13 May 2022 08:37:50 +0000 (16:37 +0800)
committerGitHub <noreply@github.com>
Fri, 13 May 2022 08:37:50 +0000 (04:37 -0400)
packages/compiler-core/src/transforms/transformText.ts

index 2ab6805c6a7b6e15e82d1e5fa4eafe31438b2766..2c8ab384fd8a2a1edb83ba805a8a7d64d6b8347d 100644 (file)
@@ -5,7 +5,8 @@ import {
   createCallExpression,
   CallExpression,
   ElementTypes,
-  ConstantTypes
+  ConstantTypes,
+  createCompoundExpression
 } from '../ast'
 import { isText } from '../utils'
 import { CREATE_TEXT } from '../runtimeHelpers'
@@ -36,11 +37,10 @@ export const transformText: NodeTransform = (node, context) => {
             const next = children[j]
             if (isText(next)) {
               if (!currentContainer) {
-                currentContainer = children[i] = {
-                  type: NodeTypes.COMPOUND_EXPRESSION,
-                  loc: child.loc,
-                  children: [child]
-                }
+                currentContainer = children[i] = createCompoundExpression(
+                  [child],
+                  child.loc
+                )
               }
               // merge adjacent text node into current
               currentContainer.children.push(` + `, next)