mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Add a field reflection function that constructs keypaths. (#34815)
While the existing _forEachField in ReflectionMirror.swift already gives the offsets and types for each field, this isn't enough information to construct a keypath for that field in order to modify it. For reference, this should be sufficent to implement the features described here: (https://forums.swift.org/t/storedpropertyiterable/19218/62) purely at runtime without any derived conformances for many types. Note: Since there isn't enough reflection information for `.mutatingGetSet` fields, this means that we're not able to support reflecting certain types of fields (functions, nonfinal class fields, etc). Whether this is an error or not is controlled by the `.ignoreUnknown` option.
This commit is contained in:
@@ -92,6 +92,10 @@ public:
|
||||
bool isIndirectCase() const {
|
||||
return Flags.isIndirectCase();
|
||||
}
|
||||
|
||||
bool isVar() const {
|
||||
return Flags.isVar();
|
||||
}
|
||||
};
|
||||
|
||||
struct FieldRecordIterator {
|
||||
|
||||
Reference in New Issue
Block a user