StructureExpression
using CLanguage.Compiler;
using CLanguage.Types;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
namespace CLanguage.Syntax
{
[System.Runtime.CompilerServices.NullableContext(1)]
[System.Runtime.CompilerServices.Nullable(0)]
public class StructureExpression : Expression
{
[System.Runtime.CompilerServices.Nullable(0)]
public class Item
{
public int Index;
[System.Runtime.CompilerServices.Nullable(2)]
public string Field;
public Expression Expression;
public Item([System.Runtime.CompilerServices.Nullable(2)] string field, Expression expression)
{
Field = field;
Expression = expression;
}
}
public List<Item> Items { get; set; }
public StructureExpression()
{
Items = new List<Item>();
}
public override string ToString()
{
return "{ " + string.Join(", ", from x in Items
select x.Expression.ToString()) + " }";
}
public override CType GetEvaluatedCType(EmitContext ec)
{
return CType.Void;
}
protected override void DoEmit(EmitContext ec)
{
throw new NotImplementedException(GetType().Name + ": Emit");
}
}
}