Share dval nodes and make clone explicit.

This commit is contained in:
root committed 2026-10-02 10:59:31 +00:00
1 parent 6ba121855b
commit f883236081
37 files changed
+827 -670

No files matched your search

+1 -6
View File
@@ -22,7 +22,7 @@ int main()
DValue none;
none["stale"] = "value";
none.set_none();
need(none.type == 'N' && none.is_none() && none.get_type_name() == "none" && none.size() == 0 && !none.is_array() && !none.is_list() && !none.is_reference() && none._String == "" && none._map.empty() && none._ptr == 0, "none state");
need(none.type == 'N' && none.is_none() && none.get_type_name() == "none" && none.size() == 0 && !none.is_array() && !none.is_list() && none._String == "" && none._map.empty() && none._ptr == 0, "none state");
need(none.to_string("string fallback") == "string fallback" && none.to_s64(-42) == -42 && none.to_u64(42) == 42 && none.to_f64(4.25) == 4.25 && none.to_bool(true) && none.to_stringmap().empty(), "none fallbacks");
DValue copied;
@@ -71,11 +71,6 @@ int main()
DValue mapped = none.map([&](const DValue&, String) { iterations += 1; return(DValue("value")); });
need(iterations == 0 && filtered.size() == 0 && mapped.size() == 0, "none iteration");
DValue target;
target.set_none();
DValue reference;
reference.set_reference(&target);
need(reference.is_reference() && reference.deref().is_none() && reference.is_none(), "none reference");
none["after"] = "mutation";
need(none.type == 'M' && none.has("after") && none["after"].to_string() == "mutation", "none map mutation");