mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-03 04:21:13 +00:00
Rename Nullable scalars to Optional scalars (#6112)
Co-authored-by: Casper Neo <cneo@google.com>
This commit is contained in:
@@ -744,13 +744,13 @@ CheckedError Parser::ParseField(StructDef &struct_def) {
|
||||
"default values currently only supported for scalars in tables");
|
||||
}
|
||||
|
||||
// Mark the nullable scalars. Note that a side effect of ParseSingleValue is
|
||||
// Mark the optional scalars. Note that a side effect of ParseSingleValue is
|
||||
// fixing field->value.constant to null.
|
||||
if (IsScalar(type.base_type)) {
|
||||
field->nullable = (field->value.constant == "null");
|
||||
if (field->nullable && !SupportsNullableScalars()) {
|
||||
field->optional = (field->value.constant == "null");
|
||||
if (field->optional && !SupportsOptionalScalars()) {
|
||||
return Error(
|
||||
"Nullable scalars are not yet supported in at least one the of "
|
||||
"Optional scalars are not yet supported in at least one the of "
|
||||
"the specified programming languages."
|
||||
);
|
||||
}
|
||||
@@ -2257,7 +2257,7 @@ CheckedError Parser::CheckClash(std::vector<FieldDef *> &fields,
|
||||
}
|
||||
|
||||
|
||||
bool Parser::SupportsNullableScalars() const {
|
||||
bool Parser::SupportsOptionalScalars() const {
|
||||
return !(opts.lang_to_generate &
|
||||
~(IDLOptions::kRust | IDLOptions::kSwift | IDLOptions::kLobster));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user