Support "records" in Podlang (#507)

* Support both integer and string keys in anchored keys

* Podlang parser support for records

* Validate record usage in Podlang

* Lower records to middleware

* Cross-module record imports

* Tidying

* Record entry name literal

* More tidying

* More tests, make sure qualified record literals are supported

* Use snake-case for record entry names

* Review feedback
This commit is contained in:
Rob Knight 2026-05-06 06:21:22 -07:00 committed by GitHub
parent 5e3ac9a101
commit e9e3241263
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 2020 additions and 198 deletions

View file

@ -860,8 +860,12 @@ impl fmt::Display for Operation {
pub(crate) fn root_key_to_ak(root: &Value, key: &Value) -> Option<AnchoredKey> {
let root_hash = Hash::from(root.raw());
key.as_str()
.map(|s| AnchoredKey::new(root_hash, Key::from(s)))
if let Some(s) = key.as_str() {
Some(AnchoredKey::new(root_hash, Key::from(s)))
} else {
key.as_int()
.map(|i| AnchoredKey::new(root_hash, Key::from(i)))
}
}
/// Returns the value associated with `output_ref`.