Skip to content

Commit

Permalink
Type check dimension in make-array
Browse files Browse the repository at this point in the history
  • Loading branch information
Affonso-Gui committed Jul 1, 2019
1 parent ab62abe commit 973aaff
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lisp/l/array.l
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
(setq entity (instantiate element-type dim))
(setq a entity)
(setq dim (list dim)))
(t
((consp dim)
(setq a (instantiate array))
(let* ((i 0)
(rank (length dim))
Expand All @@ -120,7 +120,8 @@
(setf (array-displaced-index-offset a) displaced-index-offset)
(do ((i 0 (1+ i)))
((>= i rank))
(setslot a array (+ i 5) (elt dim i))))))
(setslot a array (+ i 5) (elt dim i)))))
(t (error "integer or list expected")))
(when initial-element (fill entity initial-element))
(when initial-contents
(fill-initial-contents entity 0 dim initial-contents))
Expand Down

0 comments on commit 973aaff

Please sign in to comment.