summaryrefslogtreecommitdiffstats
path: root/stdlib/struct.tl
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2023-05-05 12:55:40 -0700
committerKaz Kylheku <kaz@kylheku.com>2023-05-05 12:55:40 -0700
commit22ed56bd3a6eff22bc39577adce319bc7c4d7cf5 (patch)
treec8203bf2dadbed44b59c774fec4c3723a0a3f2e6 /stdlib/struct.tl
parent838a61f63036891f465d63a478a37410ba649412 (diff)
downloadtxr-22ed56bd3a6eff22bc39577adce319bc7c4d7cf5.tar.gz
txr-22ed56bd3a6eff22bc39577adce319bc7c4d7cf5.tar.bz2
txr-22ed56bd3a6eff22bc39577adce319bc7c4d7cf5.zip
compiler: multiple issues in macro-parameter forms.
When a defmacro form is compiled, the entire form is retained as a literal in the output. This is wasteful and gives away the source code. In spite of that, errors in using the macro are incorrectly reported against defmacro, because that is the first symbol in the form. These issues arise with what arguments are passed as the first two parameters of the compiler's expand-bind-mac-params function, and what exactly it does with them. We make a tweak to that, as well as some tweaks to all the calls. * stdlib/compiler.tl (expand-bind-mac-params): There is a mix-up here in that both the ctx-form and err-form arguments are ending up in the compiled output. Let's have only the first agument, ctx-form going into the compiled output. Thus that is what is inserted into the sys:bind-mach-check call that is generated. Secondly, ctx-form should not be passed to the constructor for mac-param-parser. ctx-form is a to-be-evaluated expression which might just be a gensym; we cannot use it at compile time for error reporting. Here we must use the second argument. Thus the second argument is now used only for two purposes: copying the source code info to the output code, and for error reporting in the mac-param-parser class. This second purpose is minor, because the code has been passed through the macro expander before being compiled, which has caught all the errors. Thus the argument is changed to rlcp-form, reflecting its principal use. (comp-tree-bind, comp-tree-case): Calculate a simplified version of the tree-bind or tree-case form for error reporting and pass that as argument the ctx-form argument of expand-bind-mac-params. Just pass form as the second argument. (comp-mac-param-bind, comp-mac-env-param-bind): Just pass form as the second argument of expand-bind-mac-params.
Diffstat (limited to 'stdlib/struct.tl')
0 files changed, 0 insertions, 0 deletions