return uw != null && expr.Equals (uw.expr);
}
+ public override void FlowAnalysis (FlowAnalysisContext fc)
+ {
+ expr.FlowAnalysis (fc);
+ }
+
public Expression Original {
get {
return expr;
ec.MarkLabel (end_label);
}
+ public override void FlowAnalysis (FlowAnalysisContext fc)
+ {
+ expr.FlowAnalysis (fc);
+ }
+
public void AddressOf (EmitContext ec, AddressOp mode)
{
unwrap.AddressOf (ec, mode);
{
if (rc.IsRuntimeBinder) {
if (UnwrapLeft == null && !Left.Type.IsNullableType)
- Left = Wrap.Create (Left, rc.Module.PredefinedTypes.Nullable.TypeSpec.MakeGenericType (rc.Module, new[] { Left.Type }));
+ Left = LiftOperand (rc, Left);
if (UnwrapRight == null && !Right.Type.IsNullableType)
- Right = Wrap.Create (Right, rc.Module.PredefinedTypes.Nullable.TypeSpec.MakeGenericType (rc.Module, new[] { Right.Type }));
+ Right = LiftOperand (rc, Right);
} else {
if (UnwrapLeft == null && Left != null && Left.Type.IsNullableType) {
Left = Unwrap.CreateUnwrapped (Left);
return this;
}
+ Expression LiftOperand (ResolveContext rc, Expression expr)
+ {
+ TypeSpec type;
+ if (expr.IsNull) {
+ type = Left.IsNull ? Right.Type : Left.Type;
+ } else {
+ type = expr.Type;
+ }
+
+ if (!type.IsNullableType)
+ type = rc.Module.PredefinedTypes.Nullable.TypeSpec.MakeGenericType (rc.Module, new[] { type });
+
+ return Wrap.Create (expr, type);
+ }
+
public override void Emit (EmitContext ec)
{
if (IsBitwiseBoolean && UserOperator == null) {
ec.MarkLabel (end_label);
}
+ public override void FlowAnalysis (FlowAnalysisContext fc)
+ {
+ Binary.FlowAnalysis (fc);
+ }
+
public override SLE.Expression MakeExpression (BuilderContext ctx)
{
return Binary.MakeExpression (ctx, Left, Right);
ec.MarkLabel (end_label);
}
+ public override void FlowAnalysis (FlowAnalysisContext fc)
+ {
+ left.FlowAnalysis (fc);
+ var left_da = fc.BranchDefiniteAssignment ();
+ right.FlowAnalysis (fc);
+ fc.DefiniteAssignment = left_da;
+ }
+
protected override void CloneTo (CloneContext clonectx, Expression t)
{
NullCoalescingOperator target = (NullCoalescingOperator) t;