StructureExpression
using CLanguage.Compiler;
using CLanguage.Types;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
namespace CLanguage.Syntax
{
public class StructureExpression : Expression
{
public class Item
{
public int Index;
[System.Runtime.CompilerServices.Nullable]
public string Field;
public Expression Expression;
public Item([System.Runtime.CompilerServices.Nullable] 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");
}
}
}