summary refs log tree commit diff stats
path: root/compiler
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 /compiler
parent74fdd5c2eaa5507b636c70db80df7f9c3f332d2b (diff)
downloadNim-85cc5a6a1f0247f0d70f68831a19ec9cab1f5dd3.tar.gz
destuctors are experimental; 'func' is now a keyword
Diffstat (limited to 'compiler')
-rw-r--r--compiler/lexer.nim6
-rw-r--r--compiler/semstmts.nim5
-rw-r--r--compiler/wordrecg.nim4
3 files changed, 9 insertions, 6 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",