summary refs log tree commit diff stats
path: root/compiler/lambdalifting.nim
diff options
context:
space:
mode:
authorFlaviu Tamas <tamasflaviu@gmail.com>2015-05-26 19:32:50 -0400
committerFlaviu Tamas <tamasflaviu@gmail.com>2015-06-07 13:12:18 -0400
commit90ed34db72e8ea8f70d1e86dd2335efe48532fa8 (patch)
tree9d9e46c0ddbb87f562981f072220bd36a7f199cb /compiler/lambdalifting.nim
parent075a5e844069979f1fc3782839e9e2cc62c61ad5 (diff)
parentbbb1bdb4a939aa43ed981acc2f96bce918be7d21 (diff)
downloadNim-90ed34db72e8ea8f70d1e86dd2335efe48532fa8.tar.gz
Merge branch 'devel' of https://github.com/Araq/Nim into add-nre
* 'devel' of https://github.com/Araq/Nim:
  Fix #964, fix #1384
  Don't inspect typedescs
Diffstat (limited to 'compiler/lambdalifting.nim')
-rw-r--r--compiler/lambdalifting.nim6
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/lambdalifting.nim b/compiler/lambdalifting.nim
index c68bc352c..69b45c980 100644
--- a/compiler/lambdalifting.nim
+++ b/compiler/lambdalifting.nim
@@ -946,7 +946,11 @@ proc transformOuterProc(o: POuterContext, n: PNode; it: TIter): PNode =
 proc liftLambdas*(fn: PSym, body: PNode): PNode =
   # XXX gCmd == cmdCompileToJS does not suffice! The compiletime stuff needs
   # the transformation even when compiling to JS ...
-  if body.kind == nkEmpty or gCmd == cmdCompileToJS or
+
+  # However we can do lifting for the stuff which is *only* compiletime.
+  let isCompileTime = sfCompileTime in fn.flags or fn.kind == skMacro
+
+  if body.kind == nkEmpty or (gCmd == cmdCompileToJS and not isCompileTime) or
       fn.skipGenericOwner.kind != skModule:
     # ignore forward declaration:
     result = body