File tree 2 files changed +6
-1
lines changed
packages/compiler-core/src
2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -933,6 +933,10 @@ function getLoc(start: number, end?: number): SourceLocation {
933
933
}
934
934
}
935
935
936
+ export function cloneLoc ( loc : SourceLocation ) : SourceLocation {
937
+ return getLoc ( loc . start . offset , loc . end . offset )
938
+ }
939
+
936
940
function setLocEnd ( loc : SourceLocation , end : number ) {
937
941
loc . end = tokenizer . getPos ( end )
938
942
loc . source = getSlice ( loc . start . offset , end )
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ import {
30
30
import { ErrorCodes , createCompilerError } from '../errors'
31
31
import { processExpression } from './transformExpression'
32
32
import { validateBrowserExpression } from '../validateExpression'
33
+ import { cloneLoc } from '../parser'
33
34
import { CREATE_COMMENT , FRAGMENT } from '../runtimeHelpers'
34
35
import { findDir , findProp , getMemoedVNodeCall , injectProp } from '../utils'
35
36
import { PatchFlags } from '@vue/shared'
@@ -110,7 +111,7 @@ export function processIf(
110
111
const branch = createIfBranch ( node , dir )
111
112
const ifNode : IfNode = {
112
113
type : NodeTypes . IF ,
113
- loc : node . loc ,
114
+ loc : cloneLoc ( node . loc ) ,
114
115
branches : [ branch ] ,
115
116
}
116
117
context . replaceNode ( ifNode )
You can’t perform that action at this time.
0 commit comments