summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-11-27 09:14:01 -0800
committerKaz Kylheku <kaz@kylheku.com>2016-11-27 09:14:01 -0800
commit4016b57938b5d1491e41625eae67c4ed2d66193e (patch)
tree1ea37b67572bd3ff400dd72752b83b4920ab02c3 /share
parent606132c336dbeb0dd8bb851a64c97f2c11b76a85 (diff)
downloadtxr-4016b57938b5d1491e41625eae67c4ed2d66193e.tar.gz
txr-4016b57938b5d1491e41625eae67c4ed2d66193e.tar.bz2
txr-4016b57938b5d1491e41625eae67c4ed2d66193e.zip
Warn about unbound functions.
* eval.c (do_expand): If a compound form doesn't expand into anything, then let us check whether it calls an unbound function, and issue a warning. * share/txr/stdlib/place.tl (sys:pl-expand): Move function definition ahead of first use to suppress unbound function warning. Eventually we will have a relaxed model of deferred warning about this. (sys:placelet-1): Suppress warnings around call to sys:expand because we are expanding a body into which we inserted function calls without inserting their definitions.
Diffstat (limited to 'share')
-rw-r--r--share/txr/stdlib/place.tl41
1 files changed, 21 insertions, 20 deletions
diff --git a/share/txr/stdlib/place.tl b/share/txr/stdlib/place.tl
index b18fddbf..76ca95e2 100644
--- a/share/txr/stdlib/place.tl
+++ b/share/txr/stdlib/place.tl
@@ -88,6 +88,22 @@
(makunbound ',',place-expr))))
,*op-body))
+ (defun sys:pl-expand (unex-place env)
+ (while t
+ (let ((place unex-place))
+ (let ((pm-expander [*place-macro* (if (consp unex-place)
+ (car unex-place))]))
+ (when pm-expander
+ (sys:setq place (sys:set-macro-ancestor
+ [pm-expander unex-place]
+ unex-place))))
+ (sys:setq place (macroexpand-1 place env))
+ (when (or (eq place unex-place)
+ (null place)
+ (and (atom place) (not (symbolp place))))
+ (return place))
+ (sys:setq unex-place place))))
+
(defun place-form-p (unex-place env)
(let ((place (sys:pl-expand unex-place env)))
(or (bindable place)
@@ -146,22 +162,6 @@
^(let ,(zip syms (repeat '((gensym)))) ,*body))
(macro-time
- (defun sys:pl-expand (unex-place env)
- (while t
- (let ((place unex-place))
- (let ((pm-expander [*place-macro* (if (consp unex-place)
- (car unex-place))]))
- (when pm-expander
- (sys:setq place (sys:set-macro-ancestor
- [pm-expander unex-place]
- unex-place))))
- (sys:setq place (macroexpand-1 place env))
- (when (or (eq place unex-place)
- (null place)
- (and (atom place) (not (symbolp place))))
- (return place))
- (sys:setq unex-place place))))
-
(defun sys:cp-origin (to-tree from-form : circ-check)
(unless (memq to-tree circ-check)
(tree-case to-tree
@@ -885,10 +885,11 @@
,tmp-body)))
(call-update-expander pl-getter pl-setter place env
^(macrolet ((,tmp-place () ^(,',pl-getter)))
- ,(sys:expand
- ^(symacrolet ((,sym (,tmp-place)))
- ,*body)
- env))))
+ ,(ignwarn
+ (sys:expand
+ ^(symacrolet ((,sym (,tmp-place)))
+ ,*body)
+ env)))))
(remhash *place-update-expander* tmp-place))))
(defmacro placelet* (sym-place-pairs . body)