feat(stdlib): format all value types and expose handle identity members
- Add read-only FunctionRef.module/name and PluginHandle.plugin/export members; PluginHandle.id stays private (ADR-0029). - Extend stdlib/format.mq.md to Formula/Code/FunctionRef/PluginHandle/ Memory/Resource/Unit, with UTF-8 byte length for Code. - Fix two-digit ordered-list body indentation so arms 10+ stay inside their branch (they were previously top-level statements). - Extend stdlib demo to Formula/Code/FunctionRef and assert all three io.写值/打印 pairs match byte-for-byte. - Add runtime member observation test, ADR-0029, spec/status/changelog/evidence. Gate: fmt, clippy -D warnings, 416 tests passed.
This commit is contained in:
1 parent
1377af1601
commit
e119727c5d
14 files changed
+334
-15
No files matched your search
@@ -1019,6 +1019,24 @@ fn member_of(value: Value, name: &str, span: Option<Span>) -> Result<Value, Runt
|
||||
format!("Code has no field `{name}`"),
|
||||
)),
|
||||
},
|
||||
Value::FunctionRef(reference) => match name {
|
||||
"module" => Ok(Value::Text(reference.module)),
|
||||
"name" => Ok(Value::Text(reference.name)),
|
||||
_ => Err(RuntimeError::new(
|
||||
ErrorCategory::UnknownField,
|
||||
span,
|
||||
format!("FunctionRef has no field `{name}`"),
|
||||
)),
|
||||
},
|
||||
Value::PluginHandle(handle) => match name {
|
||||
"plugin" => Ok(Value::Text(handle.plugin)),
|
||||
"export" => Ok(Value::Text(handle.export)),
|
||||
_ => Err(RuntimeError::new(
|
||||
ErrorCategory::UnknownField,
|
||||
span,
|
||||
format!("PluginHandle has no field `{name}`"),
|
||||
)),
|
||||
},
|
||||
other => Err(RuntimeError::new(
|
||||
ErrorCategory::UnknownField,
|
||||
span,
|
||||
|
||||
Reference in new issue
Block a user