private void SetTypeId(TypeNode type)
{
foreach (Member m in type.Members)
{
Field f = m as Field;
if (f != null && f.Name.Name == "typeId")
{
Debug.Assert(f.Initializer is Literal);
f.Initializer = new Literal(this.nextTypeId++); // LJW: construct a new literal, rather than modifying the old
return;
}
}
Debug.Assert(false);
throw new ApplicationException("Can't find typeId field");
}