Skip to content

Commit

Permalink
🐛 fix wrong location of auto-generated .prop modifier
Browse files Browse the repository at this point in the history
  • Loading branch information
mysticatea committed Feb 9, 2019
1 parent 28729dd commit 7a1bffd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/template/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ function parseDirectiveKeyStatically(
directiveKey.name.rawName === "." &&
!directiveKey.modifiers.some(isPropModifier)
) {
const pos = (directiveKey.argument || directiveKey.name).range[1]
const pos =
(directiveKey.argument || directiveKey.name).range[1] - offset
const propModifier = createIdentifier(pos, pos, "prop")
directiveKey.modifiers.unshift(propModifier)
}
Expand Down
8 changes: 4 additions & 4 deletions test/fixtures/ast/v-bind-prop-shorthand/ast.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,16 +189,16 @@
{
"type": "VIdentifier",
"range": [
42,
42
22,
22
],
"loc": {
"start": {
"column": 31,
"column": 11,
"line": 2
},
"end": {
"column": 31,
"column": 11,
"line": 2
}
},
Expand Down

0 comments on commit 7a1bffd

Please sign in to comment.