Skip to content

Commit 59885b2

Browse files
committed
Fix for clojure 1.5
1 parent 6a9b32f commit 59885b2

3 files changed

Lines changed: 21 additions & 8 deletions

File tree

pom.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,18 @@
6565
hence enabling usage of .cljc while supporting clojure < 1.7.0 -->
6666
<groupId>net.bendlas</groupId>
6767
<artifactId>cljc-maven-plugin</artifactId>
68-
<version>0.1.1</version>
68+
<version>0.1.2</version>
6969
<executions>
7070
<execution>
71+
<id>split-compile</id>
7172
<phase>generate-sources</phase>
7273
<goals><goal>split</goal></goals>
7374
</execution>
75+
<execution>
76+
<id>split-compile-tests</id>
77+
<phase>generate-test-sources</phase>
78+
<goals><goal>split-tests</goal></goals>
79+
</execution>
7480
</executions>
7581
</plugin>
7682
<plugin>

src/main/clojure/clojure/data/xml/node.cljc

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@
1212
(:require [clojure.data.xml.name :refer [as-qname]])
1313
#?(:clj (:import (clojure.lang IHashEq IObj ILookup IKeywordLookup Counted
1414
Associative Seqable IPersistentMap
15-
APersistentMap RecordIterator RT
16-
MapEquivalence)
15+
APersistentMap RT MapEquivalence MapEntry)
1716
(java.io Serializable Writer)
18-
(java.util Map))))
17+
(java.util Map Iterator))))
1918

2019
;; Parsed data format
2120
;; Represents a node of an XML tree
@@ -30,6 +29,16 @@
3029

3130
;; FIXME hash caching cannot be used: http://dev.clojure.org/jira/browse/CLJ-2092
3231

32+
#?
33+
(:clj
34+
(deftype ElementIterator [el ^:volatile-mutable fields]
35+
Iterator
36+
(hasNext [_] (boolean (seq fields)))
37+
(next [_]
38+
(let [f (first fields)]
39+
(set! fields (next fields))
40+
(MapEntry. f (get el f))))))
41+
3342
(deftype Element [tag attrs content meta]
3443

3544
;; serializing/cloning, hashing, equality, iteration
@@ -41,7 +50,7 @@
4150
IHashEq
4251
(hasheq [this] (APersistentMap/mapHasheq this))
4352
Iterable
44-
(iterator [this] (RecordIterator. this [:tag :attrs :content] (RT/iter nil)))]
53+
(iterator [this] (ElementIterator. this '(:tag :attrs :content)))]
4554
:cljs
4655
[ICloneable
4756
(-clone [_] (Element. tag attrs content meta))

src/test/clojure/clojure/data/xml/test_equiv.cljc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,4 @@
88
(element :foo) {:tag :foo :attrs {} :content []}
99
(element (qname "DAV:" "foo")) {:tag (qname "DAV:" "foo") :attrs {} :content []}
1010
(element :foo {:a "b"}) {:tag :foo :attrs {:a "b"} :content []}
11-
(element :foo {:a "b"} "a" "b") {:tag :foo :attrs {:a "b"} :content ["a" "b"]}
12-
#?@(:clj ;; wait for https://github.com/clojure/clojurescript/commit/9484a134bdf039c10ec3c26c8aaa3acd0dcd9875
13-
[#xml/element {:tag :foo :content ["C"]} {:tag :foo :attrs {} :content ["C"]}])))
11+
(element :foo {:a "b"} "a" "b") {:tag :foo :attrs {:a "b"} :content ["a" "b"]}))

0 commit comments

Comments
 (0)