summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2015-08-12 10:11:58 +0200
committerAraq <rumpf_a@web.de>2015-08-14 02:19:32 +0200
commit2299318d1e303ffdf5a9a79663e2c3b126bb5352 (patch)
tree179b202469e09d7a0a8473eaff6bc7d3d196f356
parent2f721f0d9928a4ae25b2f2b3761d8861a13e877d (diff)
downloadNim-2299318d1e303ffdf5a9a79663e2c3b126bb5352.tar.gz
toplevel .closure procs are deprecated
-rw-r--r--compiler/semstmts.nim3
-rw-r--r--todo.txt1
-rw-r--r--web/news.txt4
3 files changed, 7 insertions, 1 deletions
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim
index 3d9363d77..ffda6a1bb 100644
--- a/compiler/semstmts.nim
+++ b/compiler/semstmts.nim
@@ -1220,6 +1220,9 @@ proc semProcAux(c: PContext, n: PNode, kind: TSymKind,
   if n.sons[patternPos].kind != nkEmpty:
     c.patterns.add(s)
   if isAnon: result.typ = s.typ
+  if isTopLevel(c) and s.kind != skClosureIterator and
+      s.typ.callConv == ccClosure:
+    message(s.info, warnDeprecated, "top level '.closure' calling convention")
 
 proc determineType(c: PContext, s: PSym) =
   if s.typ != nil: return
diff --git a/todo.txt b/todo.txt
index f9abed891..57cbc83bf 100644
--- a/todo.txt
+++ b/todo.txt
@@ -1,7 +1,6 @@
 version 0.11.4
 ==============
 
-- deprecate toplevel .closure procs
 - deprecate closure iterator construction via ``var cl = foo``
 
 - document special cased varargs[untyped] and varargs[typed]
diff --git a/web/news.txt b/web/news.txt
index 16ac286ae..c93bb821f 100644
--- a/web/news.txt
+++ b/web/news.txt
@@ -46,6 +46,10 @@ News
     overloaded, so we removed it with no deprecation cycle.
   - To use the ``parallel`` statement you now have to
     use the ``--experimental`` mode.
+  - Toplevel procs of calling convention ``closure`` never worked reliably
+    and are now deprecated and will be removed from the language. Instead you
+    have to insert type conversions
+    like ``(proc (a, b: int) {.closure.})(myToplevelProc)`` if necessary.