SequenceExpression
using CLanguage.Compiler;
using CLanguage.Interpreter;
using CLanguage.Types;
using System.Runtime.CompilerServices;
namespace CLanguage.Syntax
{
[System.Runtime.CompilerServices.NullableContext(1)]
[System.Runtime.CompilerServices.Nullable(0)]
public class SequenceExpression : Expression
{
public Expression First { get; set; }
public Expression Second { get; set; }
public SequenceExpression(Expression first, Expression second)
{
First = first;
Second = second;
}
public override CType GetEvaluatedCType(EmitContext ec)
{
return Second.GetEvaluatedCType(ec);
}
protected override void DoEmit(EmitContext ec)
{
First.Emit(ec);
ec.Emit(OpCode.Pop);
Second.Emit(ec);
}
public override string ToString()
{
return "(" + First?.ToString() + ", " + Second?.ToString() + ")";
}
}
}