private static void WriteLiteralExpression(BoundLiteralExpression node, IndentedTextWriter writer) { var value = node.Value.ToString(); if (node.Type == TypeSymbol.Bool) { writer.WriteKeyword((bool)node.Value ? SyntaxKind.TrueKeyword : SyntaxKind.FalseKeyword); } else if (node.Type == TypeSymbol.Int) { writer.WriteNumber(value); } else if (node.Type == TypeSymbol.String) { value = "\"" + value?.Replace("\"", "\"\"") + "\""; writer.WriteString(value); } else { throw new Exception($"Unexpected type { node.Type }"); } }
protected virtual BoundExpression RewriteLiteralExpression(BoundLiteralExpression node) { return(node); }