Skip to content

Commit

Permalink
Improve source position info handling in clasp
Browse files Browse the repository at this point in the history
Source position info in clasp comes in two flavors. A single object that
stores a source position and a cons cell that stores a start and end
source position range.  This commit allows slime to recognize them and
work with both forms.
  • Loading branch information
drmeister committed Jul 9, 2021
1 parent 98a656d commit 68f5623
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions swank/clasp.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -228,17 +228,21 @@
(reader-error :read-error)
(error :error)))

(defun %condition-location (origin)
;; NOTE: If we're compiling in a buffer, the origin
;; will already be set up with the offset correctly
;; due to the :source-debug parameters from
;; swank-compile-string (below).
(make-file-location
(core:file-scope-pathname
(core:file-scope origin))
(core:source-pos-info-filepos origin)))

(defun condition-location (origin)
(if (null origin)
(make-error-location "No error location available")
;; NOTE: If we're compiling in a buffer, the origin
;; will already be set up with the offset correctly
;; due to the :source-debug parameters from
;; swank-compile-string (below).
(make-file-location
(core:file-scope-pathname
(core:file-scope origin))
(core:source-pos-info-filepos origin))))
(typecase origin
(null (make-error-location "No error location available"))
(cons (%condition-location (car origin)))
(t (%condition-location origin))))

(defun signal-compiler-condition (condition origin)
(signal 'compiler-condition
Expand Down

0 comments on commit 68f5623

Please sign in to comment.