File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed
src/Razor/Microsoft.AspNetCore.Razor.Language/src/Components Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -507,15 +507,19 @@ private static IntermediateToken GetAttributeContent(TagHelperPropertyIntermedia
507
507
return GetToken ( node ) ;
508
508
}
509
509
510
- // In error cases we won't have a single token, but we still want to generate the code.
511
510
IntermediateToken GetToken ( IntermediateNode parent )
512
511
{
513
- return
514
- parent . Children . Count == 1 ? ( IntermediateToken ) parent . Children [ 0 ] : new IntermediateToken ( )
515
- {
516
- Kind = TokenKind . CSharp ,
517
- Content = string . Join ( string . Empty , parent . Children . OfType < IntermediateToken > ( ) . Select ( t => t . Content ) ) ,
518
- } ;
512
+ if ( parent . Children . Count == 1 && parent . Children [ 0 ] is IntermediateToken token )
513
+ {
514
+ return token ;
515
+ }
516
+
517
+ // In error cases we won't have a single token, but we still want to generate the code.
518
+ return new IntermediateToken ( )
519
+ {
520
+ Kind = TokenKind . CSharp ,
521
+ Content = string . Join ( string . Empty , parent . Children . OfType < IntermediateToken > ( ) . Select ( t => t . Content ) ) ,
522
+ } ;
519
523
}
520
524
}
521
525
}
You can’t perform that action at this time.
0 commit comments