Rename Nullable scalars to Optional scalars (#6112)

Co-authored-by: Casper Neo <cneo@google.com>
This commit is contained in:
Casper
2020-09-10 16:04:36 -04:00
committed by GitHub
parent f5ab24bc41
commit 338944d3d9
6 changed files with 37 additions and 37 deletions

View File

@@ -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));
}