aboutsummaryrefslogtreecommitdiffstats
path: root/test/tests.lisp
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2023-05-29 20:11:52 -0700
committerKaz Kylheku <kaz@kylheku.com>2023-05-29 20:11:52 -0700
commit8a3b6c735d7640117e5c80f5bb7e84e6c2997c51 (patch)
tree048f0dc97b8353d4434f3a2d7d574dd877d9adac /test/tests.lisp
parent10e1cc59ba222b463661fe01b0b783a2b8d49112 (diff)
downloadtl-who-8a3b6c735d7640117e5c80f5bb7e84e6c2997c51.tar.gz
tl-who-8a3b6c735d7640117e5c80f5bb7e84e6c2997c51.tar.bz2
tl-who-8a3b6c735d7640117e5c80f5bb7e84e6c2997c51.zip
Add warning when local macros used in attr expression.
The with-html-output ("WHO") macro defines some local macrolets. Those are in scope of the entire thing, but they can only be meaningfully used in the imperative Lisp forms that are placed into the HTML tag body. If they are used in an attribute expression, it's probably a programming error; an output side effect doesn't belong there. We implement a diagnostic strategy which produces a warning in this situation. * who.tl (attr-warning-macrolet): New function, which wraps macrolet code around the expression passed in. These macrolets intercept the local macros and generate a warning. Then they decline to expand, deferring to the real macros. (convert-attributes): Wrap the warning macrolets around the run-time evaluation of the val expression. We don't do anything for the compile-time evaluation of a constant attribute expression, because the macro calls we want to intercept do not appear in a constant expression. * test/simple.tl: New test 41 validating that warnings are generated for all the local macros when they are called from an attr expression.
Diffstat (limited to 'test/tests.lisp')
0 files changed, 0 insertions, 0 deletions