Explorar el Código

perf: optimize position cloning

Evan You hace 2 años
padre
commit
20732366b9
Se han modificado 1 ficheros con 6 adiciones y 2 borrados
  1. 6 2
      packages/compiler-core/src/utils.ts

+ 6 - 2
packages/compiler-core/src/utils.ts

@@ -36,7 +36,7 @@ import {
   GUARD_REACTIVE_PROPS,
   WITH_MEMO
 } from './runtimeHelpers'
-import { isString, isObject, extend, NOOP } from '@vue/shared'
+import { isString, isObject, NOOP } from '@vue/shared'
 import { PropsExpression } from './transforms/transformElement'
 import { parseExpression } from '@babel/parser'
 import { Expression } from '@babel/types'
@@ -181,7 +181,11 @@ export function advancePositionWithClone(
   numberOfCharacters: number = source.length
 ): Position {
   return advancePositionWithMutation(
-    extend({}, pos),
+    {
+      offset: pos.offset,
+      line: pos.line,
+      column: pos.column
+    },
     source,
     numberOfCharacters
   )