Mono.CSharp.Catch.DoEmit C# (CSharp) Method

DoEmit() protected method

protected DoEmit ( EmitContext ec ) : void
ec EmitContext
return void
		protected override void DoEmit (EmitContext ec)
		{
			if (IsGeneral)
				ec.BeginCatchBlock (TypeManager.object_type);
			else
				ec.BeginCatchBlock (CatchType);

			if (li != null) {
				li.CreateBuilder (ec);

				//
				// Special case hoisted catch variable, we have to use a temporary variable
				// to pass via anonymous storey initialization with the value still on top
				// of the stack
				//
				if (li.HoistedVariant != null) {
					LocalTemporary lt = new LocalTemporary (li.Type);
					SymbolWriter.OpenCompilerGeneratedBlock (ec);
					lt.Store (ec);
					SymbolWriter.CloseCompilerGeneratedBlock (ec);

					// switch to assigning from the temporary variable and not from top of the stack
					assign.UpdateSource (lt);
				}
			} else {
				SymbolWriter.OpenCompilerGeneratedBlock (ec);
				ec.Emit (OpCodes.Pop);
				SymbolWriter.CloseCompilerGeneratedBlock (ec);
			}

			Block.Emit (ec);
		}