|
@@ -245,6 +245,10 @@ void FieldGenerator::SetOneofIndexBase(int index_base) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+bool FieldGenerator::WantsHasProperty(void) const {
|
|
|
|
+ return descriptor_->has_presence() && !descriptor_->real_containing_oneof();
|
|
|
|
+}
|
|
|
|
+
|
|
void FieldGenerator::FinishInitialization(void) {
|
|
void FieldGenerator::FinishInitialization(void) {
|
|
// If "property_type" wasn't set, make it "storage_type".
|
|
// If "property_type" wasn't set, make it "storage_type".
|
|
if ((variables_.find("property_type") == variables_.end()) &&
|
|
if ((variables_.find("property_type") == variables_.end()) &&
|
|
@@ -289,18 +293,6 @@ void SingleFieldGenerator::GeneratePropertyImplementation(
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-bool SingleFieldGenerator::WantsHasProperty(void) const {
|
|
|
|
- if (descriptor_->containing_oneof() != NULL) {
|
|
|
|
- // If in a oneof, it uses the oneofcase instead of a has bit.
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
- if (HasFieldPresence(descriptor_->file())) {
|
|
|
|
- // In proto1/proto2, every field has a has_$name$() method.
|
|
|
|
- return true;
|
|
|
|
- }
|
|
|
|
- return false;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
bool SingleFieldGenerator::RuntimeUsesHasBit(void) const {
|
|
bool SingleFieldGenerator::RuntimeUsesHasBit(void) const {
|
|
if (descriptor_->containing_oneof() != NULL) {
|
|
if (descriptor_->containing_oneof() != NULL) {
|
|
// The oneof tracks what is set instead.
|
|
// The oneof tracks what is set instead.
|
|
@@ -402,11 +394,6 @@ void RepeatedFieldGenerator::GeneratePropertyDeclaration(
|
|
printer->Print("\n");
|
|
printer->Print("\n");
|
|
}
|
|
}
|
|
|
|
|
|
-bool RepeatedFieldGenerator::WantsHasProperty(void) const {
|
|
|
|
- // Consumer check the array size/existence rather than a has bit.
|
|
|
|
- return false;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
bool RepeatedFieldGenerator::RuntimeUsesHasBit(void) const {
|
|
bool RepeatedFieldGenerator::RuntimeUsesHasBit(void) const {
|
|
return false; // The array having anything is what is used.
|
|
return false; // The array having anything is what is used.
|
|
}
|
|
}
|