So I looked at source code and it appears that when you do an IO(PWI,pin) function, this does an analogRead() of a digital pin. It appears that the arduino implementation of analogRead() does not allow this but perhaps it provides a simulation by returning numbers in the range that the ADC would, just full low or full high.
My guess is that the analogRead() was used in ESPbasic code as a place holder until something like a pulse width detector could be implemented. Could this be? Is it likely to happen? Is there any other magic that I might be missing?