summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2014-12-10 01:57:08 +0100
committerAraq <rumpf_a@web.de>2014-12-10 01:57:08 +0100
commit85cc5a6a1f0247f0d70f68831a19ec9cab1f5dd3 (patch)
tree19e8a95d1b974544de36f7f9eabd562b13c424ac
parent74fdd5c2eaa5507b636c70db80df7f9c3f332d2b (diff)
downloadNim-85cc5a6a1f0247f0d70f68831a19ec9cab1f5dd3.tar.gz
destuctors are experimental; 'func' is now a keyword
-rw-r--r--compiler/lexer.nim6
-rw-r--r--compiler/semstmts.nim5
-rw-r--r--compiler/wordrecg.nim4
-rw-r--r--doc/keywords.txt2
-rw-r--r--lib/packages/docutils/highlite.nim3
-rw-r--r--tests/destructor/tdestructor.nim2
-rw-r--r--tests/destructor/tdestructor2.nim2
-rw-r--r--tools/nimweb.nim2
-rw-r--r--web/news.txt3
9 files changed, 20 insertions, 9 deletions
diff --git a/compiler/lexer.nim b/compiler/lexer.nim
index fb74f27d6..a6b85d7f3 100644
--- a/compiler/lexer.nim
+++ b/compiler/lexer.nim
@@ -38,7 +38,7 @@ type
     tkConst, tkContinue, tkConverter,
     tkDefer, tkDiscard, tkDistinct, tkDiv, tkDo,
     tkElif, tkElse, tkEnd, tkEnum, tkExcept, tkExport,
-    tkFinally, tkFor, tkFrom,
+    tkFinally, tkFor, tkFrom, tkFunc,
     tkGeneric, tkIf, tkImport, tkIn, tkInclude, tkInterface, 
     tkIs, tkIsnot, tkIterator,
     tkLet,
@@ -75,9 +75,9 @@ const
     "const", "continue", "converter",
     "defer", "discard", "distinct", "div", "do",
     "elif", "else", "end", "enum", "except", "export",
-    "finally", "for", "from", "generic", "if", 
+    "finally", "for", "from", "func", "generic", "if", 
     "import", "in", "include", "interface", "is", "isnot", "iterator",
-    "let", 
+    "let",
     "macro", "method", "mixin", "mod", 
     "nil", "not", "notin", "object", "of", "or", 
     "out", "proc", "ptr", "raise", "ref", "return", 
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim
index 933ac7daf..c67fdb0f9 100644
--- a/compiler/semstmts.nim
+++ b/compiler/semstmts.nim
@@ -1026,7 +1026,10 @@ proc maybeAddResult(c: PContext, s: PSym, n: PNode) =
 
 proc semOverride(c: PContext, s: PSym, n: PNode) =
   case s.name.s.normalize
-  of "destroy": doDestructorStuff(c, s, n)
+  of "destroy":
+    doDestructorStuff(c, s, n)
+    if not experimentalMode(c):
+      localError n.info, "use the {.experimental.} pragma to enable destructors"
   of "deepcopy":
     if s.typ.len == 2 and
         s.typ.sons[1].skipTypes(abstractInst).kind in {tyRef, tyPtr} and
diff --git a/compiler/wordrecg.nim b/compiler/wordrecg.nim
index f08ab0ad9..1148bdeaf 100644
--- a/compiler/wordrecg.nim
+++ b/compiler/wordrecg.nim
@@ -26,7 +26,7 @@ type
     wBind, wBlock, wBreak, wCase, wCast, wConst, 
     wContinue, wConverter, wDefer, wDiscard, wDistinct, wDiv, wDo, 
     wElif, wElse, wEnd, wEnum, wExcept, wExport,
-    wFinally, wFor, wFrom, wGeneric, wIf, wImport, wIn, 
+    wFinally, wFor, wFrom, wFunc, wGeneric, wIf, wImport, wIn, 
     wInclude, wInterface, wIs, wIsnot, wIterator, wLet,
     wMacro, wMethod, wMixin, wMod, wNil, 
     wNot, wNotin, wObject, wOf, wOr, wOut, wProc, wPtr, wRaise, wRef, wReturn, 
@@ -106,7 +106,7 @@ const
     "const", "continue", "converter",
     "defer", "discard", "distinct", "div", "do",
     "elif", "else", "end", "enum", "except", "export", 
-    "finally", "for", "from", "generic", "if", 
+    "finally", "for", "from", "func", "generic", "if", 
     "import", "in", "include", "interface", "is", "isnot", "iterator",
     "let",
     "macro", "method", "mixin", "mod", "nil", "not", "notin",
diff --git a/doc/keywords.txt b/doc/keywords.txt
index 67ff0ab7f..7a4f8c696 100644
--- a/doc/keywords.txt
+++ b/doc/keywords.txt
@@ -3,7 +3,7 @@ bind block break
 case cast const continue converter
 defer discard distinct div do
 elif else end enum except export
-finally for from
+finally for from func
 generic
 if import in include interface is isnot iterator
 let
diff --git a/lib/packages/docutils/highlite.nim b/lib/packages/docutils/highlite.nim
index 9c482575a..7fc2e1aa3 100644
--- a/lib/packages/docutils/highlite.nim
+++ b/lib/packages/docutils/highlite.nim
@@ -50,7 +50,8 @@ const
     "break", "case", "cast", "const", "continue", "converter",
     "defer", "discard", "distinct", "div", "do",
     "elif", "else", "end", "enum", "except", "export",
-    "finally", "for", "from", "generic", "if", "import", "in", "include",
+    "finally", "for", "from", "func", 
+    "generic", "if", "import", "in", "include",
     "interface", "is", "isnot", "iterator", "let", "macro", "method",
     "mixin", "mod", "nil", "not", "notin", "object", "of", "or", "out", "proc",
     "ptr", "raise", "ref", "return", "shl", "shr", "static",
diff --git a/tests/destructor/tdestructor.nim b/tests/destructor/tdestructor.nim
index f0ea3c5c6..cbaba3154 100644
--- a/tests/destructor/tdestructor.nim
+++ b/tests/destructor/tdestructor.nim
@@ -22,6 +22,8 @@ myobj destroyed
 '''
 """
 
+{.experimental.}
+
 type
   TMyObj = object
     x, y: int
diff --git a/tests/destructor/tdestructor2.nim b/tests/destructor/tdestructor2.nim
index a5b62860c..1bdf4993b 100644
--- a/tests/destructor/tdestructor2.nim
+++ b/tests/destructor/tdestructor2.nim
@@ -3,6 +3,8 @@ discard """
   errormsg: " usage of a type with a destructor in a non destructible context"
 """
 
+{.experimental.}
+
 type  
   TMyObj = object
     x, y: int
diff --git a/tools/nimweb.nim b/tools/nimweb.nim
index 6fc946552..ddbba1e3f 100644
--- a/tools/nimweb.nim
+++ b/tools/nimweb.nim
@@ -418,7 +418,7 @@ proc main(c: var TConfigData) =
       quit("[Error] cannot write file: " & outfile)
     removeFile(temp)
   copyDir("web/assets", "web/upload/assets")
-  #buildJS("web/upload")
+  buildJS("web/upload")
   buildNewsRss(c, "web/upload")
   #buildAddDoc(c, "web/upload")
   #buildDocSamples(c, "web/upload")
diff --git a/web/news.txt b/web/news.txt
index d345526c4..a8dee9c15 100644
--- a/web/news.txt
+++ b/web/news.txt
@@ -29,8 +29,11 @@ News
   - The "symmetric set difference" operator (``-+-``) never worked and has been
     removed.
   - ``defer`` is a keyword now.
+  - ``func`` is a keyword now.
   - The ``using`` language feature now needs to be activated via the new
     ``{.experimental.}`` pragma that enables experimental language features.
+  - Destructors are now officially *experimental*.
+
 
   Language Additions
   ------------------