This repository was archived by the owner on Jun 9, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +4
-10
lines changed
src/betterproto2_compiler/plugin Expand file tree Collapse file tree 2 files changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -269,15 +269,6 @@ class MessageCompiler(ProtoContentBase):
269
269
oneofs : list ["OneofCompiler" ] = field (default_factory = list )
270
270
builtins_types : set [str ] = field (default_factory = set )
271
271
272
- def __post_init__ (self ) -> None :
273
- # Add message to output file
274
- if isinstance (self .parent , OutputTemplate ):
275
- if isinstance (self , EnumDefinitionCompiler ):
276
- self .output_file .enums [self .proto_name ] = self
277
- else :
278
- self .output_file .messages [self .proto_name ] = self
279
- super ().__post_init__ ()
280
-
281
272
@property
282
273
def proto_name (self ) -> str :
283
274
return self .proto_obj .name
Original file line number Diff line number Diff line change @@ -192,6 +192,8 @@ def read_protobuf_type(
192
192
path = path ,
193
193
typing_compiler = output_package .typing_compiler ,
194
194
)
195
+ output_package .messages [message_data .proto_name ] = message_data
196
+
195
197
for index , field in enumerate (item .field ):
196
198
if is_map (field , item ):
197
199
MapEntryCompiler (
@@ -235,13 +237,14 @@ def read_protobuf_type(
235
237
236
238
elif isinstance (item , EnumDescriptorProto ):
237
239
# Enum
238
- EnumDefinitionCompiler (
240
+ enum = EnumDefinitionCompiler (
239
241
source_file = source_file ,
240
242
parent = output_package ,
241
243
proto_obj = item ,
242
244
path = path ,
243
245
typing_compiler = output_package .typing_compiler ,
244
246
)
247
+ output_package .enums [enum .proto_name ] = enum
245
248
246
249
247
250
def read_protobuf_service (
You can’t perform that action at this time.
0 commit comments