@@ -37,48 +37,44 @@ export const transformSlotOutlet: NodeTransform = (node, context) => {
37
37
38
38
let name : SimpleExpressionNode | undefined
39
39
const nonNameProps : ( AttributeNode | DirectiveNode ) [ ] = [ ]
40
- const customDirectives : DirectiveNode [ ] = [ ]
41
- for ( const p of props ) {
42
- if ( p . type === NodeTypes . ATTRIBUTE ) {
43
- if ( p . value ) {
44
- if ( p . name === 'name' ) {
45
- name = createSimpleExpression ( p . value . content , true , p . loc )
40
+ const directives : DirectiveNode [ ] = [ ]
41
+ for ( const prop of props ) {
42
+ if ( prop . type === NodeTypes . ATTRIBUTE ) {
43
+ if ( prop . value ) {
44
+ if ( prop . name === 'name' ) {
45
+ name = createSimpleExpression ( prop . value . content , true , prop . loc )
46
46
} else {
47
- p . name = camelize ( p . name )
48
- nonNameProps . push ( p )
47
+ prop . name = camelize ( prop . name )
48
+ nonNameProps . push ( prop )
49
49
}
50
50
}
51
+ } else if ( prop . name === 'bind' && isStaticArgOf ( prop . arg , 'name' ) ) {
52
+ if ( prop . exp ) {
53
+ name = ( prop as VaporDirectiveNode ) . exp !
54
+ } else if ( prop . arg && prop . arg . type === NodeTypes . SIMPLE_EXPRESSION ) {
55
+ // v-bind shorthand syntax
56
+ name = createSimpleExpression (
57
+ camelize ( prop . arg . content ) ,
58
+ false ,
59
+ prop . arg . loc ,
60
+ )
61
+ name . ast = null
62
+ }
63
+ } else if ( ! isBuiltInDirective ( prop . name ) ) {
64
+ directives . push ( prop )
51
65
} else {
52
- if ( p . name === 'bind' && isStaticArgOf ( p . arg , 'name' ) ) {
53
- if ( p . exp ) {
54
- name = ( p as VaporDirectiveNode ) . exp !
55
- } else if ( p . arg && p . arg . type === NodeTypes . SIMPLE_EXPRESSION ) {
56
- // v-bind shorthand syntax
57
- name = createSimpleExpression (
58
- camelize ( p . arg . content ) ,
59
- false ,
60
- p . arg . loc ,
61
- )
62
- name . ast = null
63
- }
64
- } else {
65
- if ( ! isBuiltInDirective ( p . name ) ) {
66
- customDirectives . push ( p )
67
- } else {
68
- if ( p . name === 'bind' && p . arg && isStaticExp ( p . arg ) ) {
69
- p . arg . content = camelize ( p . arg . content )
70
- }
71
- nonNameProps . push ( p )
72
- }
66
+ if ( prop . name === 'bind' && prop . arg && isStaticExp ( prop . arg ) ) {
67
+ prop . arg . content = camelize ( prop . arg . content )
73
68
}
69
+ nonNameProps . push ( prop )
74
70
}
75
71
}
76
72
77
- if ( customDirectives . length ) {
73
+ if ( directives . length ) {
78
74
context . options . onError (
79
75
createCompilerError (
80
76
ErrorCodes . X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET ,
81
- customDirectives [ 0 ] . loc ,
77
+ directives [ 0 ] . loc ,
82
78
) ,
83
79
)
84
80
}
@@ -109,9 +105,9 @@ export const transformSlotOutlet: NodeTransform = (node, context) => {
109
105
function createFallback (
110
106
node : ElementNode ,
111
107
context : TransformContext < ElementNode > ,
112
- ) : [ BlockIRNode | undefined , ( ( ) => void ) | undefined ] {
108
+ ) : [ block ?: BlockIRNode , exit ?: ( ) => void ] {
113
109
if ( ! node . children . length ) {
114
- return [ undefined , undefined ]
110
+ return [ ]
115
111
}
116
112
117
113
context . node = node = extend ( { } , node , {
0 commit comments