Codegen: use name, result_var kwargs for Result class

name defaults to None and result_var defaults to name.