Currently, the parser needs to check if a field type is an enum or not, for every field. This is a bit inefficient, and it is quite non-ergonomic.
Instead, if we store the enum state of a field on the Field instance, we can just check that directly, which is what this commit does.
When we initialize a MessageCompiler instance, we know all of the enum types, so we can use that information to set the enum state on the fields are of those types.
Currently, the parser needs to check if a field type is an enum or not, for every field. This is a bit inefficient, and it is quite non-ergonomic.
Instead, if we store the
enum
state of a field on theField
instance, we can just check that directly, which is what this commit does.When we initialize a
MessageCompiler
instance, we know all of the enum types, so we can use that information to set theenum
state on the fields are of those types.