Skip to content

Commit

Permalink
Fixed problem with queries without paths (cl-source or cl-target are …
Browse files Browse the repository at this point in the history
…interface or abstract class).
  • Loading branch information
vdim committed Jan 12, 2013
1 parent 88ee5cb commit d82a06b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
5 changes: 4 additions & 1 deletion src/ru/petrsu/nest/yz/core.clj
Expand Up @@ -107,7 +107,10 @@
m-go (memoize (fn [ids o]
(cond (vector? ids)
(reduce (fn [r {:keys [id cl]}]
(let [objs- (mapcat (partial reduce get-objs r) id)]
(let [id (if (nil? id)
(u/get-paths cl (-> r first class) @a-mom)
id)
objs- (mapcat (partial reduce get-objs r) id)]
(if (nil? cl)
objs-
(filter (partial instance? cl) objs-))))
Expand Down
13 changes: 9 additions & 4 deletions src/ru/petrsu/nest/yz/parsing.clj
@@ -1,5 +1,5 @@
;;
;; Copyright 2011-2012 Vyacheslav Dimitrov <vyacheslav.dimitrov@gmail.com>
;; Copyright 2011-2013 Vyacheslav Dimitrov <vyacheslav.dimitrov@gmail.com>
;;
;; This file is part of YZ.
;;
Expand Down Expand Up @@ -268,9 +268,14 @@
;; [20.05.12] But now MOM contains information about
;; children of class, so if MOM is defined we can check
;; whether class or one of its children has the property.
(do
(if cl-source (check-prop cl-source id))
[{:id [[id]] :cl cl-target}])
;; [12.01.13] Also we can't throw exception in case
;; cl-source and cl-target are defined because of
;; cl-source also may be abstract class or interface so
;; we must search paths in runtime (core.clj).
(if (and cl-source cl-target)
[{:id nil :cl cl-target}]
(let [_ (check-prop cl-source id)]
[{:id [[id]] :cl cl-target}]))
{:id paths :cl cl-target})))


Expand Down

0 comments on commit d82a06b

Please sign in to comment.