oniksan / godobuf

A Google Protobuf implementation for Godot / GDScript
BSD 3-Clause "New" or "Revised" License
248 stars 34 forks source link

Fix creating nested message in oneof not being marked as set #16

Closed wooky closed 3 years ago

wooky commented 3 years ago

Given a protobuf 3 file:

message Test {
  oneof foo {
    uint32 field1 = 1;
    uint32 field2 = 2;
  }
}

and Godot code:

test.set_field1(1234)
print(test.has_field1())

Currently it prints False, which is wrong since the field has been set. This PR fixes this issue.

oniksan commented 3 years ago

You have not corrected in all places where necessary. And did not make changes to the "clear" function, which resets PB_SERVICE_STATE.FILLED to PB_SERVICE_STATE.UNFILLED. I fixed that too.