don't return false and abort parsing of current statement

pull/10586/head
Josh Humphries 2 years ago
parent 072fb8f58a
commit 8f17f57855
  1. 1
      src/google/protobuf/compiler/parser.cc
  2. 2
      src/google/protobuf/compiler/parser_unittest.cc

@ -1740,7 +1740,6 @@ bool Parser::ParseReservedName(std::string* name, const char* error_message) {
DO(ConsumeString(name, error_message));
if (!io::Tokenizer::IsIdentifier(*name)) {
AddWarning(line, col, absl::StrFormat("Reserved name \"%s\" is not a valid identifier.", *name));
return false;
}
return true;
}

@ -151,7 +151,7 @@ class ParserTest : public testing::Test {
void ExpectHasWarnings(const char* text, const char* expected_warnings) {
SetupParser(text);
FileDescriptorProto file;
parser_->Parse(input_.get(), &file);
ASSERT_TRUE(parser_->Parse(input_.get(), &file));
EXPECT_EQ(io::Tokenizer::TYPE_END, input_->current().type);
ASSERT_EQ("", error_collector_.text_);
EXPECT_EQ(expected_warnings, error_collector_.warning_);

Loading…
Cancel
Save