From b4b5aec1471a097ba84b42aac5b75438c9d2217f Mon Sep 17 00:00:00 2001 From: Phil Hagelberg Date: Wed, 22 Feb 2023 22:20:00 -0800 Subject: [PATCH] Bypass checks which disable Fennel friendly compiler errors. In Fennel 1.3.0, it checks to see whether _G.io.read exists before proceeding with friendly compiler error messages, because it used to have to read the source from disk in order to provide these messages. That is no longer needed; it can use the source provided as a string, but the check was accidentally left in place. This change bypasses that check with a fake io table in order to get improved compiler error message and parse error reporting. It should be removed once Fennel 1.3.1 or 1.4.0 is brought in. --- src/api/fennel.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/api/fennel.c b/src/api/fennel.c index 182347a7b..24401ebb6 100644 --- a/src/api/fennel.c +++ b/src/api/fennel.c @@ -34,9 +34,10 @@ #define FENNEL_CODE(...) #__VA_ARGS__ static const char* execute_fennel_src = FENNEL_CODE( + io = { read = true } local fennel = require("fennel") debug.traceback = fennel.traceback - local opts = {filename="game", allowedGlobals = false} + local opts = {allowedGlobals = false, ["error-pinpoint"]={">>", "<<"}} local src = ... if(src:find("\n;; strict: true")) then opts.allowedGlobals = nil end local ok, msg = pcall(fennel.eval, src, opts)