From: Chester <291164091@qq.com> Date: Tue, 5 Nov 2019 15:45:04 +0000 (+0800) Subject: refactor: skip destructuring when use with (#425) X-Git-Tag: v3.0.0-alpha.0~238 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2d5f9b58acbe62815735a1c9c4019ed8a004803e;p=thirdparty%2Fvuejs%2Fcore.git refactor: skip destructuring when use with (#425) --- diff --git a/packages/runtime-core/src/componentProxy.ts b/packages/runtime-core/src/componentProxy.ts index 312577b5e8..ce3e36c935 100644 --- a/packages/runtime-core/src/componentProxy.ts +++ b/packages/runtime-core/src/componentProxy.ts @@ -65,6 +65,10 @@ const enum AccessTypes { export const PublicInstanceProxyHandlers: ProxyHandler = { 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 = { 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