using System.IO;
namespace Semmle.Extraction
{
///
/// A tuple represents a string of the form "a(b,c,d)".
///
public struct Tuple : ITrapEmitter
{
private readonly string name;
private readonly object[] args;
public Tuple(string name, params object[] args)
{
this.name = name;
this.args = args;
}
///
/// Constructs a unique string for this tuple.
///
/// The trap file to write to.
public void EmitTrap(TextWriter trapFile)
{
trapFile.WriteTuple(name, args);
}
public override string ToString()
{
// Only implemented for debugging purposes
using var writer = new StringWriter();
EmitTrap(writer);
return writer.ToString();
}
}
}