[record] Refactor nested functions.
[record] Refactor nested functions.

In preparation for better handling of the regular record / class
codepath. This will also allow to pack record data better.

silene/coq,ejgallego/coq,gares/coq,JasonGross/coq,coq/coq,Zimmi48/coq,coq/coq,JasonGross/coq,silene/coq,JasonGross/coq,SkySkimmer/coq,ejgallego/coq,Zimmi48/coq,ejgallego/coq,JasonGross/coq,gares/coq,Zimmi48/coq,ejgallego/coq,coq/coq,SkySkimmer/coq,coq/coq,SkySkimmer/coq,Zimmi48/coq,gares/coq,gares/coq,silene/coq,SkySkimmer/coq,gares/coq