This also adds some book keeping to throw if ever define identifiers after use to make sure we don't generate incorrect code.