refactor(core): use makeMap for faster string match checks (#282)

This commit is contained in:
Ayush Goyal
2019-10-15 21:41:08 +05:30
committed by Evan You
parent eb28d45933
commit 58fffcb987
6 changed files with 53 additions and 202 deletions

View File

@@ -1,7 +1,7 @@
import { ComponentInternalInstance, Data } from './component'
import { nextTick } from './scheduler'
import { instanceWatch } from './apiWatch'
import { EMPTY_OBJ, hasOwn, globalsWhitelist } from '@vue/shared'
import { EMPTY_OBJ, hasOwn, isGloballyWhitelisted } from '@vue/shared'
import { ExtractComputedReturns } from './apiOptions'
import { UnwrapRef, ReactiveEffect } from '@vue/reactivity'
import { warn } from './warning'
@@ -106,6 +106,6 @@ if (__RUNTIME_COMPILE__) {
// this trap is only called in browser-compiled render functions that use
// `with (this) {}`
PublicInstanceProxyHandlers.has = (_: any, key: string): boolean => {
return key[0] !== '_' && !globalsWhitelist.has(key)
return key[0] !== '_' && !isGloballyWhitelisted(key)
}
}