//ILGenerator ig = builder.GetILGenerator ();
- aec = new EmitContext (
+ aec = new EmitContext (ec.ResolveContext,
ec.TypeContainer, ec.DeclContainer, loc, null,
invoke_mb.ReturnType,
/* REVIEW */ (ec.InIterator ? Modifiers.METHOD_YIELDS : 0) |
DeclSpace container = owner.ResolveContext.DeclContainer;
if (owner is TypeParameter)
container = ((TypeParameter)owner).DeclSpace;
- EmitContext ec = new EmitContext (container, container,
+ EmitContext ec = new EmitContext (owner.ResolveContext, container, container,
Location, null, null, container.ModFlags, false);
//
// First process positional arguments
//
- EmitContext ec = new EmitContext (owner.ResolveContext.DeclContainer, owner.ResolveContext.DeclContainer,
+ EmitContext ec = new EmitContext (owner.ResolveContext, owner.ResolveContext.DeclContainer, owner.ResolveContext.DeclContainer,
Location, null, null, owner.ResolveContext.DeclContainer.ModFlags, false);
int i;
ec = null;
foreach (ClassPart part in Parts) {
part.TypeBuilder = TypeBuilder;
- part.ec = new EmitContext (part, Mono.CSharp.Location.Null, null, null, ModFlags);
+ part.ec = new EmitContext (this, part, Mono.CSharp.Location.Null, null, null, ModFlags);
part.ec.ContainerType = TypeBuilder;
}
} else {
// we already have the `ec', so we don't want to create a new one.
//
if (ec == null)
- ec = new EmitContext (this, Mono.CSharp.Location.Null, null, null, ModFlags);
+ ec = new EmitContext (this, this, Mono.CSharp.Location.Null, null, null, ModFlags);
ec.ContainerType = TypeBuilder;
}
public EmitContext CreateEmitContext (TypeContainer tc, ILGenerator ig)
{
- EmitContext ec = new EmitContext (
+ EmitContext ec = new EmitContext (this,
tc, ds, Location, ig, ReturnType, ModFlags, false);
Iterator iterator = tc as Iterator;
public EmitContext CreateEmitContext (TypeContainer tc, ILGenerator ig)
{
ILGenerator ig_ = ConstructorBuilder.GetILGenerator ();
- return new EmitContext (Parent, Location, ig_, null, ModFlags, true);
+ return new EmitContext (this, Parent, Location, ig_, null, ModFlags, true);
}
public bool IsExcluded()
public override EmitContext CreateEmitContext (TypeContainer tc,
ILGenerator ig)
{
- return new EmitContext (
+ return new EmitContext (method,
tc, method.ds, method.Location, ig, ReturnType,
method.ModFlags, false);
}
return false;
}
- ec = new EmitContext (Parent, Location, null, MemberType, ModFlags);
+ ec = new EmitContext (this, Parent, Location, null, MemberType, ModFlags);
return true;
}
CurrentIterator, capture_context, loc);
}
- public EmitContext (DeclSpace parent, DeclSpace ds, Location l, ILGenerator ig,
+ public EmitContext (IResolveContext rc, DeclSpace parent, DeclSpace ds, Location l, ILGenerator ig,
Type return_type, int code_flags, bool is_constructor)
{
+ this.ResolveContext = rc;
this.ig = ig;
TypeContainer = parent;
if (parent != null){
// Can only be null for the ResolveType contexts.
ContainerType = parent.TypeBuilder;
- if (parent.UnsafeContext)
- InUnsafe = true;
- else
- InUnsafe = (code_flags & Modifiers.UNSAFE) != 0;
+ InUnsafe = rc.IsInUnsafeScope;
}
loc = l;
ReturnType = null;
}
- public EmitContext (TypeContainer tc, Location l, ILGenerator ig,
+ public EmitContext (IResolveContext rc, TypeContainer tc, Location l, ILGenerator ig,
Type return_type, int code_flags, bool is_constructor)
- : this (tc, tc, l, ig, return_type, code_flags, is_constructor)
+ : this (rc, tc, tc, l, ig, return_type, code_flags, is_constructor)
{
}
- public EmitContext (TypeContainer tc, Location l, ILGenerator ig,
+ public EmitContext (IResolveContext rc, TypeContainer tc, Location l, ILGenerator ig,
Type return_type, int code_flags)
- : this (tc, tc, l, ig, return_type, code_flags, false)
+ : this (rc, tc, tc, l, ig, return_type, code_flags, false)
{
}
}
in_transit = true;
- EmitContext ec = new EmitContext (Parent, Location, null, MemberType, ModFlags);
+ EmitContext ec = new EmitContext (this, Parent, Location, null, MemberType, ModFlags);
value = initializer.ResolveAsConstant (ec, this);
in_transit = false;
//
// However, if Parent == RootContext.Tree.Types, its NamespaceEntry will be null.
//
- type_resolve_ec = new EmitContext (Parent, this, Location.Null, null, null, ModFlags, false);
+ type_resolve_ec = new EmitContext (this, Parent, this, Location.Null, null, null, ModFlags, false);
}
return type_resolve_ec;
}
if (TypeBuilder != null)
return TypeBuilder;
- ec = new EmitContext (this, this, Location, null, null, ModFlags, false);
+ ec = new EmitContext (this, this, this, Location, null, null, ModFlags, false);
if (IsGeneric) {
foreach (TypeParameter type_param in TypeParameters)
this.ValueExpr = expr;
this.prev_member = prev_member;
- ec = new EmitContext (parent_enum, parent_enum, Location, null, null, ModFlags, false);
+ ec = new EmitContext (this, parent_enum, parent_enum, Location, null, null, ModFlags, false);
ec.InEnumContext = true;
}
public override bool Define ()
{
- ec = new EmitContext (this, this, Location, null, null, ModFlags, false);
+ ec = new EmitContext (this, this, this, Location, null, null, ModFlags, false);
for (int i = 0; i < TypeParameters.Length; i++)
if (!TypeParameters [i].Resolve (this))
public bool DefineIterator ()
{
- ec = new EmitContext (this, Location, null, null, ModFlags);
+ ec = new EmitContext (this, this, Location, null, null, ModFlags);
ec.CurrentAnonymousMethod = move_next_method;
ec.InIterator = true;
public RootTypes ()
: base (null, null, MemberName.Null, null, Kind.Root)
{
- ec = new EmitContext (null, this, Location.Null, null, null, 0, false);
+ ec = new EmitContext (this, null, this, Location.Null, null, null, 0, false);
}
public override PendingImplementation GetPendingImplementations ()