aboutsummaryrefslogtreecommitdiffstats
path: root/lib/attribute.ml
diff options
context:
space:
mode:
authorMarcos Magueta <maguetamarcos@gmail.com>2026-03-06 15:15:12 -0300
committerMarcos Magueta <maguetamarcos@gmail.com>2026-03-06 15:15:12 -0300
commitb1eefaa8ab07d41bb0b0975ffdd62ef9aba47811 (patch)
tree673005759a41b779552886d20a570a476ba85959 /lib/attribute.ml
parent5bbbbc976d25859082014f3720b82bcd2d05a2f0 (diff)
downloadSakura-b1eefaa8ab07d41bb0b0975ffdd62ef9aba47811.tar.gz
Sakura-b1eefaa8ab07d41bb0b0975ffdd62ef9aba47811.zip
use magic to cast types to opaque attributes
Diffstat (limited to 'lib/attribute.ml')
-rw-r--r--lib/attribute.ml29
1 files changed, 11 insertions, 18 deletions
diff --git a/lib/attribute.ml b/lib/attribute.ml
index 05d33f4..27214b0 100644
--- a/lib/attribute.ml
+++ b/lib/attribute.ml
@@ -1,21 +1,14 @@
-type t = {
- hash : Conventions.Hash.t;
- name : Conventions.Name.t;
- name_hash : Conventions.Hash.t;
- value : Conventions.AbstractValue.t;
- value_hash : Conventions.Hash.t;
-}
+type referenced = { value_hash : Conventions.Hash.t }
-type materialized = {
- name: Conventions.Name.t;
- value: Conventions.AbstractValue.t
-}
+type materialized = { value: Conventions.AbstractValue.t }
-let make ~name ~value =
- let name_hash = Conventions.Hash.hash_text name in
- let value_hash = Conventions.AbstractValue.hash_text value in
- let hash = Conventions.Hash.hash_text (name_hash ^ value_hash) in
- { hash; name; name_hash; value; value_hash }
+type t =
+ | Referenced of referenced
+ | Materialized of materialized
-let make_with_hashes ~hash ~name ~name_hash ~value ~value_hash =
- { hash; name; name_hash; value; value_hash }
+let make_referenced ~value =
+ let value_hash = Conventions.AbstractValue.hash value in
+ Referenced { value_hash }
+
+let make_materialized ~value =
+ Materialized { value } \ No newline at end of file