Skip to content

Commit f2499cd

Browse files
committed
refactor: improve
1 parent f8a3fb0 commit f2499cd

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

packages/compiler-vapor/src/generators/slotOutlet.ts

+5-9
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import { genBlock } from './block'
55
import { genExpression } from './expression'
66
import {
77
type CodeFragment,
8-
INDENT_END,
9-
INDENT_START,
108
NEWLINE,
9+
SEGMENTS_ARRAY,
10+
SEGMENTS_OBJECT_NEWLINE,
1111
buildCodeFragment,
1212
genCall,
1313
genMulti,
@@ -24,7 +24,7 @@ export function genSlotOutlet(oper: SlotOutletIRNode, context: CodegenContext) {
2424
? genExpression(name, context)
2525
: ['() => (', ...genExpression(name, context), ')']
2626

27-
let fallbackArg: false | CodeFragment[] = false
27+
let fallbackArg: CodeFragment[] | undefined
2828
if (fallback) {
2929
fallbackArg = genBlock(fallback, context)
3030
}
@@ -56,17 +56,13 @@ export function genSlotOutlet(oper: SlotOutletIRNode, context: CodegenContext) {
5656
})
5757
.filter(Boolean)
5858
if (props.length) {
59-
return genMulti(['[', ']', ', '], ...props)
59+
return genMulti(SEGMENTS_ARRAY, ...props)
6060
}
6161
}
6262

6363
function genStaticProps(props: IRProp[]) {
6464
return genMulti(
65-
[
66-
['{', INDENT_START, NEWLINE],
67-
[INDENT_END, NEWLINE, '}'],
68-
[', ', NEWLINE],
69-
],
65+
SEGMENTS_OBJECT_NEWLINE,
7066
...props.map(prop => {
7167
return [
7268
...genPropKey(prop, context),

0 commit comments

Comments
 (0)