Skip to content

IDL without Namespace generates nils. #3

@stellarpower

Description

@stellarpower

Hi,

Brand new to FlatBuffers, but looking forward to giving this a whirl as last time I tried protocol buffers IIRC they weren't the most straightforward.

I used a toy example from online and compiled it to binary format as per the readme:



enum Color:byte { Red = 0, Green, Blue = 2 } // Comment and uncomment
union Equipment { Weapon }                   //

table Vector {
  x:float;
  y:float;
  z:float;
}
root_type Vector;

Without any unions or enums, it causes rbflatc to crash

/usr/lib64/ruby/gems/3.4.0/gems/red-flatbuffers-0.0.3/lib/flatbuffers/command/rbflatc.rb:32: warning: IO::Buffer is experimental and both the Ruby and C interface may change in the future!
/usr/lib64/ruby/gems/3.4.0/gems/red-flatbuffers-0.0.3/lib/flatbuffers/generator.rb:194:in 'FlatBuffers::Generator#generate_enums': undefined method 'each' for nil (NoMethodError)

      @schema.enums.each do |enum|

I assume this is valid IDL(?), the main flatc compiler is happy with it, so, guessing might be a test case for either supporting or if not, producing a cleanish error.

I had a quick peek and @Schema.@objects (or something like that) was also nil, so would hazard a guess the binary format hasn't emitted a section that wasn't needed and thus it's been misparsed. But that is just a guess.

Thanks!

version: rbflatc 0.0.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions