Get occurrences for loops with 'break'/'continue' statements

I'm not a huge fan of checking `node !== undefined` inside this function. I'd rather force the caller to do it.