Skip to content

Commit 7a1bffd

Browse files
committed
🐛 fix wrong location of auto-generated .prop modifier
1 parent 28729dd commit 7a1bffd

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

Diff for: src/template/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,8 @@ function parseDirectiveKeyStatically(
185185
directiveKey.name.rawName === "." &&
186186
!directiveKey.modifiers.some(isPropModifier)
187187
) {
188-
const pos = (directiveKey.argument || directiveKey.name).range[1]
188+
const pos =
189+
(directiveKey.argument || directiveKey.name).range[1] - offset
189190
const propModifier = createIdentifier(pos, pos, "prop")
190191
directiveKey.modifiers.unshift(propModifier)
191192
}

Diff for: test/fixtures/ast/v-bind-prop-shorthand/ast.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -189,16 +189,16 @@
189189
{
190190
"type": "VIdentifier",
191191
"range": [
192-
42,
193-
42
192+
22,
193+
22
194194
],
195195
"loc": {
196196
"start": {
197-
"column": 31,
197+
"column": 11,
198198
"line": 2
199199
},
200200
"end": {
201-
"column": 31,
201+
"column": 11,
202202
"line": 2
203203
}
204204
},

0 commit comments

Comments
 (0)