semantic: Rewrite nested functions into delegates.