TriAxis.RunSharp.CodeGen.Complete C# (CSharp) Method

Complete() private method

private Complete ( ) : void
return void
	    internal void Complete()
		{
			if (_blocks.Count > 0)
				throw new InvalidOperationException(Properties.Messages.ErrOpenBlocksRemaining);

			if (IsReachable)
			{
				if (HasReturnValue)
					throw new InvalidOperationException(string.Format(null, Properties.Messages.ErrMethodMustReturnValue, Context));
				else if (_isOwner)
					Return();
			}

			if (_hasRetVar && !_hasRetLabel)
			{
				IL.MarkLabel(_retLabel);
				if (_retVar != null)
					IL.Emit(OpCodes.Ldloc, _retVar);
				IL.Emit(OpCodes.Ret);
				_hasRetLabel = true;
			}
		}