From da7a6f48757918088fe24db7d2cce23726f654df 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 . (cherry picked from commit a2a3fa10397bc96020a19936daf76b12e9ba9763) --- 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 f0b3074f9d..5129c210f2 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 652a92d55d..af4cb71643 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 @@ -665,4 +668,3 @@ when isMainModule: doAssert replace("bar", re"^", "foo") == "foobar" doAssert replace("foo", re"", "-") == "-foo" doAssert replace("foo", re"$", "bar") == "foobar" -