(
&self,
ctx: &mut BodyContext<W>,
bindings: &[Option<BindingId>],
fields: &Fields,
)
| 1121 | } |
| 1122 | |
| 1123 | fn emit_fields<W: Write>( |
| 1124 | &self, |
| 1125 | ctx: &mut BodyContext<W>, |
| 1126 | bindings: &[Option<BindingId>], |
| 1127 | fields: &Fields, |
| 1128 | ) -> std::fmt::Result { |
| 1129 | if !bindings.is_empty() { |
| 1130 | ctx.begin_block()?; |
| 1131 | let mut skipped_some = false; |
| 1132 | for (i, &binding) in bindings.iter().enumerate() { |
| 1133 | if let Some(binding) = binding { |
| 1134 | let (field_name, field_ty) = match fields { |
| 1135 | Fields::Unit => panic!(), |
| 1136 | Fields::Struct(fields) => { |
| 1137 | let field = &fields.fields[i]; |
| 1138 | let name = &self.typeenv.syms[field.name.index()]; |
| 1139 | (Cow::Borrowed(name), field.ty) |
| 1140 | } |
| 1141 | Fields::Tuple(fields) => (Cow::Owned(format!("{i}")), fields.fields[i].ty), |
| 1142 | }; |
| 1143 | write!(ctx.out, "{}{field_name}: ", &ctx.indent)?; |
| 1144 | let (is_ref, _) = self.ty(field_ty); |
| 1145 | if is_ref { |
| 1146 | ctx.set_ref(binding, true); |
| 1147 | write!(ctx.out, "ref ")?; |
| 1148 | } |
| 1149 | writeln!(ctx.out, "v{},", binding.index())?; |
| 1150 | } else { |
| 1151 | skipped_some = true; |
| 1152 | } |
| 1153 | } |
| 1154 | if skipped_some { |
| 1155 | writeln!(ctx.out, "{}..", &ctx.indent)?; |
| 1156 | } |
| 1157 | ctx.end_block_without_newline()?; |
| 1158 | } |
| 1159 | Ok(()) |
| 1160 | } |
| 1161 | |
| 1162 | fn emit_bool<W: Write>( |
| 1163 | &self, |
no test coverage detected