WOW, Great.
I read the sentence that Delphi supports it at a site introducing new features of new Delphi version (edited by another user), not at formal site. I have not confirmed afterwards.
I tried this on my FPC program (few months ago), which was not successful. That's possibly because most of my units are in {$mode Delphi}. The manual says this feature works only in {$mode objfpc}.
Note your indentation suggest something that isn't there. It is actually more
You are right. "function" finishes the scope of "var" declaration, so they'd better be indented at the level