//
// TODO:
// Flow analysis for Yield.
-// Emit calls to parent object constructor.
+// Emit calls to base object constructor.
//
// Generics note:
// Current should be defined to return T, and IEnumerator.Current returns object
"finally clause");
return false;
}
+ if (ec.InUnsafe) {
+ Report.Error (1629, loc, "Unsafe code may not appear in iterators");
+ return false;
+ }
if (ec.CurrentBranching.InCatch ()){
Report.Error (1631, loc, "Cannot yield in the body of a " +
"catch clause");
Type [] param_types, InternalParameters parameters,
int modifiers, ToplevelBlock block, Location loc)
: base (container.NamespaceEntry, container, MakeProxyName (name),
- Modifiers.PRIVATE, null, loc)
+ (modifiers & Modifiers.UNSAFE) | Modifiers.PRIVATE, null, loc)
{
this.container = container;
this.return_type = return_type;
public bool DefineIterator ()
{
+ ec = new EmitContext (this, Mono.CSharp.Location.Null, null, null, ModFlags);
+
if (!CheckType (return_type)) {
Report.Error (
1624, Location,
this.field = field;
}
+ public override Expression DoResolveLValue (EmitContext ec, Expression right_side)
+ {
+ return DoResolve (ec);
+ }
+
public override Expression DoResolve (EmitContext ec)
{
FieldExpr fexpr = new FieldExpr (field.FieldBuilder, loc);
if (iterator.is_static)
code_flags |= Modifiers.STATIC;
+ code_flags |= iterator.ModFlags & Modifiers.UNSAFE;
+
EmitContext new_ec = new EmitContext (
iterator.container, loc, ec.ig,
TypeManager.int32_type, code_flags);