File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed
packages/compiler-core/src Expand file tree Collapse file tree 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 {
933933 }
934934}
935935
936+ export function cloneLoc ( loc : SourceLocation ) : SourceLocation {
937+ return getLoc ( loc . start . offset , loc . end . offset )
938+ }
939+
936940function setLocEnd ( loc : SourceLocation , end : number ) {
937941 loc . end = tokenizer . getPos ( end )
938942 loc . source = getSlice ( loc . start . offset , end )
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ import {
3030import { ErrorCodes , createCompilerError } from '../errors'
3131import { processExpression } from './transformExpression'
3232import { validateBrowserExpression } from '../validateExpression'
33+ import { cloneLoc } from '../parser'
3334import { CREATE_COMMENT , FRAGMENT } from '../runtimeHelpers'
3435import { findDir , findProp , getMemoedVNodeCall , injectProp } from '../utils'
3536import { PatchFlags } from '@vue/shared'
@@ -110,7 +111,7 @@ export function processIf(
110111 const branch = createIfBranch ( node , dir )
111112 const ifNode : IfNode = {
112113 type : NodeTypes . IF ,
113- loc : node . loc ,
114+ loc : cloneLoc ( node . loc ) ,
114115 branches : [ branch ] ,
115116 }
116117 context . replaceNode ( ifNode )
You can’t perform that action at this time.
0 commit comments