Verified Commit ae50fb10 authored by Jason Miller's avatar Jason Miller Committed by Vladimir Sedach
Browse files

Fix for-as-arithmetic loop clause when no limit is present

When negative looping was added (7d2536d8) it broke cases like:

    (loop for i from x ...)

Instead of omitting the test it would instead add a test of (i < null).

This patch corrects the bug that was introduced
parent 408ffa7b
......@@ -177,7 +177,7 @@
(err "an atom after FROM" var))
(let ((start (eat state))
(op (loop-case from-key (:downfrom '-) (otherwise '+)))
(test-op (loop-case from-key (:downfrom '>=) (otherwise '<=)))
(test-op nil)
(by nil)
(end nil))
(loop while (member (as-keyword (peek state)) '(:to :below :downto :above :by)) do
......@@ -185,7 +185,7 @@
(if (eq (as-keyword term) :by)
(setf by (eat state))
(setf op (loop-case term ((:downto :above) '-) (otherwise op))
test-op (loop-case term (:to test-op) (:below '<) (:downto '>=) (:above '>))
test-op (loop-case term (:to (loop-case from-key (:downfrom '>=) (otherwise '<=))) (:below '<) (:downto '>=) (:above '>))
end (eat state)))))
(let ((test (when test-op
(list test-op var (maybe-hoist end state)))))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment