1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//! Edition feature resolution for code generation.
//!
//! The shared core (file/message/enum/oneof feature resolution) lives in
//! `buffa-descriptor`'s [`features`](buffa_descriptor::features) module so the
//! runtime [`DescriptorPool`](buffa_descriptor::DescriptorPool) and codegen
//! resolve editions identically — a divergence between them would mean
//! generated code and reflective code disagree on packed encoding, presence,
//! or enum openness.
//!
//! This module re-exports that core and adds the codegen-only
//! [`resolve_field`], which overlays the referenced enum's own `enum_type`.
//! That overlay needs [`CodeGenContext::is_enum_closed`], which is built
//! during codegen and not available to the runtime pool.
pub use *;
use crateCodeGenContext;
use crateType;
use crateFieldDescriptorProto;
/// Compute a field's resolved features, including enum closedness lookup.
///
/// This is `resolve_child(parent, field_features(field))` plus a critical
/// fixup: for enum-typed fields, `enum_type` is overlaid with the
/// REFERENCED ENUM's own resolved `enum_type` (looked up from
/// `ctx.is_enum_closed`). protoc does not propagate enum-level `enum_type`
/// into field options, so without this lookup a per-enum
/// `option features.enum_type = CLOSED` would be ignored.
///
/// For extern_path enums (not in `ctx`), falls back to the field's own
/// feature chain, which is correct for proto2/proto3 where `enum_type`
/// is file-level anyway.