Do not generate return structs twice when using scope variables