C#: Extract the ValueText instead of Text for interpolated string literals as this contains the value after eg. indentation processing.

This commit is contained in:
Michael Nebel
2023-01-18 13:27:47 +01:00
parent ad20e81d05
commit 3b93cd45ea

View File

@@ -27,7 +27,7 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
case SyntaxKind.InterpolatedStringText:
// Create a string literal
var interpolatedText = (InterpolatedStringTextSyntax)c;
new Expression(new ExpressionInfo(Context, Type, Context.CreateLocation(c.GetLocation()), ExprKind.STRING_LITERAL, this, child++, false, interpolatedText.TextToken.Text));
new Expression(new ExpressionInfo(Context, Type, Context.CreateLocation(c.GetLocation()), ExprKind.STRING_LITERAL, this, child++, false, interpolatedText.TextToken.ValueText));
break;
default:
throw new InternalError(c, $"Unhandled interpolation kind {c.Kind()}");