mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-06 13:37:25 +00:00
Refactor FieldDef to model presense as an enum rather than 2 bools. (#6420)
* Define presence. * Migrate to IsRequired and IsOptional methods * moved stuff around * Removed optional and required bools from FieldDef * change assert to return error * Fix tests.cpp * MakeFieldPresence helper * fmt * old c++ compatibility stuff Co-authored-by: Casper Neo <cneo@google.com>
This commit is contained in:
@@ -536,7 +536,7 @@ class PhpGenerator : public BaseGenerator {
|
||||
for (auto it = struct_def.fields.vec.begin();
|
||||
it != struct_def.fields.vec.end(); ++it) {
|
||||
auto &field = **it;
|
||||
if (!field.deprecated && field.required) {
|
||||
if (!field.deprecated && field.IsRequired()) {
|
||||
code += Indent + Indent + "$builder->required($o, ";
|
||||
code += NumToString(field.value.offset);
|
||||
code += "); // " + field.name + "\n";
|
||||
@@ -645,7 +645,7 @@ class PhpGenerator : public BaseGenerator {
|
||||
for (auto it = struct_def.fields.vec.begin();
|
||||
it != struct_def.fields.vec.end(); ++it) {
|
||||
auto &field = **it;
|
||||
if (!field.deprecated && field.required) {
|
||||
if (!field.deprecated && field.IsRequired()) {
|
||||
code += Indent + Indent + "$builder->required($o, ";
|
||||
code += NumToString(field.value.offset);
|
||||
code += "); // " + field.name + "\n";
|
||||
|
||||
Reference in New Issue
Block a user