From 99a461409be899191e3425285f9901da0755dff7 Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Sun, 28 May 2017 22:33:47 +0200 Subject: [PATCH 2/3] Reject more definitions outside of toplevel context Since we use global tables to store those definitions it makes sense to restrict those to the toplevel only. Signed-off-by: Peter Bex --- core.scm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core.scm b/core.scm index e87815d..cc1dd9a 100644 --- a/core.scm +++ b/core.scm @@ -1195,6 +1195,11 @@ (name (if (pair? (cdddr x)) (fourth x) (symbol->string var)))) + (unless tl? + (quit-compiling + "~adefinition of foreign variable `~s' in non-toplevel context" + (if ln (sprintf "(~a) - " ln) "") + var)) (set! foreign-variables (cons (list var type (if (string? name) @@ -1207,6 +1212,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)] ) -- 2.1.4