|
29 | 29 | #include "upb/mini_table/sub.h" |
30 | 30 | #include "upb/reflection/def.h" |
31 | 31 | #include "upb/reflection/def_type.h" |
| 32 | +#include "upb/reflection/descriptor_bootstrap.h" |
32 | 33 | #include "upb/reflection/internal/def_builder.h" |
33 | 34 | #include "upb/reflection/internal/def_pool.h" |
34 | 35 | #include "upb/reflection/internal/desc_state.h" |
@@ -569,12 +570,12 @@ static void set_default_default(upb_DefBuilder* ctx, upb_FieldDef* f, |
569 | 570 | static bool _upb_FieldDef_InferLegacyFeatures( |
570 | 571 | upb_DefBuilder* ctx, upb_FieldDef* f, |
571 | 572 | const UPB_DESC(FieldDescriptorProto*) proto, |
572 | | - const UPB_DESC(FieldOptions*) options, upb_Syntax syntax, |
| 573 | + const UPB_DESC(FieldOptions*) options, google_protobuf_Edition edition, |
573 | 574 | UPB_DESC(FeatureSet*) features) { |
574 | 575 | bool ret = false; |
575 | 576 |
|
576 | 577 | if (UPB_DESC(FieldDescriptorProto_label)(proto) == kUpb_Label_Required) { |
577 | | - if (syntax == kUpb_Syntax_Proto3) { |
| 578 | + if (edition == google_protobuf_EDITION_PROTO3) { |
578 | 579 | _upb_DefBuilder_Errf(ctx, "proto3 fields cannot be required (%s)", |
579 | 580 | f->full_name); |
580 | 581 | } |
@@ -618,15 +619,15 @@ static void _upb_FieldDef_Create(upb_DefBuilder* ctx, const char* prefix, |
618 | 619 |
|
619 | 620 | UPB_DEF_SET_OPTIONS(f->opts, FieldDescriptorProto, FieldOptions, field_proto); |
620 | 621 |
|
621 | | - upb_Syntax syntax = upb_FileDef_Syntax(f->file); |
| 622 | + UPB_DESC(Edition) edition = upb_FileDef_Edition(f->file); |
622 | 623 | const UPB_DESC(FeatureSet*) unresolved_features = |
623 | 624 | UPB_DESC(FieldOptions_features)(f->opts); |
624 | 625 | bool implicit = false; |
625 | 626 |
|
626 | | - if (syntax != kUpb_Syntax_Editions) { |
| 627 | + if (_upb_DefBuilder_IsLegacyEdition(edition)) { |
627 | 628 | upb_Message_Clear(UPB_UPCAST(ctx->legacy_features), |
628 | 629 | UPB_DESC_MINITABLE(FeatureSet)); |
629 | | - if (_upb_FieldDef_InferLegacyFeatures(ctx, f, field_proto, f->opts, syntax, |
| 630 | + if (_upb_FieldDef_InferLegacyFeatures(ctx, f, field_proto, f->opts, edition, |
630 | 631 | ctx->legacy_features)) { |
631 | 632 | implicit = true; |
632 | 633 | unresolved_features = ctx->legacy_features; |
@@ -1009,7 +1010,7 @@ static void resolve_default(upb_DefBuilder* ctx, upb_FieldDef* f, |
1009 | 1010 | f->full_name); |
1010 | 1011 | } |
1011 | 1012 |
|
1012 | | - if (upb_FileDef_Syntax(f->file) == kUpb_Syntax_Proto3) { |
| 1013 | + if (upb_FileDef_Edition(f->file) == google_protobuf_EDITION_PROTO3) { |
1013 | 1014 | _upb_DefBuilder_Errf(ctx, |
1014 | 1015 | "proto3 fields cannot have explicit defaults (%s)", |
1015 | 1016 | f->full_name); |
|
0 commit comments