oniksan / godobuf

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

Nested oneof fields? #7

Closed owlies-huayu closed 4 years ago

owlies-huayu commented 4 years ago

Hi Oleg,

Thanks for creating the proto converter! :)

I have three proto files:

File 1: message P2PEvent { oneof event { FutureEvent future_event = 1; ImmediateEvent immediate_event = 2; } }

File 2: message FutureEvent { oneof event { ... } }

File 3: message ImmediateEvent { oneof event { ... } }

I get errors when compile the parent file (File 1), I wonder if this case is supported?

  1. Parsing: D:/Projects/Owlies_Project/BouncingDefender/BouncingDefender/GodotProject/Proto/P2PEvent.proto: parsing. UNRELEASED desc_package: 1, nesting: 0 D:/Projects/Owlies_Project/BouncingDefender/BouncingDefender/GodotProject/Proto/FutureEvent.proto: parsing. UNRELEASED desc_package: 1, nesting: 0 D:/Projects/Owlies_Project/BouncingDefender/BouncingDefender/GodotProject/Proto/ImmediateEvent.proto: parsing. UNRELEASED desc_package: 1, nesting: 0

    • Parsing completed successfully. *
  2. Semantic analysis: D:/Projects/Owlies_Project/BouncingDefender/BouncingDefender/GodotProject/Proto/P2PEvent.proto: analysis. D:/Projects/Owlies_Project/BouncingDefender/BouncingDefender/GodotProject/Proto/FutureEvent.proto: analysis. D:/Projects/Owlies_Project/BouncingDefender/BouncingDefender/GodotProject/Proto/ImmediateEvent.proto: analysis.

    • Semantic analysis completed successfully. *
  3. Output file creating: Perform full semantic analysis. Perform translation. res://addons/protobuf/parser.gd:1766 - Invalid get index '14' (on base: 'Array'). res://addons/protobuf/parser.gd:1816 - Invalid operands 'String' and 'Nil' in operator '+'. res://addons/protobuf/parser.gd:1943 - Invalid operands 'String' and 'Nil' in operator '+'. res://addons/protobuf/parser.gd:2033 - Invalid operands 'String' and 'Nil' in operator '+'.

Appreciate the help!

oniksan commented 4 years ago

I’ll check, but I don’t promise that quickly.

oniksan commented 4 years ago

This is a bug. It appears when importing a oneof from another file. I will think how to fix it... So far, you can not use imports oneof in your project, but combine everything in one file. Nested oneof are supported. Packages are not supported, I see you use them: UNRELEASED desc_package: 1, nesting: 0

oniksan commented 4 years ago

Fixed in master branch. Please check and write to me.

owlies-huayu commented 4 years ago

Thanks for the quick fix! :)