Handle const modifier in getOccurrences

Fix for #1331. Const is not handled as a modifier, so add the handling for it.
Maybe we should add an `else` clause and bail out? Is it better to crash and hope to catch in dogfooding, or let it gracefully do nothing?