Skip to content
This repository was archived by the owner on Jul 19, 2025. It is now read-only.

Commit 90f7543

Browse files
committed
chore: codegen for member expression
1 parent 4d86db7 commit 90f7543

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

packages/compiler-vapor/src/generators/expression.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { isGloballyAllowed } from '@vue/shared'
1+
import { isArray, isGloballyAllowed } from '@vue/shared'
22
import {
33
BindingTypes,
44
NewlineType,
@@ -95,7 +95,14 @@ export function genExpression(
9595
)
9696

9797
if (i === ids.length - 1 && end < content.length) {
98-
push([content.slice(end), NewlineType.Unknown])
98+
const rest = content.slice(end)
99+
// merge member expression into the last identifier's fragment
100+
const last = frag[frag.length - 1]
101+
if (hasMemberExpression && isArray(last) && last[3]) {
102+
last[0] += rest
103+
} else {
104+
push([rest, NewlineType.Unknown])
105+
}
99106
}
100107
})
101108

0 commit comments

Comments
 (0)