Ejemplo n.º 1
0
	// Begin the output of an exception block within the current method.
	public virtual Label BeginExceptionBlock()
			{
				ExceptionTry tryBlock = new ExceptionTry();
				tryBlock.next = exceptionStack;
				tryBlock.beginTry = offset;
				tryBlock.endTry = -1;
				tryBlock.endCatch = -1;
				tryBlock.clauses = null;
				tryBlock.endLabel = DefineLabel();
				exceptionStack = tryBlock;
				return tryBlock.endLabel;
			}
Ejemplo n.º 2
0
	// End the output of an exception block.
	public virtual void EndExceptionBlock()
			{
				// Make sure that the request is legal.
				ExceptionTry tryBlock = exceptionStack;
				if(tryBlock == null)
				{
					throw new NotSupportedException
						(_("Emit_NeedExceptionBlock"));
				}
				if(tryBlock.clauses == null)
				{
					throw new InvalidOperationException
						(_("Emit_NoExceptionClauses"));
				}

				// Terminate the last clause in the list.
				TerminateClause();

				// Mark the label for the end of the exception block.
				MarkLabel(tryBlock.endLabel);

				// Add the exception to the end of the real block list.
				exceptionStack = tryBlock.next;
				tryBlock.next = null;
				if(exceptionListEnd != null)
				{
					exceptionListEnd.next = tryBlock;
				}
				else
				{
					exceptionList = tryBlock;
				}
				exceptionListEnd = tryBlock;
			}
Ejemplo n.º 3
0
	}; // class ExceptionClause

	// Constructor.
	internal ILGenerator(ModuleBuilder module, int size)
			{
				this.module = module;
				if(size < 16)
				{
					size = 16;
				}
				code = new byte [size];
				offset = 0;
				height = 0;
				maxHeight = 0;
				labels = null;
				numLabels = 0;
				locals = null;
				exceptionStack = null;
				exceptionList = null;
				exceptionListEnd = null;
				tokenFixups = null;
				module.assembly.AddDetach(this);
			}