struct member reference removes information
description
The short story is, if I do this:
float x = this.m_Container.m_Vector.x
where m_Container and m_Vector are structs, MicrosoftCCI seems to be removing the reference to this.m_Container entirely. CSharpSourceEmitter emits this:
float x = m_Vector.x; <--- COMPILE ERROR .. m_Vector only exists inside this.m_Container.
Here's a program that demonstrates the problem:
namespace Test
{
struct Vector
{
public float x, y, z;
}
struct Container
{
public Vector m_Vector;
}
public class Program
{
static Container m_Container;
public static void Main( string[] args )
{
float x = m_Container.m_Vector.x;
}
}
}
If I dig through the expression tree for the float x = m_Container.m_Vector.x line:
- the right side is an IBoundExpression where Instance is of type IAddressOf
- addressOf.Expression is an IAddressableExpression that is an IFieldReference referring to m_Vector