~ chicken-core (chicken-5) de47b3238022f82ee644bf67235d80221282dd2b
commit de47b3238022f82ee644bf67235d80221282dd2b
Author: LemonBoy <thatlemon@gmail.com>
AuthorDate: Wed Jun 14 21:30:48 2017 +0200
Commit: Evan Hanson <evhan@foldling.org>
CommitDate: Mon Jun 26 09:19:51 2017 +1200
Restrict define-foreign-type forms to the toplevel
This brings this in line with how the other define forms work.
Signed-off-by: Peter Bex <peter@more-magic.net>
Signed-off-by: Evan Hanson <evhan@foldling.org>
diff --git a/core.scm b/core.scm
index 73f5ff15..91f2ead6 100644
--- a/core.scm
+++ b/core.scm
@@ -1204,6 +1204,11 @@
(let ((name (second x))
(type (strip-syntax (third x)))
(conv (cdddr x)))
+ (unless tl?
+ (quit-compiling
+ "~adefinition of foreign type `~s' in non-toplevel context"
+ (if ln (sprintf "(~a) - " ln) "")
+ name))
(cond [(pair? conv)
(let ([arg (gensym)]
[ret (gensym)] )
Trap