Statement
using CLanguage.Compiler;
using System.Runtime.CompilerServices;
namespace CLanguage.Syntax
{
[System.Runtime.CompilerServices.NullableContext(1)]
[System.Runtime.CompilerServices.Nullable(0)]
public abstract class Statement
{
public Location Location { get; set; }
public abstract bool AlwaysReturns { get; }
public void Emit(EmitContext ec)
{
DoEmit(ec);
}
protected abstract void DoEmit(EmitContext ec);
public Block ToBlock()
{
Block block = this as Block;
if (block != null)
return block;
block = new Block(VariableScope.Local);
block.AddStatement(this);
return block;
}
public abstract void AddDeclarationToBlock(BlockContext context);
}
}