]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
refactor: skip destructuring when use with (#425)
authorChester <291164091@qq.com>
Tue, 5 Nov 2019 15:45:04 +0000 (23:45 +0800)
committerEvan You <yyx990803@gmail.com>
Tue, 5 Nov 2019 15:45:04 +0000 (10:45 -0500)
packages/runtime-core/src/componentProxy.ts

index 312577b5e8eb0031b042f0cb3d563ca5c2a87741..ce3e36c9355f6f9a816f6ffb81fa95afd35c09e9 100644 (file)
@@ -65,6 +65,10 @@ const enum AccessTypes {
 
 export const PublicInstanceProxyHandlers: ProxyHandler<any> = {
   get(target: ComponentInternalInstance, key: string) {
+    // fast path for unscopables when using `with` block
+    if (__RUNTIME_COMPILE__ && (key as any) === Symbol.unscopables) {
+      return
+    }
     const {
       renderContext,
       data,
@@ -74,10 +78,6 @@ export const PublicInstanceProxyHandlers: ProxyHandler<any> = {
       type,
       sink
     } = target
-    // fast path for unscopables when using `with` block
-    if (__RUNTIME_COMPILE__ && (key as any) === Symbol.unscopables) {
-      return
-    }
     // This getter gets called for every property access on the render context
     // during render and is a major hotspot. The most expensive part of this
     // is the multiple hasOwn() calls. It's much faster to do a simple property