diff options
Diffstat (limited to 'scheme/plt/geiser/locations.ss')
-rw-r--r-- | scheme/plt/geiser/locations.ss | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/scheme/plt/geiser/locations.ss b/scheme/plt/geiser/locations.ss index d1c5cb7..87a643d 100644 --- a/scheme/plt/geiser/locations.ss +++ b/scheme/plt/geiser/locations.ss @@ -28,10 +28,11 @@ (provide symbol-location symbol-location* + module-location symbol-module-name symbol-module-path-name) -(require geiser/utils) +(require geiser/utils geiser/modules) (define (symbol-location* sym) (let* ((id (namespace-symbol->identifier sym)) @@ -43,16 +44,26 @@ (module-path-index-resolve (car binding)))) (cons sym #f)))) +(define (make-location name path line) + (list (cons 'name name) + (cons 'file (if (path? path) (path->string path) '())) + (cons 'line (or line '())))) + (define (symbol-location sym) (let* ((loc (symbol-location* sym)) (name (car loc)) (path (cdr loc))) - (list (cons 'name name) - (cons 'file (if (path? path) (path->string path) '()))))) + (if path + (make-location name path #f) + (module-location sym)))) (define symbol-module-path-name (compose cdr symbol-location*)) (define symbol-module-name (compose module-path-name->name symbol-module-path-name)) +(define (module-location sym) + (make-location sym (module-spec->path-name sym) 1)) + + ;;; locations.ss ends here |