I don't think this works. If the function has not completed its semantic analysis, the purity level remains at PUREfwdref. After all, the function may go on to modify a global.