destuctors are experimental; 'func' is now a keyword
This commit is contained in:
parent
74fdd5c2ea
commit
85cc5a6a1f
9 changed files with 20 additions and 9 deletions
|
|
@ -38,7 +38,7 @@ type
|
||||||
tkConst, tkContinue, tkConverter,
|
tkConst, tkContinue, tkConverter,
|
||||||
tkDefer, tkDiscard, tkDistinct, tkDiv, tkDo,
|
tkDefer, tkDiscard, tkDistinct, tkDiv, tkDo,
|
||||||
tkElif, tkElse, tkEnd, tkEnum, tkExcept, tkExport,
|
tkElif, tkElse, tkEnd, tkEnum, tkExcept, tkExport,
|
||||||
tkFinally, tkFor, tkFrom,
|
tkFinally, tkFor, tkFrom, tkFunc,
|
||||||
tkGeneric, tkIf, tkImport, tkIn, tkInclude, tkInterface,
|
tkGeneric, tkIf, tkImport, tkIn, tkInclude, tkInterface,
|
||||||
tkIs, tkIsnot, tkIterator,
|
tkIs, tkIsnot, tkIterator,
|
||||||
tkLet,
|
tkLet,
|
||||||
|
|
@ -75,7 +75,7 @@ const
|
||||||
"const", "continue", "converter",
|
"const", "continue", "converter",
|
||||||
"defer", "discard", "distinct", "div", "do",
|
"defer", "discard", "distinct", "div", "do",
|
||||||
"elif", "else", "end", "enum", "except", "export",
|
"elif", "else", "end", "enum", "except", "export",
|
||||||
"finally", "for", "from", "generic", "if",
|
"finally", "for", "from", "func", "generic", "if",
|
||||||
"import", "in", "include", "interface", "is", "isnot", "iterator",
|
"import", "in", "include", "interface", "is", "isnot", "iterator",
|
||||||
"let",
|
"let",
|
||||||
"macro", "method", "mixin", "mod",
|
"macro", "method", "mixin", "mod",
|
||||||
|
|
|
||||||
|
|
@ -1026,7 +1026,10 @@ proc maybeAddResult(c: PContext, s: PSym, n: PNode) =
|
||||||
|
|
||||||
proc semOverride(c: PContext, s: PSym, n: PNode) =
|
proc semOverride(c: PContext, s: PSym, n: PNode) =
|
||||||
case s.name.s.normalize
|
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":
|
of "deepcopy":
|
||||||
if s.typ.len == 2 and
|
if s.typ.len == 2 and
|
||||||
s.typ.sons[1].skipTypes(abstractInst).kind in {tyRef, tyPtr} and
|
s.typ.sons[1].skipTypes(abstractInst).kind in {tyRef, tyPtr} and
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ type
|
||||||
wBind, wBlock, wBreak, wCase, wCast, wConst,
|
wBind, wBlock, wBreak, wCase, wCast, wConst,
|
||||||
wContinue, wConverter, wDefer, wDiscard, wDistinct, wDiv, wDo,
|
wContinue, wConverter, wDefer, wDiscard, wDistinct, wDiv, wDo,
|
||||||
wElif, wElse, wEnd, wEnum, wExcept, wExport,
|
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,
|
wInclude, wInterface, wIs, wIsnot, wIterator, wLet,
|
||||||
wMacro, wMethod, wMixin, wMod, wNil,
|
wMacro, wMethod, wMixin, wMod, wNil,
|
||||||
wNot, wNotin, wObject, wOf, wOr, wOut, wProc, wPtr, wRaise, wRef, wReturn,
|
wNot, wNotin, wObject, wOf, wOr, wOut, wProc, wPtr, wRaise, wRef, wReturn,
|
||||||
|
|
@ -106,7 +106,7 @@ const
|
||||||
"const", "continue", "converter",
|
"const", "continue", "converter",
|
||||||
"defer", "discard", "distinct", "div", "do",
|
"defer", "discard", "distinct", "div", "do",
|
||||||
"elif", "else", "end", "enum", "except", "export",
|
"elif", "else", "end", "enum", "except", "export",
|
||||||
"finally", "for", "from", "generic", "if",
|
"finally", "for", "from", "func", "generic", "if",
|
||||||
"import", "in", "include", "interface", "is", "isnot", "iterator",
|
"import", "in", "include", "interface", "is", "isnot", "iterator",
|
||||||
"let",
|
"let",
|
||||||
"macro", "method", "mixin", "mod", "nil", "not", "notin",
|
"macro", "method", "mixin", "mod", "nil", "not", "notin",
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ bind block break
|
||||||
case cast const continue converter
|
case cast const continue converter
|
||||||
defer discard distinct div do
|
defer discard distinct div do
|
||||||
elif else end enum except export
|
elif else end enum except export
|
||||||
finally for from
|
finally for from func
|
||||||
generic
|
generic
|
||||||
if import in include interface is isnot iterator
|
if import in include interface is isnot iterator
|
||||||
let
|
let
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,8 @@ const
|
||||||
"break", "case", "cast", "const", "continue", "converter",
|
"break", "case", "cast", "const", "continue", "converter",
|
||||||
"defer", "discard", "distinct", "div", "do",
|
"defer", "discard", "distinct", "div", "do",
|
||||||
"elif", "else", "end", "enum", "except", "export",
|
"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",
|
"interface", "is", "isnot", "iterator", "let", "macro", "method",
|
||||||
"mixin", "mod", "nil", "not", "notin", "object", "of", "or", "out", "proc",
|
"mixin", "mod", "nil", "not", "notin", "object", "of", "or", "out", "proc",
|
||||||
"ptr", "raise", "ref", "return", "shl", "shr", "static",
|
"ptr", "raise", "ref", "return", "shl", "shr", "static",
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@ myobj destroyed
|
||||||
'''
|
'''
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
{.experimental.}
|
||||||
|
|
||||||
type
|
type
|
||||||
TMyObj = object
|
TMyObj = object
|
||||||
x, y: int
|
x, y: int
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@ discard """
|
||||||
errormsg: " usage of a type with a destructor in a non destructible context"
|
errormsg: " usage of a type with a destructor in a non destructible context"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
{.experimental.}
|
||||||
|
|
||||||
type
|
type
|
||||||
TMyObj = object
|
TMyObj = object
|
||||||
x, y: int
|
x, y: int
|
||||||
|
|
|
||||||
|
|
@ -418,7 +418,7 @@ proc main(c: var TConfigData) =
|
||||||
quit("[Error] cannot write file: " & outfile)
|
quit("[Error] cannot write file: " & outfile)
|
||||||
removeFile(temp)
|
removeFile(temp)
|
||||||
copyDir("web/assets", "web/upload/assets")
|
copyDir("web/assets", "web/upload/assets")
|
||||||
#buildJS("web/upload")
|
buildJS("web/upload")
|
||||||
buildNewsRss(c, "web/upload")
|
buildNewsRss(c, "web/upload")
|
||||||
#buildAddDoc(c, "web/upload")
|
#buildAddDoc(c, "web/upload")
|
||||||
#buildDocSamples(c, "web/upload")
|
#buildDocSamples(c, "web/upload")
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,11 @@ News
|
||||||
- The "symmetric set difference" operator (``-+-``) never worked and has been
|
- The "symmetric set difference" operator (``-+-``) never worked and has been
|
||||||
removed.
|
removed.
|
||||||
- ``defer`` is a keyword now.
|
- ``defer`` is a keyword now.
|
||||||
|
- ``func`` is a keyword now.
|
||||||
- The ``using`` language feature now needs to be activated via the new
|
- The ``using`` language feature now needs to be activated via the new
|
||||||
``{.experimental.}`` pragma that enables experimental language features.
|
``{.experimental.}`` pragma that enables experimental language features.
|
||||||
|
- Destructors are now officially *experimental*.
|
||||||
|
|
||||||
|
|
||||||
Language Additions
|
Language Additions
|
||||||
------------------
|
------------------
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue