ir: Add some util functions.
ir: Add Nested Storage to Variable.
semantic: Rewrite nested functions into delegates.