Browse Source

Fix #1059: String "interpolation", invalid cast when emitting "IL with C#"

pull/1072/merge
Siegfried Pammer 8 years ago
parent
commit
0ffc747acf
  1. 4
      ICSharpCode.Decompiler/CSharp/OutputVisitor/CSharpOutputVisitor.cs
  2. 3
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InterpolatedStringExpression.cs

4
ICSharpCode.Decompiler/CSharp/OutputVisitor/CSharpOutputVisitor.cs

@ -985,11 +985,11 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor @@ -985,11 +985,11 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
{
StartNode(interpolatedStringExpression);
writer.WriteToken(Roles.Error, "$\"");
writer.WriteToken(InterpolatedStringExpression.OpenQuote, "$\"");
foreach (var element in interpolatedStringExpression.Content) {
element.AcceptVisitor(this);
}
writer.WriteToken(Roles.Error, "\"");
writer.WriteToken(InterpolatedStringExpression.CloseQuote, "\"");
isAfterSpace = false;
EndNode(interpolatedStringExpression);

3
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InterpolatedStringExpression.cs

@ -7,6 +7,9 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -7,6 +7,9 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
{
public class InterpolatedStringExpression : Expression
{
public static readonly TokenRole OpenQuote = new TokenRole("$\"");
public static readonly TokenRole CloseQuote = new TokenRole("\"");
public AstNodeCollection<InterpolatedStringContent> Content {
get { return GetChildrenByRole(InterpolatedStringContent.Role); }
}

Loading…
Cancel
Save