public void TrinaryExpression(CParser.TrinaryExpression TrinaryExpression)
{
var Condition = TrinaryExpression.Condition;
var TrueExpression = TrinaryExpression.TrueExpression;
var FalseExpression = TrinaryExpression.FalseExpression;
var CommonCType = CType.CommonType(TrueExpression.GetCachedCType(this), FalseExpression.GetCachedCType(this));
var CommonType = GetRealType(ConvertCTypeToType(CommonCType));
var TrinaryTempLocal = SafeILGenerator.DeclareLocal(CommonType, "TrinaryTempLocal");
// Condition.
Traverse(TrinaryExpression.Condition);
// Check the value and store the result in the temp local.
SafeILGenerator.MacroIfElse(() =>
{
Traverse(TrinaryExpression.TrueExpression);
SafeILGenerator.ConvertTo(CommonType);
SafeILGenerator.StoreLocal(TrinaryTempLocal);
}, () =>
{
Traverse(TrinaryExpression.FalseExpression);
SafeILGenerator.ConvertTo(CommonType);
SafeILGenerator.StoreLocal(TrinaryTempLocal);
});
// Load temp local.
SafeILGenerator.LoadLocal(TrinaryTempLocal);
}