Skip to content

Commit

Permalink
refactor: speed up injection resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Dec 21, 2018
1 parent bf0efb0 commit 5ab028a
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/core/instance/inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,13 @@ export function resolveInject (inject: any, vm: Component): ?Object {
// inject is :any because flow is not smart enough to figure out cached
const result = Object.create(null)
const keys = hasSymbol
? Reflect.ownKeys(inject).filter(key => {
/* istanbul ignore next */
return Object.getOwnPropertyDescriptor(inject, key).enumerable
})
? Reflect.ownKeys(inject)
: Object.keys(inject)

for (let i = 0; i < keys.length; i++) {
const key = keys[i]
// #6574 in case the inject object is observed...
if (key === '__ob__') continue
const provideKey = inject[key].from
let source = vm
while (source) {
Expand Down

0 comments on commit 5ab028a

Please sign in to comment.