diff options
author | ezhi <ezhi@yandex-team.ru> | 2022-02-10 16:47:33 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:33 +0300 |
commit | bca37983f653bba53f02a2bd0dc36c8ae58278ed (patch) | |
tree | 73a56e2e5b0e4cef80dbb81d3b6e8de8a827b2db | |
parent | 60bd8300616a26e2fb89a16b1e523c74b7666db1 (diff) | |
download | ydb-bca37983f653bba53f02a2bd0dc36c8ae58278ed.tar.gz |
Restoring authorship annotation for <ezhi@yandex-team.ru>. Commit 1 of 2.
-rw-r--r-- | contrib/libs/protoc/src/google/protobuf/compiler/perlxs/perlxs_generator.cc | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/perlxs/perlxs_generator.cc b/contrib/libs/protoc/src/google/protobuf/compiler/perlxs/perlxs_generator.cc index 3ae4a39fd5..d872466b17 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/perlxs/perlxs_generator.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/perlxs/perlxs_generator.cc @@ -16,21 +16,21 @@ namespace protobuf { namespace compiler { namespace perlxs { -inline bool HasFieldPresence(const FileDescriptor* file) { - return file->syntax() != FileDescriptor::SYNTAX_PROTO3; -} - -bool HasHasMethod(const FieldDescriptor* field) { - if (HasFieldPresence(field->file())) { - // In proto1/proto2, every field has a has_$name$() method. - return true; - } - // For message types without true field presence, only fields with a message - // type have a has_$name$() method. - return field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE; -} - - +inline bool HasFieldPresence(const FileDescriptor* file) { + return file->syntax() != FileDescriptor::SYNTAX_PROTO3; +} + +bool HasHasMethod(const FieldDescriptor* field) { + if (HasFieldPresence(field->file())) { + // In proto1/proto2, every field has a has_$name$() method. + return true; + } + // For message types without true field presence, only fields with a message + // type have a has_$name$() method. + return field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE; +} + + PerlXSGenerator::PerlXSGenerator() {} PerlXSGenerator::~PerlXSGenerator() {} @@ -766,7 +766,7 @@ PerlXSGenerator::GenerateMessageXSFieldAccessors(const FieldDescriptor* field, "\n" " OUTPUT:\n" " RETVAL\n"); - } else if ( HasHasMethod(field) ) { + } else if ( HasHasMethod(field) ) { printer.Print(vars, "I32\n" "has_$perlname$(svTHIS)\n" @@ -1729,14 +1729,14 @@ PerlXSGenerator::StartFieldToHashref(const FieldDescriptor * field, "$i$ < msg$pdepth$->$cppname$_size(); $i$++ ) {\n"); } else { vars["i"] = ""; - if ( HasHasMethod(field) ) { - printer.Print(vars, - "if ( msg$pdepth$->has_$cppname$() ) {\n"); - } - else { - printer.Print(vars, - "{\n"); - } + if ( HasHasMethod(field) ) { + printer.Print(vars, + "if ( msg$pdepth$->has_$cppname$() ) {\n"); + } + else { + printer.Print(vars, + "{\n"); + } } printer.Indent(); } |