/// <summary> /// Gets the current code for a <c>try</c> block. /// </summary> /// <param name="block">The <c>try</c> block.</param> /// <returns>An <see cref="Instruction"/> value.</returns> private Instruction GetTryPosition(TryBlock block) { var before = Insert == CodeInsertion.Before; var position = Position ?? (before ? GetFirst() : GetLast()); if (block == null || block.TryEnd == null) { return(before ? (position.Previous ?? position) : (position.Next ?? position)); } return(before ? position : (position.Previous ?? position)); }
/// <summary> /// Starts a <c>try</c> block. /// </summary> /// <returns>A <see cref="TryBlock"/> value.</returns> public TryBlock Try() { var position = Codes.Nop; Emit(position); var block = new TryBlock { State = 0, TryStart = position }; tryBlocks.Enqueue(block); return(block); }