From: 三咲智子 Kevin Deng Date: Sat, 9 Dec 2023 15:29:10 +0000 (+0800) Subject: fix(compiler-vapor): generate static expression X-Git-Tag: v3.6.0-alpha.1~16^2~724 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=45e86e36d7fdba1f47bc31f11b181c0f2f5b4e6e;p=thirdparty%2Fvuejs%2Fcore.git fix(compiler-vapor): generate static expression --- diff --git a/packages/compiler-vapor/src/generate.ts b/packages/compiler-vapor/src/generate.ts index b7ac40de7f..0a71f074db 100644 --- a/packages/compiler-vapor/src/generate.ts +++ b/packages/compiler-vapor/src/generate.ts @@ -525,11 +525,11 @@ function genExpression(node: IRExpression, context: CodegenContext): void { if (isString(node)) return push(node) const { content: rawExpr, ast, isStatic, loc } = node - if (__BROWSER__) { - return push(rawExpr) + if (isStatic) { + return push(JSON.stringify(rawExpr), NewlineType.None, loc) } - if ( + __BROWSER__ || !context.prefixIdentifiers || !node.content.trim() || // there was a parsing error @@ -539,9 +539,6 @@ function genExpression(node: IRExpression, context: CodegenContext): void { ) { return push(rawExpr, NewlineType.None, loc) } - if (isStatic) { - return push(JSON.stringify(rawExpr), NewlineType.None, loc) - } if (ast === null) { // the expression is a simple identifier