From 45b034be4d80ff3d4461ee6ad5a05be626b66745 Mon Sep 17 00:00:00 2001 From: Jerome Gravel-Niquet Date: Tue, 23 Aug 2016 06:53:03 -0600 Subject: [PATCH] fix enum default value in generator, bumps version --- src/protobuf/generator.cr | 5 +---- src/protobuf/version.cr | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/protobuf/generator.cr b/src/protobuf/generator.cr index 14a7ef9..4a57c7c 100644 --- a/src/protobuf/generator.cr +++ b/src/protobuf/generator.cr @@ -257,13 +257,10 @@ module Protobuf type_name = unless field.type_name.nil? t = field.type_name.not_nil! t = t.gsub(/^\.{0,}#{package_name.not_nil!}\.*/, "") unless package_name.nil? - # STDERR.puts t - # STDERR.puts @package_map.to_s to_strip = @package_map.find do |k,v| t.match(/\.{0,}#{k}/) end t = t.gsub(/^\.{0,}#{to_strip[0]}/, "#{to_strip[1]}") if to_strip - # STDERR.puts t t.gsub(/^\.*/, "").split(".").map(&.camelcase).join("::") else ":#{field.type.to_s.sub(/^TYPE_/, "").downcase}" @@ -276,7 +273,7 @@ module Protobuf field.type_name.nil? ? field.default_value : field.type == CodeGeneratorRequest::FieldDescriptorProto::Type::TYPE_ENUM ? - "#{type_name}[#{field.default_value}]" : # enum + "#{type_name}::#{field.default_value}" : # enum raise "can't use a default value for non-native / enum types" case field.type when CodeGeneratorRequest::FieldDescriptorProto::Type::TYPE_DOUBLE diff --git a/src/protobuf/version.cr b/src/protobuf/version.cr index de9b7cf..edd9960 100644 --- a/src/protobuf/version.cr +++ b/src/protobuf/version.cr @@ -1,3 +1,3 @@ module Protobuf - VERSION = "2.0.0" + VERSION = "2.0.1" end