+2002-07-19 Martin Baulig <martin@gnome.org>
+
+ * ILGenerator.cs (Emit (OpCode, LocalBuilder)): Throw an exception
+ when trying to emit a local that was defined in a different ILGenerator.
+
+ * LocalBuilder.cs (LocalBuilder): Added `ILGenetator' argument to
+ the constructor.
Tue Jul 16 19:32:08 CEST 2002 Paolo Molaro <lupus@ximian.com>
scopes.Push (sym_writer.OpenScope (code_len));
}
public LocalBuilder DeclareLocal (Type localType) {
- LocalBuilder res = new LocalBuilder (module, localType);
+ LocalBuilder res = new LocalBuilder (module, localType, this);
if (locals != null) {
LocalBuilder[] new_l = new LocalBuilder [locals.Length + 1];
System.Array.Copy (locals, new_l, locals.Length);
bool load_addr = false;
bool is_store = false;
make_room (6);
+
+ if (lbuilder.ilgen != this)
+ throw new Exception ("Trying to emit a local from a different ILGenerator.");
+
/* inline the code from ll_emit () to optimize il code size */
if (opcode.StackBehaviourPop == StackBehaviour.Pop1) {
cur_stack --;
//
private ModuleBuilder module;
internal uint position;
+ internal ILGenerator ilgen;
- internal LocalBuilder (ModuleBuilder m, Type t)
+ internal LocalBuilder (ModuleBuilder m, Type t, ILGenerator ilgen)
{
this.module = m;
this.type = t;
+ this.ilgen = ilgen;
}
public void SetLocalSymInfo (string lname, int startOffset, int endOffset)
{