Calculation of MISE for density estimation in deamer package?

The mean integrated square error of a density estimate $$\hat p$$ of a true density $$p$$ is \begin{aligned} \text{MISE}(\hat{p}) &\equiv \mathbb{E} \Big[ \int (\hat{p}(x,\mathbf{X}) - p(x))^2 dx \Big] \\[6pt] &= \int \Big( \int (\hat{p}(x,\mathbf{x}) - p(x))^2 dx \Big) f(\mathbf{x}) d\mathbf{x} \\[6pt] &= \int \int (\hat{p}(x,\mathbf{x}) - p(x))^2 f(\mathbf{x}) dx d\mathbf{x}. \\[6pt] \end{aligned}

I wanted to compute this so I looked up some source code and found the following code in the deamer package for R:

#calculation of the MISE
mise = function(density, obj){
if(class(obj)=="deamer"){
supp <- obj$$supp est <- obj$$f
} else { stop("argument 'obj' must be of class 'deamer'")}

if(class(density)=="function"){
dens <- density(supp)
} else {
stop("argument 'density' should be a function (see ?mise)")
}

mise <- ((max(supp)-min(supp))/length(supp))*sum((dens-est)^2)
return(mise)
}


This does not look correct to me. It seems they are just calculating the ISE $$\int (\hat{p}(x,\mathbf{x}) - p(x))^2 dx$$ and not the MISE since I don't see how they are computing the expectation?

So have I misinterpreted something, how can the above code produce the MISE when it doesn't perform an integration with respect to the sample?