Internal changes

PiperOrigin-RevId: 517141880
pull/12244/head
Mike Kruskal 2 years ago committed by Copybara-Service
parent ab9f1ab58a
commit 5d669c5cfb
  1. 6
      src/google/protobuf/compiler/parser.cc
  2. 11
      src/google/protobuf/compiler/parser_unittest.cc

@ -62,6 +62,9 @@
#include "google/protobuf/port.h"
#include "google/protobuf/wire_format.h"
// Must be included last.
#include "google/protobuf/port_def.inc"
namespace google {
namespace protobuf {
namespace compiler {
@ -2303,6 +2306,7 @@ bool Parser::ParseLabel(FieldDescriptorProto::Label* label,
!LookingAt("required")) {
return false;
}
LocationRecorder location(field_location,
FieldDescriptorProto::kLabelFieldNumber);
if (TryConsume("optional")) {
@ -2485,3 +2489,5 @@ void SourceLocationTable::Clear() { location_map_.clear(); }
} // namespace compiler
} // namespace protobuf
} // namespace google
#include "google/protobuf/port_undef.inc"

@ -57,6 +57,9 @@
#include "google/protobuf/unittest_import_public.pb.h"
#include "google/protobuf/wire_format.h"
// Must be included last.
#include "google/protobuf/port_def.inc"
namespace google {
namespace protobuf {
namespace compiler {
@ -128,7 +131,7 @@ class ParserTest : public testing::Test {
SetupParser(input);
FileDescriptorProto actual, expected;
parser_->Parse(input_.get(), &actual);
EXPECT_TRUE(parser_->Parse(input_.get(), &actual));
EXPECT_EQ(io::Tokenizer::TYPE_END, input_->current().type);
ASSERT_EQ("", error_collector_.text_);
@ -167,7 +170,7 @@ class ParserTest : public testing::Test {
void ExpectHasEarlyExitErrors(const char* text, const char* expected_errors) {
SetupParser(text);
FileDescriptorProto file;
parser_->Parse(input_.get(), &file);
EXPECT_FALSE(parser_->Parse(input_.get(), &file));
EXPECT_EQ(expected_errors, error_collector_.text_);
}
@ -279,7 +282,6 @@ TEST_F(ParserTest, WarnIfFieldNameContainsNumberImmediatelyFollowUnderscore) {
"song_name_1.") != std::string::npos);
}
// ===================================================================
typedef ParserTest ParseMessageTest;
@ -3893,8 +3895,11 @@ TEST_F(SourceInfoTest, DocCommentsOneof) {
// ===================================================================
} // anonymous namespace
} // namespace compiler
} // namespace protobuf
} // namespace google
#include "google/protobuf/port_undef.inc"

Loading…
Cancel
Save