summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStuart Halloway <stu@thinkrelevance.com>2010-06-23 15:56:13 -0400
committerStuart Halloway <stu@thinkrelevance.com>2010-06-30 21:38:39 -0400
commit4bec81db4ee4e9e4227a66bb1a04ba06e95ea9b6 (patch)
tree83a1a1b0e464b869d3be6c039e65734d28b11355
parenta9d9ddb6ad4f86809d44f8e3370ae284f0a084f2 (diff)
temporary workaround for #388
- note need for full package name (in some places, didn't track down) - note need for redundant hinting (interface hinting flows sometimes?) Signed-off-by: Stuart Halloway <stu@thinkrelevance.com>
-rw-r--r--src/clj/clojure/gvec.clj31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/clj/clojure/gvec.clj b/src/clj/clojure/gvec.clj
index feff544a..d56e45f7 100644
--- a/src/clj/clojure/gvec.clj
+++ b/src/clj/clojure/gvec.clj
@@ -19,7 +19,7 @@
(definterface IVecImpl
(^int tailoff [])
(arrayFor [^int i])
- (pushTail [^int level parent tailnode])
+ (pushTail [^int level ^clojure.core.VecNode parent ^clojure.core.VecNode tailnode])
(popTail [^int level node])
(newPath [edit ^int level node])
(doAssoc [^int level node ^int i val]))
@@ -119,7 +119,7 @@
(defmethod print-method ::VecSeq [v w]
((get (methods print-method) clojure.lang.ISeq) v w))
-(deftype Vec [^clojure.core.ArrayManager am ^int cnt ^int shift root tail _meta]
+(deftype Vec [^clojure.core.ArrayManager am ^int cnt ^int shift ^clojure.core.VecNode root tail _meta]
Object
(equals [this o]
(cond
@@ -212,7 +212,7 @@
(new Vec am (dec cnt) shift root new-tail (meta this)))
:else
(let [new-tail (.arrayFor this (- cnt 2))
- new-root (.popTail this shift root)]
+ new-root ^clojure.core.VecNode (.popTail this shift root)]
(cond
(nil? new-root)
(new Vec am (dec cnt) shift EMPTY-NODE new-tail (meta this))
@@ -300,6 +300,7 @@
(pushTail [this level parent tailnode]
(let [subidx (bit-and (bit-shift-right (dec cnt) level) (int 0x1f))
+ parent ^clojure.core.VecNode parent
ret (VecNode. (.edit parent) (aclone ^objects (.arr parent)))
node-to-insert (if (= level (int 5))
tailnode
@@ -311,7 +312,8 @@
ret))
(popTail [this level node]
- (let [subidx (bit-and (bit-shift-right (- cnt 2) level) (int 0x1f))]
+ (let [node ^clojure.core.VecNode node
+ subidx (bit-and (bit-shift-right (- cnt (int 2)) level) (int 0x1f))]
(cond
(> level 5)
(let [new-child (.popTail this (- level 5) (aget ^objects (.arr node) subidx))]
@@ -332,16 +334,17 @@
(aset ^objects (.arr ret) 0 (.newPath this edit (- level (int 5)) node))
ret)))
- (doAssoc [this level node i val]
- (if (zero? level)
- ;on this branch, array will need val type
- (let [arr (.aclone am (.arr node))]
- (.aset am arr (bit-and i (int 0x1f)) val)
- (VecNode. (.edit node) arr))
- (let [arr (aclone ^objects (.arr node))
- subidx (bit-and (bit-shift-right i level) (int 0x1f))]
- (aset arr subidx (.doAssoc this (- level (int 5)) (aget arr subidx) i val))
- (VecNode. (.edit node) arr))))
+ (doAssoc [this level node i val]
+ (let [node ^clojure.core.VecNode node]
+ (if (zero? level)
+ ;on this branch, array will need val type
+ (let [arr (.aclone am (.arr node))]
+ (.aset am arr (bit-and i (int 0x1f)) val)
+ (VecNode. (.edit node) arr))
+ (let [arr (aclone ^objects (.arr node))
+ subidx (bit-and (bit-shift-right i level) (int 0x1f))]
+ (aset arr subidx (.doAssoc this (- level (int 5)) (aget arr subidx) i val))
+ (VecNode. (.edit node) arr)))))
java.lang.Comparable
(compareTo [this o]