]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
chore: fix mishandled regex const check
authorEvan You <evan@vuejs.org>
Wed, 12 Feb 2025 07:49:32 +0000 (15:49 +0800)
committerEvan You <evan@vuejs.org>
Wed, 12 Feb 2025 07:49:32 +0000 (15:49 +0800)
packages/compiler-core/src/babelUtils.ts

index ccf123f7bb69ddfc1a4277841b352fd4a8b1e58b..6ede6bd0386ad0b1101c02ef46df7bcec3c356de 100644 (file)
@@ -544,7 +544,6 @@ export function isStaticNode(node: Node): boolean {
     case 'BooleanLiteral':
     case 'NullLiteral':
     case 'BigIntLiteral':
-    case 'RegExpLiteral':
       return true
   }
   return false
@@ -558,6 +557,8 @@ export function isConstantNode(node: Node, bindings: BindingMetadata): boolean {
     case 'Identifier':
       const type = bindings[node.name]
       return type === BindingTypes.LITERAL_CONST
+    case 'RegExpLiteral':
+      return true
     case 'ObjectExpression':
       return node.properties.every(prop => {
         // { bar() {} } object methods are not considered static nodes