From a2a3fa10397bc96020a19936daf76b12e9ba9763 Mon Sep 17 00:00:00 2001 From: Kaushal Modi Date: Thu, 14 May 2020 01:27:57 -0400 Subject: [PATCH] Fail quickly if re or nre module is attempted to be compiled with js [backport] (#14341) Fixes https://github.com/nim-lang/Nim/issues/14338 . --- lib/impure/nre.nim | 3 +++ lib/impure/re.nim | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/impure/nre.nim b/lib/impure/nre.nim index 31ceede50..98965d8d2 100644 --- a/lib/impure/nre.nim +++ b/lib/impure/nre.nim @@ -6,6 +6,9 @@ # distribution, for details about the copyright. # +when defined(js): + {.error: "This library needs to be compiled with a c-like backend, and depends on PCRE.".} + ## What is NRE? ## ============ ## diff --git a/lib/impure/re.nim b/lib/impure/re.nim index 809180774..0ad4e3727 100644 --- a/lib/impure/re.nim +++ b/lib/impure/re.nim @@ -7,6 +7,9 @@ # distribution, for details about the copyright. # +when defined(js): + {.error: "This library needs to be compiled with a c-like backend, and depends on PCRE.".} + ## Regular expression support for Nim. ## ## This module is implemented by providing a wrapper around the @@ -678,4 +681,3 @@ when isMainModule: doAssert replace("bar", re"^", "foo") == "foobar" doAssert replace("foo", re"", "-") == "-foo" doAssert replace("foo", re"$", "bar") == "foobar" -