mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 19:50:24 +02:00
Adjust unbound-variable' GOOPS heuristic for
goops.scm'.
* module/language/tree-il/analyze.scm (goops-toplevel-definition): Add ENV argument. Deal with GOOPS macros expanded within `goops.scm'. (report-possibly-unbound-variables): Adjust.
This commit is contained in:
parent
3c365b8efc
commit
6bb891dc61
1 changed files with 17 additions and 8 deletions
|
@ -633,21 +633,29 @@
|
||||||
(defs toplevel-info-defs) ;; (VARIABLE-NAME ...)
|
(defs toplevel-info-defs) ;; (VARIABLE-NAME ...)
|
||||||
(locs toplevel-info-locs)) ;; (LOCATION ...)
|
(locs toplevel-info-locs)) ;; (LOCATION ...)
|
||||||
|
|
||||||
(define (goops-toplevel-definition proc args)
|
(define (goops-toplevel-definition proc args env)
|
||||||
;; If application of PROC to ARGS is a GOOPS top-level definition, return
|
;; If application of PROC to ARGS is a GOOPS top-level definition, return
|
||||||
;; the name of the variable being defined; otherwise return #f. This
|
;; the name of the variable being defined; otherwise return #f. This
|
||||||
;; assumes knowledge of the current implementation of `define-class' et al.
|
;; assumes knowledge of the current implementation of `define-class' et al.
|
||||||
|
(define (toplevel-define-arg args)
|
||||||
|
(and (pair? args) (pair? (cdr args)) (null? (cddr args))
|
||||||
|
(record-case (car args)
|
||||||
|
((<const> exp)
|
||||||
|
(and (symbol? exp) exp))
|
||||||
|
(else #f))))
|
||||||
|
|
||||||
(record-case proc
|
(record-case proc
|
||||||
((<module-ref> mod public? name)
|
((<module-ref> mod public? name)
|
||||||
(and (equal? mod '(oop goops))
|
(and (equal? mod '(oop goops))
|
||||||
(not public?)
|
(not public?)
|
||||||
(eq? name 'toplevel-define!)
|
(eq? name 'toplevel-define!)
|
||||||
(pair? args) (pair? (cdr args)) (null? (cddr args))
|
(toplevel-define-arg args)))
|
||||||
(record-case (car args)
|
((<toplevel-ref> name)
|
||||||
((<const> exp)
|
;; This may be the result of expanding one of the GOOPS macros within
|
||||||
(and (symbol? exp)
|
;; `oop/goops.scm'.
|
||||||
exp))
|
(and (eq? name 'toplevel-define!)
|
||||||
(else #f))))
|
(eq? env (resolve-module '(oop goops)))
|
||||||
|
(toplevel-define-arg args)))
|
||||||
(else #f)))
|
(else #f)))
|
||||||
|
|
||||||
;; TODO: Combine with `report-unused-variables' so we don't traverse the tree
|
;; TODO: Combine with `report-unused-variables' so we don't traverse the tree
|
||||||
|
@ -703,7 +711,8 @@
|
||||||
((<application> proc args)
|
((<application> proc args)
|
||||||
;; Check for a dynamic top-level definition, as is
|
;; Check for a dynamic top-level definition, as is
|
||||||
;; done by code expanded from GOOPS macros.
|
;; done by code expanded from GOOPS macros.
|
||||||
(let ((name (goops-toplevel-definition proc args)))
|
(let ((name (goops-toplevel-definition proc args
|
||||||
|
env)))
|
||||||
(if (symbol? name)
|
(if (symbol? name)
|
||||||
(make-toplevel-info (alist-delete name refs
|
(make-toplevel-info (alist-delete name refs
|
||||||
eq?)
|
eq?)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue