Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: update
  • Loading branch information
zhiyuanzmj committed May 28, 2025
commit adb0f93d614d3a9e6ce76b11205be79389e05b65
6 changes: 3 additions & 3 deletions packages/compiler-vapor/src/generators/expression.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ export function genExpression(
return genIdentifier(content, context, loc, assignment)
}

const shouldWrap = ast && TS_NODE_TYPES.includes(ast.type)
const ids: Identifier[] = []
const parentStackMap = new Map<Identifier, Node[]>()
const parentStack: Node[] = []
Expand All @@ -66,6 +65,8 @@ export function genExpression(
let hasMemberExpression = false
if (ids.length) {
const [frag, push] = buildCodeFragment()
const shouldWrap = ast && TS_NODE_TYPES.includes(ast.type)
if (shouldWrap) push('(')
ids
.sort((a, b) => a.start! - b.start!)
.forEach((id, i) => {
Expand All @@ -87,7 +88,6 @@ export function genExpression(
parent.type === 'OptionalMemberExpression')

push(
shouldWrap ? '(' : '',
...genIdentifier(
source,
context,
Expand All @@ -106,8 +106,8 @@ export function genExpression(
if (i === ids.length - 1 && end < content.length) {
push([content.slice(end), NewlineType.Unknown])
}
push(shouldWrap ? ')' : '')
})
if (shouldWrap) push(')')

if (assignment && hasMemberExpression) {
push(` = ${assignment}`)
Expand Down