From 70d057fcc6f76f016671d4775fec879f2762811f Mon Sep 17 00:00:00 2001 From: ringabout <43030857+ringabout@users.noreply.github.com> Date: Thu, 16 Jan 2025 22:43:18 +0800 Subject: [PATCH] fixes `compile` crashes with one parameter (#24618) `{.compile("foo.c").}` makes Nim compiler crash --- compiler/pragmas.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim index 098ce36d58..e488412af7 100644 --- a/compiler/pragmas.nim +++ b/compiler/pragmas.nim @@ -590,7 +590,7 @@ proc processCompile(c: PContext, n: PNode) = var customArgs = "" if n.kind in nkCallKinds: s = getStrLit(c, n, 1) - if n.len <= 3: + if n.len == 3: customArgs = getStrLit(c, n, 2) else: localError(c.config, n.info, "'.compile' pragma takes up 2 arguments")