Skip to content

Commit

Permalink
add missing _has() methods for capability fields
Browse files Browse the repository at this point in the history
  • Loading branch information
dwrensha committed Feb 27, 2023
1 parent 90f387b commit 154ea5d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions capnpc/src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1348,6 +1348,7 @@ fn generate_haser(
| type_::Data(())
| type_::List(_)
| type_::Struct(_)
| type_::Interface(_)
| type_::AnyPointer(_) => {
if is_reader {
interior.push(Line(format!(
Expand Down
4 changes: 2 additions & 2 deletions capnpc/test/test.capnp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ struct TestAllTypes {
dataField @13 : Data;
structField @14 : TestAllTypes;
enumField @15 : TestEnum;
interfaceField @16 : Void; # TODO
interfaceField @16 : EmptyInterface;

voidList @17 : List(Void);
boolList @18 : List(Bool);
Expand All @@ -147,7 +147,7 @@ struct TestAllTypes {
dataList @30 : List(Data);
structList @31 : List(TestAllTypes);
enumList @32 : List(TestEnum);
interfaceList @33 : List(Void); # TODO
interfaceList @33 : List(EmptyInterface);
}

struct TestDefaults {
Expand Down
1 change: 1 addition & 0 deletions capnpc/test/test_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ check_test_message_impl(($mod:ident::$typ:ident) => (
.get_text_field().unwrap());
}
assert!(Ok(TestEnum::Baz) == sub_reader.reborrow().get_enum_field());
assert_eq!(false, sub_reader.reborrow().has_interface_field());
assert_eq!(3, sub_reader.reborrow().get_void_list().unwrap().len());

{
Expand Down

0 comments on commit 154ea5d

Please sign in to comment.