Add function/return support (#12617)

Change-Id: I3fd20e19cd0437cd98a4d9b367724f991ab047e3