// be data on the stack that it can use to compuatate its value. This is
// for expressions like a [f ()] ++, where you can't call `f ()' twice.
//
- void EmitAssign (EmitContext ec, Expression source, bool leave_copy, bool prepare_for_load);
+ void EmitAssign (EmitContext ec, Expression source, bool leave_copy, bool isCompound);
/*
For simple assignments, this interface is very simple, EmitAssign is called with source
builder = null;
}
+ public override bool ContainsEmitWithAwait ()
+ {
+ return false;
+ }
+
public override Expression CreateExpressionTree (ResolveContext ec)
{
Arguments args = new Arguments (1);
Emit (ec);
}
- public void EmitAssign (EmitContext ec, Expression source, bool leave_copy, bool prepare_for_load)
+ public void EmitAssign (EmitContext ec, Expression source, bool leave_copy, bool isCompound)
{
- if (prepare_for_load)
+ if (isCompound)
throw new NotImplementedException ();
source.Emit (ec);
this.loc = loc;
}
- public override Expression CreateExpressionTree (ResolveContext ec)
- {
- ec.Report.Error (832, loc, "An expression tree cannot contain an assignment operator");
- return null;
- }
-
public Expression Target {
get { return target; }
}
}
}
+ public override bool ContainsEmitWithAwait ()
+ {
+ return target.ContainsEmitWithAwait () || source.ContainsEmitWithAwait ();
+ }
+
+ public override Expression CreateExpressionTree (ResolveContext ec)
+ {
+ ec.Report.Error (832, loc, "An expression tree cannot contain an assignment operator");
+ return null;
+ }
+
protected override Expression DoResolve (ResolveContext ec)
{
bool ok = true;
#endif
protected virtual Expression ResolveConversions (ResolveContext ec)
{
- source = Convert.ImplicitConversionRequired (ec, source, target.Type, loc);
+ source = Convert.ImplicitConversionRequired (ec, source, target.Type, source.Location);
if (source == null)
return null;
base.EmitStatement (ec);
}
- public bool IsComplexInitializer {
- get { return !(source is Constant); }
- }
-
public bool IsDefaultInitializer {
get {
Constant c = source as Constant;
return c.IsDefaultInitializer (fe.Type);
}
}
+
+ public override bool IsSideEffectFree {
+ get {
+ return source.IsSideEffectFree;
+ }
+ }
}
//
// This is just a hack implemented for arrays only
public sealed class TargetExpression : Expression
{
- Expression child;
+ readonly Expression child;
+
public TargetExpression (Expression child)
{
this.child = child;
this.loc = child.Location;
}
+ public override bool ContainsEmitWithAwait ()
+ {
+ return child.ContainsEmitWithAwait ();
+ }
+
public override Expression CreateExpressionTree (ResolveContext ec)
{
throw new NotSupportedException ("ET");
{
child.Emit (ec);
}
+
+ public override Expression EmitToField (EmitContext ec)
+ {
+ return child.EmitToField (ec);
+ }
}
// Used for underlying binary operator