summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorflywind <43030857+xflywind@users.noreply.github.com>2021-01-03 04:05:59 -0600
committerGitHub <noreply@github.com>2021-01-03 11:05:59 +0100
commit76f92265d91ea7490dc434a82459ae93f5e8ff9e (patch)
treea75b684a20799d4d0a3c9b7911bc757e253c962f
parent2aed4186989e0c9192eadcc28f989d41f92237b0 (diff)
downloadNim-76f92265d91ea7490dc434a82459ae93f5e8ff9e.tar.gz
fix #8412 (#16563)
* Revert "Make config processing order test more robust"

This reverts commit cf714c129f7dd598863d1cc588e685df2438c658.

* enable tmath tests

* fix #8412

* Revert "enable tmath tests"

This reverts commit 293b63f57ef71e6c43b9faf24883c998c40a9484.

* add tests

* fix
-rw-r--r--lib/system.nim18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/system.nim b/lib/system.nim
index 29c137b63..618fd5dd7 100644
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -2394,16 +2394,22 @@ when notJSnotNims:
   proc rawProc*[T: proc](x: T): pointer {.noSideEffect, inline.} =
     ## Retrieves the raw proc pointer of the closure `x`. This is
     ## useful for interfacing closures with C.
-    {.emit: """
-    `result` = `x`.ClP_0;
-    """.}
+    when T is "closure":
+      {.emit: """
+      `result` = `x`.ClP_0;
+      """.}
+    else:
+      {.error: "Only closure function and iterator are allowed!".}
 
   proc rawEnv*[T: proc](x: T): pointer {.noSideEffect, inline.} =
     ## Retrieves the raw environment pointer of the closure `x`. This is
     ## useful for interfacing closures with C.
-    {.emit: """
-    `result` = `x`.ClE_0;
-    """.}
+    when T is "closure":
+      {.emit: """
+      `result` = `x`.ClE_0;
+      """.}
+    else:
+      {.error: "Only closure function and iterator are allowed!".}
 
   proc finished*[T: proc](x: T): bool {.noSideEffect, inline.} =
     ## can be used to determine if a first class iterator has finished.