File tree Expand file tree Collapse file tree 1 file changed +1
-10
lines changed
packages/language-core/lib/template/transforms Expand file tree Collapse file tree 1 file changed +1
-10
lines changed Original file line number Diff line number Diff line change 11import {
22 createCompilerError ,
3- createSimpleExpression ,
43 type DirectiveNode ,
54 type ElementNode ,
6- ElementTypes ,
75 ErrorCodes ,
86 type IfBranchNode ,
97 type IfNode ,
@@ -20,11 +18,9 @@ export const transformIf = createStructuralDirectiveTransform(
2018 dir . name !== 'else'
2119 && ( ! dir . exp || ! ( dir . exp as SimpleExpressionNode ) . content . trim ( ) )
2220 ) {
23- const loc = dir . exp ? dir . exp . loc : node . loc ;
2421 context . onError (
2522 createCompilerError ( ErrorCodes . X_V_IF_NO_EXPRESSION , dir . loc ) ,
2623 ) ;
27- dir . exp = createSimpleExpression ( '' , false , loc ) ;
2824 }
2925
3026 if ( dir . name === 'if' ) {
@@ -54,10 +50,7 @@ export const transformIf = createStructuralDirectiveTransform(
5450 }
5551
5652 if ( sibling ?. type === NodeTypes . IF ) {
57- if (
58- ( dir . name === 'else-if' || dir . name === 'else' )
59- && ! sibling . branches . at ( - 1 ) ! . condition
60- ) {
53+ if ( ! sibling . branches . at ( - 1 ) ! . condition ) {
6154 context . onError (
6255 createCompilerError ( ErrorCodes . X_V_ELSE_NO_ADJACENT_IF , node . loc ) ,
6356 ) ;
@@ -85,12 +78,10 @@ export const transformIf = createStructuralDirectiveTransform(
8578) ;
8679
8780function createIfBranch ( node : ElementNode , dir : DirectiveNode ) : IfBranchNode {
88- const isTemplateIf = node . tagType === ElementTypes . TEMPLATE ;
8981 return {
9082 type : NodeTypes . IF_BRANCH ,
9183 loc : node . loc ,
9284 condition : dir . name === 'else' ? undefined : dir . exp ,
9385 children : [ node ] ,
94- isTemplateIf,
9586 } ;
9687}
You can’t perform that action at this time.
0 commit comments