philippepascal / protobuf-actionscript3

Automatically exported from code.google.com/p/protobuf-actionscript3
13 stars 8 forks source link

import statements are not emitted for enums. #23

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. create a .proto file "enum.proto" which contains an enum
2. create a .proto"message.proto", which imports & uses the enum in enum.proto.
3. protoc message.proto

What is the expected output? What do you see instead?

one would expect the resultant message.as file to import enum.as, but it does 
not.

Please provide any additional information below.

note that to get protoc to even emit enum.proto in the first place you need to 
include a non-
enum message (a no-op message, you could say) in enum.proto.

Original issue reported on code.google.com by DocOce...@gmail.com on 26 Feb 2010 at 9:08

GoogleCodeExporter commented 9 years ago
this was fixed in our codebase by editing as3_message.cc and changing this:
--------------------------------
        if (descriptor_->field(i)->type() == FieldDescriptor::TYPE_MESSAGE) {
//        printer->Print("// "); // see 
http://code.google.com/p/protobuf-actionscript3/issues/detail?id=15
          printer->Print("import $packageandmessagetype$;\n"
                        ,"packageandmessagetype", descriptor_->field(i)->message_type()->full_name());
        }
--------------------------------
        if (false) {
            // noop
        }
        else if (descriptor_->field(i)->type() == FieldDescriptor::TYPE_MESSAGE) {
//        printer->Print("// "); // see 
http://code.google.com/p/protobuf-actionscript3/issues/detail?id=15
          printer->Print("import $packageandmessagetype$;\n"
                        ,"packageandmessagetype", descriptor_->field(i)->message_type()->full_name());
        }
        else if (descriptor_->field(i)->type() == FieldDescriptor::TYPE_ENUM) {
//        printer->Print("// "); // see 
http://code.google.com/p/protobuf-actionscript3/issues/detail?id=15
          printer->Print("import $packageandmessagetype$;\n"
                        ,"packageandmessagetype", descriptor_->field(i)->enum_type()->full_name());
        }
--------------------------------

Original comment by DocOce...@gmail.com on 26 Feb 2010 at 9:31