summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorYuriy Glukhov <yuriy.glukhov@gmail.com>2018-06-12 12:17:03 +0300
committerYuriy Glukhov <yuriy.glukhov@gmail.com>2018-06-12 12:31:14 +0300
commit7e7b85afc7b915781c37fcf43487a99a30144dcd (patch)
tree215bacec515af14ea0865a853d28bfcc91e43eae /compiler
parent1c58f31a71d2fb8c8569a6ceb6fffc4778d1c7ab (diff)
downloadNim-7e7b85afc7b915781c37fcf43487a99a30144dcd.tar.gz
Allow stacktrace and linetrace pragmas on procs
Diffstat (limited to 'compiler')
-rw-r--r--compiler/pragmas.nim4
-rw-r--r--compiler/semstmts.nim3
2 files changed, 5 insertions, 2 deletions
diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim
index bfb06e00a..bfb8e78eb 100644
--- a/compiler/pragmas.nim
+++ b/compiler/pragmas.nim
@@ -24,8 +24,8 @@ const
     wCompilerProc, wCore, wProcVar, wDeprecated, wVarargs, wCompileTime, wMerge,
     wBorrow, wExtern, wImportCompilerProc, wThread, wImportCpp, wImportObjC,
     wAsmNoStackFrame, wError, wDiscardable, wNoInit, wCodegenDecl,
-    wGensym, wInject, wRaises, wTags, wLocks, wDelegator, wGcSafe,
-    wOverride, wConstructor, wExportNims, wUsed, wLiftLocals}
+    wGensym, wInject, wRaises, wTags, wLocks, wDelegator, wGcSafe, wOverride,
+    wConstructor, wExportNims, wUsed, wLiftLocals, wStacktrace, wLinetrace}
   converterPragmas* = procPragmas
   methodPragmas* = procPragmas+{wBase}-{wImportCpp}
   templatePragmas* = {wImmediate, wDeprecated, wError, wGensym, wInject, wDirty,
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim
index 455e06e82..b4c327362 100644
--- a/compiler/semstmts.nim
+++ b/compiler/semstmts.nim
@@ -1489,6 +1489,7 @@ proc semProcAux(c: PContext, n: PNode, kind: TSymKind,
   # before compiling the proc body, set as current the scope
   # where the proc was declared
   let oldScope = c.currentScope
+  let oldOptions = c.config.options
   #c.currentScope = s.scope
   pushOwner(c, s)
   openScope(c)
@@ -1569,6 +1570,8 @@ proc semProcAux(c: PContext, n: PNode, kind: TSymKind,
     popOwner(c)
     pushOwner(c, s)
   s.options = c.config.options
+  c.config.options = oldOptions
+
   if sfOverriden in s.flags or s.name.s[0] == '=': semOverride(c, s, n)
   if s.name.s[0] in {'.', '('}:
     if s.name.s in [".", ".()", ".="] and {destructor, dotOperators} * c.features == {}: