Fix an assumption in ComponentBindLoweringPass (dotnet/aspnetcore-tooling#212)
\n\nCommit migrated from 315f804d6e
This commit is contained in:
parent
67ef6b7e3c
commit
0ab2a1e586
|
|
@ -507,15 +507,19 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
|
||||||
return GetToken(node);
|
return GetToken(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
// In error cases we won't have a single token, but we still want to generate the code.
|
|
||||||
IntermediateToken GetToken(IntermediateNode parent)
|
IntermediateToken GetToken(IntermediateNode parent)
|
||||||
{
|
{
|
||||||
return
|
if (parent.Children.Count == 1 && parent.Children[0] is IntermediateToken token)
|
||||||
parent.Children.Count == 1 ? (IntermediateToken)parent.Children[0] : new IntermediateToken()
|
{
|
||||||
{
|
return token;
|
||||||
Kind = TokenKind.CSharp,
|
}
|
||||||
Content = string.Join(string.Empty, parent.Children.OfType<IntermediateToken>().Select(t => t.Content)),
|
|
||||||
};
|
// In error cases we won't have a single token, but we still want to generate the code.
|
||||||
|
return new IntermediateToken()
|
||||||
|
{
|
||||||
|
Kind = TokenKind.CSharp,
|
||||||
|
Content = string.Join(string.Empty, parent.Children.OfType<IntermediateToken>().Select(t => t.Content)),
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue