summary refs log tree commit diff stats
path: root/lib/std/effecttraits.nim
diff options
context:
space:
mode:
Diffstat (limited to 'lib/std/effecttraits.nim')
-rw-r--r--lib/std/effecttraits.nim47
1 files changed, 28 insertions, 19 deletions
diff --git a/lib/std/effecttraits.nim b/lib/std/effecttraits.nim
index 0f0a24492..3d1b4ffd3 100644
--- a/lib/std/effecttraits.nim
+++ b/lib/std/effecttraits.nim
@@ -11,44 +11,53 @@
 ## for Nim's macro system.
 ## **Since**: Version 1.4.
 ##
-## One can test for the existance of this standard module
-## via ``defined(nimHasEffectTraitsModule)``.
+## One can test for the existence of this standard module
+## via `defined(nimHasEffectTraitsModule)`.
 
-import macros
+import std/macros
 
 proc getRaisesListImpl(n: NimNode): NimNode = discard "see compiler/vmops.nim"
 proc getTagsListImpl(n: NimNode): NimNode = discard "see compiler/vmops.nim"
+proc getForbidsListImpl(n: NimNode): NimNode = discard "see compiler/vmops.nim"
 proc isGcSafeImpl(n: NimNode): bool = discard "see compiler/vmops.nim"
 proc hasNoSideEffectsImpl(n: NimNode): bool = discard "see compiler/vmops.nim"
 
 proc getRaisesList*(fn: NimNode): NimNode =
-  ## Extracts the ``.raises`` list of the func/proc/etc ``fn``.
-  ## ``fn`` has to be a resolved symbol of kind ``nnkSym``. This
-  ## implies that the macro that calls this proc should accept ``typed``
-  ## arguments and not ``untyped`` arguments.
+  ## Extracts the `.raises` list of the func/proc/etc `fn`.
+  ## `fn` has to be a resolved symbol of kind `nnkSym`. This
+  ## implies that the macro that calls this proc should accept `typed`
+  ## arguments and not `untyped` arguments.
   expectKind fn, nnkSym
   result = getRaisesListImpl(fn)
 
 proc getTagsList*(fn: NimNode): NimNode =
-  ## Extracts the ``.tags`` list of the func/proc/etc ``fn``.
-  ## ``fn`` has to be a resolved symbol of kind ``nnkSym``. This
-  ## implies that the macro that calls this proc should accept ``typed``
-  ## arguments and not ``untyped`` arguments.
+  ## Extracts the `.tags` list of the func/proc/etc `fn`.
+  ## `fn` has to be a resolved symbol of kind `nnkSym`. This
+  ## implies that the macro that calls this proc should accept `typed`
+  ## arguments and not `untyped` arguments.
   expectKind fn, nnkSym
   result = getTagsListImpl(fn)
 
+proc getForbidsList*(fn: NimNode): NimNode =
+  ## Extracts the `.forbids` list of the func/proc/etc `fn`.
+  ## `fn` has to be a resolved symbol of kind `nnkSym`. This
+  ## implies that the macro that calls this proc should accept `typed`
+  ## arguments and not `untyped` arguments.
+  expectKind fn, nnkSym
+  result = getForbidsListImpl(fn)
+
 proc isGcSafe*(fn: NimNode): bool =
-  ## Return true if the func/proc/etc ``fn`` is `gcsafe`.
-  ## ``fn`` has to be a resolved symbol of kind ``nnkSym``. This
-  ## implies that the macro that calls this proc should accept ``typed``
-  ## arguments and not ``untyped`` arguments.
+  ## Return true if the func/proc/etc `fn` is `gcsafe`.
+  ## `fn` has to be a resolved symbol of kind `nnkSym`. This
+  ## implies that the macro that calls this proc should accept `typed`
+  ## arguments and not `untyped` arguments.
   expectKind fn, nnkSym
   result = isGcSafeImpl(fn)
 
 proc hasNoSideEffects*(fn: NimNode): bool =
-  ## Return true if the func/proc/etc ``fn`` has `noSideEffect`.
-  ## ``fn`` has to be a resolved symbol of kind ``nnkSym``. This
-  ## implies that the macro that calls this proc should accept ``typed``
-  ## arguments and not ``untyped`` arguments.
+  ## Return true if the func/proc/etc `fn` has `noSideEffect`.
+  ## `fn` has to be a resolved symbol of kind `nnkSym`. This
+  ## implies that the macro that calls this proc should accept `typed`
+  ## arguments and not `untyped` arguments.
   expectKind fn, nnkSym
   result = hasNoSideEffectsImpl(fn)