Index: lib/enum_generator.dart |
diff --git a/lib/enum_generator.dart b/lib/enum_generator.dart |
index b09d9b7182a3ec1fc8b702ebc9b6ce33ed2e117b..1f451f1eaeccb807438609aa1dad7f784ae534e1 100644 |
--- a/lib/enum_generator.dart |
+++ b/lib/enum_generator.dart |
@@ -11,6 +11,7 @@ class EnumAlias { |
} |
class EnumGenerator implements ProtobufContainer { |
+ final ProtobufContainer _parent; |
final String classname; |
final String fqname; |
final List<EnumValueDescriptorProto> _canonicalValues = |
@@ -21,7 +22,8 @@ class EnumGenerator implements ProtobufContainer { |
EnumDescriptorProto descriptor, |
ProtobufContainer parent, |
GenerationContext context) |
- : classname = (parent == null || parent is FileGenerator) ? |
+ : _parent = parent, |
+ classname = (parent == null || parent is FileGenerator) ? |
descriptor.name : '${parent.classname}_${descriptor.name}', |
fqname = (parent == null || parent.fqname == null) ? descriptor.name : |
(parent.fqname == '.' ? |
@@ -38,6 +40,8 @@ class EnumGenerator implements ProtobufContainer { |
context.register(this); |
} |
+ String get package => _parent.package; |
+ |
void generate(IndentingWriter out) { |
out.addBlock('class ${classname} extends ProtobufEnum {', '}\n', () { |
// ----------------------------------------------------------------- |