summaryrefslogtreecommitdiff
path: root/src/cli
diff options
context:
space:
mode:
Diffstat (limited to 'src/cli')
-rw-r--r--src/cli/runtime/AFn.cs5
-rw-r--r--src/cli/runtime/Obj.cs24
-rw-r--r--src/cli/runtime/Symbol.cs6
3 files changed, 17 insertions, 18 deletions
diff --git a/src/cli/runtime/AFn.cs b/src/cli/runtime/AFn.cs
index a14b7cb9..7ba53713 100644
--- a/src/cli/runtime/AFn.cs
+++ b/src/cli/runtime/AFn.cs
@@ -104,5 +104,10 @@ static public Object throwArity()
{
throw new Exception("Wrong number of args passed");
}
+
+public override Obj withMeta(IPersistentMap meta){
+ Obj ret = (Obj) MemberwiseClone();
+ ret._meta = meta;
+ return ret; }
}
} \ No newline at end of file
diff --git a/src/cli/runtime/Obj.cs b/src/cli/runtime/Obj.cs
index d1d969c9..ebafc9c4 100644
--- a/src/cli/runtime/Obj.cs
+++ b/src/cli/runtime/Obj.cs
@@ -15,29 +15,17 @@ using System;
namespace clojure.lang
{
-public class Obj{
+public abstract class Obj{
-volatile IPersistentMap _attrs = PersistentArrayIdentityMap.EMPTY;
+internal volatile IPersistentMap _meta = null;
-public Object addAttr( Object key, Object val)
- {
- _attrs = _attrs.add(key, val);
- return val;
- }
-public Object getAttr( Object key)
- {
- return _attrs.get(key);
- }
-
-public bool hasAttr( Object key){
- return _attrs.contains(key);
- }
+public IPersistentMap meta() {
+ return _meta;
+}
+abstract public Obj withMeta(IPersistentMap meta);
-public IPersistentMap attrs() {
- return _attrs;
-}
}
diff --git a/src/cli/runtime/Symbol.cs b/src/cli/runtime/Symbol.cs
index bd79336b..58bc30fe 100644
--- a/src/cli/runtime/Symbol.cs
+++ b/src/cli/runtime/Symbol.cs
@@ -75,5 +75,11 @@ public int CompareTo(object obj)
}
#endregion
+
+override public Obj withMeta(IPersistentMap meta) {
+ this._meta = meta;
+ return this;
+}
+
}
}