Commit b7c7791d authored by Daniel Gackle's avatar Daniel Gackle
Browse files

Suppress inappropriate deprecation warnings that were arising during

the poor-man's codewalking of try-expressionizing-if?.

Example:
  (try-expressionizing-if? '(for-in (label (foo))))

The codewalker macroexpands (label (foo)) even though it is
not a macro invocation. Since LABEL is a deprecated macro,
a warning was leaking through.
parent a153fc86
......@@ -5,9 +5,10 @@
())
(defun warn-deprecated (old-name &optional new-name)
(warn 'simple-style-warning
:format-control "~:@(~a~) is deprecated~:[.~;, use ~:@(~a~) instead~]"
:format-arguments (list old-name new-name new-name)))
(unless *suppress-deprecation*
(warn 'simple-style-warning
:format-control "~:@(~a~) is deprecated~:[.~;, use ~:@(~a~) instead~]"
:format-arguments (list old-name new-name new-name))))
(defmacro defun-js (old-name new-name args &body body)
`(defun ,old-name ,args
......
......@@ -215,6 +215,11 @@
(warn "Returning from unknown block ~A" tag)
(ret1only)))))) ;; for backwards-compatibility
(defvar *suppress-deprecation* nil
"Temporarily turns off deprecation warnings so that the compiler can
sneakily macroexpand forms during code-walking whether they are macro
invocations or not.")
(defun try-expressionizing-if? (exp &optional (score 0)) ;; poor man's codewalker
"Heuristic that tries not to expressionize deeply nested if expressions."
(cond ((< 1 score) nil)
......@@ -223,7 +228,10 @@
((listp exp)
(loop for x in (cdr exp) always
(try-expressionizing-if?
(or (ignore-errors (ps-macroexpand x)) x) ;; fail
(or (ignore-errors
(let ((*suppress-deprecation* t))
(ps-macroexpand x)))
x) ;; fail
(+ score (case (car exp)
((if cond) 1)
(let (if (second exp) 1 0)) ;; ignore empty binding list
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment