Skip to content

Commit b6247fc

Browse files
committed
refactor: split resolve-scoped-slot into its own file
1 parent 24b4640 commit b6247fc

File tree

3 files changed

+19
-18
lines changed

3 files changed

+19
-18
lines changed

src/core/instance/render-helpers/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { checkKeyCodes } from './check-keycodes'
99
import { bindObjectProps } from './bind-object-props'
1010
import { renderStatic, markOnce } from './render-static'
1111
import { bindObjectListeners } from './bind-object-listeners'
12-
import { resolveScopedSlots } from './resolve-slots'
12+
import { resolveScopedSlots } from './resolve-scoped-slots'
1313
import { bindDynamicKeys, prependModifier } from './bind-dynamic-keys'
1414

1515
export function installRenderHelpers (target: any) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/* @flow */
2+
3+
export function resolveScopedSlots (
4+
fns: ScopedSlotsData, // see flow/vnode
5+
hasDynamicKeys?: boolean,
6+
res?: Object
7+
): { [key: string]: Function, $stable: boolean } {
8+
res = res || { $stable: !hasDynamicKeys }
9+
for (let i = 0; i < fns.length; i++) {
10+
const slot = fns[i]
11+
if (Array.isArray(slot)) {
12+
resolveScopedSlots(slot, hasDynamicKeys, res)
13+
} else if (slot) {
14+
res[slot.key] = slot.fn
15+
}
16+
}
17+
return res
18+
}

src/core/instance/render-helpers/resolve-slots.js

-17
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,3 @@ export function resolveSlots (
4848
function isWhitespace (node: VNode): boolean {
4949
return (node.isComment && !node.asyncFactory) || node.text === ' '
5050
}
51-
52-
export function resolveScopedSlots (
53-
fns: ScopedSlotsData, // see flow/vnode
54-
hasDynamicKeys?: boolean,
55-
res?: Object
56-
): { [key: string]: Function, $stable: boolean } {
57-
res = res || { $stable: !hasDynamicKeys }
58-
for (let i = 0; i < fns.length; i++) {
59-
const slot = fns[i]
60-
if (Array.isArray(slot)) {
61-
resolveScopedSlots(slot, hasDynamicKeys, res)
62-
} else if (slot) {
63-
res[slot.key] = slot.fn
64-
}
65-
}
66-
return res
67-
}

0 commit comments

Comments
 (0)