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:
parent
5e3ac9a101
commit
e9e3241263
15 changed files with 2020 additions and 198 deletions
|
|
@ -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`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue