diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2018-04-04 23:20:13 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2018-04-04 23:20:13 -0700 |
commit | f0613c4c83359a528adc4f5cf149372b160529f7 (patch) | |
tree | 98690842eb38e39e85f329e110f45bdc1b400fec /share | |
parent | de32c069f84052de9edae9a3bf87d864b22d501e (diff) | |
download | txr-f0613c4c83359a528adc4f5cf149372b160529f7.tar.gz txr-f0613c4c83359a528adc4f5cf149372b160529f7.tar.bz2 txr-f0613c4c83359a528adc4f5cf149372b160529f7.zip |
compiler: move sys:bind-mac-error to error.tl.
The sys:bind-mac-error function is a run-time support function
for the compiler-generated code for destructuring. But the
compiler.tl source file is a bad place for it. It means that
compiled modules which need sys:bind-mac-error auto-load the
entire compiler. That easily creates an irresolveable cycle,
because the compiler is on top of the foodchain.
No, sys:bind-mac-error belongs in error.tl; the light-weight
module of low-dependency run-time support routines for error
reporting.
* lisplib.c (error_set_entries): Add sys:bind-mac-error symbol
here.
(compiler_set_entries): Remove it from here.
* share/txr/stdlib/compiler.tl (sys:bind-mac-error): Function
removed.
* share/txr/stdlib/error.tl (sys:bind-mac-error): Function
moved here.
Diffstat (limited to 'share')
-rw-r--r-- | share/txr/stdlib/compiler.tl | 7 | ||||
-rw-r--r-- | share/txr/stdlib/error.tl | 7 |
2 files changed, 7 insertions, 7 deletions
diff --git a/share/txr/stdlib/compiler.tl b/share/txr/stdlib/compiler.tl index e56287c7..b0942a15 100644 --- a/share/txr/stdlib/compiler.tl +++ b/share/txr/stdlib/compiler.tl @@ -1294,13 +1294,6 @@ (mac-param-bind form (op name def) form ^(sys:rt-defsymacro ',name ',def))) -(defun sys:bind-mac-error (ctx-form params obj too-few-p) - (if (atom obj) - (compile-error ctx-form "extra atom ~s not matched by params ~s" - obj params) - (compile-error ctx-form "object ~s too ~a for params ~s" - obj (if too-few-p "short" "long") params))) - (defun usr:compile-toplevel (exp) (let ((co (new compiler)) (as (new assembler))) diff --git a/share/txr/stdlib/error.tl b/share/txr/stdlib/error.tl index 8376535a..1e9ec191 100644 --- a/share/txr/stdlib/error.tl +++ b/share/txr/stdlib/error.tl @@ -47,3 +47,10 @@ (catch (throw 'defr-warning (fmt `@loc~s: @fmt` name . args) tag) (continue ())))) + +(defun sys:bind-mac-error (ctx-form params obj too-few-p) + (if (atom obj) + (compile-error ctx-form "extra atom ~s not matched by params ~s" + obj params) + (compile-error ctx-form "object ~s too ~a for params ~s" + obj (if too-few-p "short" "long") params))) |