Skip to content

Commit

Permalink
some simplification in generate_setter()
Browse files Browse the repository at this point in the history
  • Loading branch information
dwrensha committed Jan 11, 2024
1 parent c1d40e0 commit 0c31f71
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions capnpc/src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1145,23 +1145,15 @@ fn generate_setter(
Line(fmt!(ctx,
"<{} as {capnp}::traits::SetPointerBuilder>::set_pointer_builder(self.builder.reborrow().get_pointer_field({}), value, false)",
typ.type_string(ctx, Leaf::Reader("'_"))?,
offset)));
(
Some(typ.type_string(ctx, Leaf::Reader("'_"))?),
Some(typ.type_string(ctx, Leaf::Builder("'a"))?),
)
offset)));
} else {
setter_interior.push(
Line(fmt!(ctx,"{capnp}::traits::SetPointerBuilder::set_pointer_builder(self.builder.reborrow().get_pointer_field({offset}), value, false)")));
(
Some(reg_field.get_type()?.type_string(ctx, Leaf::Reader("'_"))?),
Some(
reg_field
.get_type()?
.type_string(ctx, Leaf::Builder("'a"))?,
),
)
}
(
Some(typ.type_string(ctx, Leaf::Reader("'_"))?),
Some(typ.type_string(ctx, Leaf::Builder("'a"))?),
)
}
type_::Interface(_) => {
setter_interior.push(Line(format!(
Expand Down

0 comments on commit 0c31f71

Please sign in to comment.