}
}
+ //
+ // Simple version of statement list not requiring a block
+ //
+ public class StatementList : Statement
+ {
+ List<Statement> statements;
+
+ public StatementList (Statement first, Statement second)
+ {
+ statements = new List<Statement> () { first, second };
+ }
+
+ #region Properties
+ public IList<Statement> Statements {
+ get {
+ return statements;
+ }
+ }
+ #endregion
+
+ public void Add (Statement statement)
+ {
+ statements.Add (statement);
+ }
+
+ public override bool Resolve (BlockContext ec)
+ {
+ foreach (var s in statements)
+ s.Resolve (ec);
+
+ return true;
+ }
+
+ protected override void DoEmit (EmitContext ec)
+ {
+ foreach (var s in statements)
+ s.Emit (ec);
+ }
+
+ protected override void CloneTo (CloneContext clonectx, Statement target)
+ {
+ StatementList t = (StatementList) target;
+
+ t.statements = new List<Statement> (statements.Count);
+ foreach (Statement s in statements)
+ t.statements.Add (s.Clone (clonectx));
+ }
+ }
+
// A 'return' or a 'yield break'
public abstract class ExitStatement : Statement
{
statements = new List<Statement> (4);
}
- public Block CreateSwitchBlock (Location start)
- {
- // FIXME: should this be implicit?
- Block new_block = new ExplicitBlock (this, start, start);
- new_block.switch_block = this;
- return new_block;
- }
+ #region Properties
public int ID {
get { return this_id; }
}
}
+ #endregion
+
+ public Block CreateSwitchBlock (Location start)
+ {
+ // FIXME: should this be implicit?
+ Block new_block = new ExplicitBlock (this, start, start);
+ new_block.switch_block = this;
+ return new_block;
+ }
+
void AddChild (Block b)
{
if (children == null)
protected override void DoEmit (EmitContext ec)
{
for (int ix = 0; ix < statements.Count; ix++){
- Statement s = (Statement) statements [ix];
- s.Emit (ec);
+ statements [ix].Emit (ec);
}
}
ec.Emit (OpCodes.Brfalse, skip);
}
- Invocation.EmitCall (ec, false, var, TypeManager.void_dispose_void, null, loc);
+ Invocation.EmitCall (ec, var, TypeManager.void_dispose_void, null, loc);
if (emit_null_check)
ec.MarkLabel (skip);
// Option 1: Try to match by name GetEnumerator first
//
var mexpr = Expression.MemberLookup (rc.Compiler, rc.CurrentType, null, expr.Type, "GetEnumerator", -1,
- MemberKind.All, BindingRestriction.NoOverrides | BindingRestriction.AccessibleOnly, loc);
+ MemberKind.All, BindingRestriction.DefaultMemberLookup | BindingRestriction.AccessibleOnly, loc);
var mg = mexpr as MethodGroupExpr;
if (mg != null) {