[other] new experimental pragma .nodestroy for easier custom destructors
This commit is contained in:
parent
f310cf5250
commit
55da84e141
2 changed files with 8 additions and 5 deletions
|
|
@ -25,9 +25,9 @@ const
|
||||||
wBorrow, wExtern, wImportCompilerProc, wThread, wImportCpp, wImportObjC,
|
wBorrow, wExtern, wImportCompilerProc, wThread, wImportCpp, wImportObjC,
|
||||||
wAsmNoStackFrame, wError, wDiscardable, wNoInit, wCodegenDecl,
|
wAsmNoStackFrame, wError, wDiscardable, wNoInit, wCodegenDecl,
|
||||||
wGensym, wInject, wRaises, wTags, wLocks, wDelegator, wGcSafe,
|
wGensym, wInject, wRaises, wTags, wLocks, wDelegator, wGcSafe,
|
||||||
wConstructor, wExportNims, wUsed, wLiftLocals, wStacktrace, wLinetrace}
|
wConstructor, wExportNims, wUsed, wLiftLocals, wStacktrace, wLinetrace, wNoDestroy}
|
||||||
converterPragmas* = procPragmas
|
converterPragmas* = procPragmas - {wNoDestroy}
|
||||||
methodPragmas* = procPragmas+{wBase}-{wImportCpp}
|
methodPragmas* = procPragmas+{wBase}-{wImportCpp, wNoDestroy}
|
||||||
templatePragmas* = {wDeprecated, wError, wGensym, wInject, wDirty,
|
templatePragmas* = {wDeprecated, wError, wGensym, wInject, wDirty,
|
||||||
wDelegator, wExportNims, wUsed, wPragma}
|
wDelegator, wExportNims, wUsed, wPragma}
|
||||||
macroPragmas* = {FirstCallConv..LastCallConv, wImportc, wExportc,
|
macroPragmas* = {FirstCallConv..LastCallConv, wImportc, wExportc,
|
||||||
|
|
@ -874,6 +874,9 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: var int,
|
||||||
if sym.typ[0] != nil:
|
if sym.typ[0] != nil:
|
||||||
localError(c.config, sym.ast[paramsPos][0].info,
|
localError(c.config, sym.ast[paramsPos][0].info,
|
||||||
".noreturn with return type not allowed")
|
".noreturn with return type not allowed")
|
||||||
|
of wNoDestroy:
|
||||||
|
noVal(c, it)
|
||||||
|
incl(sym.flags, sfGeneratedOp)
|
||||||
of wDynlib:
|
of wDynlib:
|
||||||
processDynLib(c, it, sym)
|
processDynLib(c, it, sym)
|
||||||
of wCompilerProc, wCore:
|
of wCompilerProc, wCore:
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ type
|
||||||
wAssertions, wPatterns, wTrMacros, wWarnings,
|
wAssertions, wPatterns, wTrMacros, wWarnings,
|
||||||
wHints, wOptimization, wRaises, wWrites, wReads, wSize, wEffects, wTags,
|
wHints, wOptimization, wRaises, wWrites, wReads, wSize, wEffects, wTags,
|
||||||
wDeadCodeElimUnused, # deprecated, dead code elim always happens
|
wDeadCodeElimUnused, # deprecated, dead code elim always happens
|
||||||
wSafecode, wPackage, wNoForward, wReorder, wNoRewrite,
|
wSafecode, wPackage, wNoForward, wReorder, wNoRewrite, wNoDestroy,
|
||||||
wPragma,
|
wPragma,
|
||||||
wCompileTime, wNoInit,
|
wCompileTime, wNoInit,
|
||||||
wPassc, wPassl, wBorrow, wDiscardable,
|
wPassc, wPassl, wBorrow, wDiscardable,
|
||||||
|
|
@ -148,7 +148,7 @@ const
|
||||||
"assertions", "patterns", "trmacros", "warnings", "hints",
|
"assertions", "patterns", "trmacros", "warnings", "hints",
|
||||||
"optimization", "raises", "writes", "reads", "size", "effects", "tags",
|
"optimization", "raises", "writes", "reads", "size", "effects", "tags",
|
||||||
"deadcodeelim", # deprecated, dead code elim always happens
|
"deadcodeelim", # deprecated, dead code elim always happens
|
||||||
"safecode", "package", "noforward", "reorder", "norewrite",
|
"safecode", "package", "noforward", "reorder", "norewrite", "nodestroy",
|
||||||
"pragma",
|
"pragma",
|
||||||
"compiletime", "noinit",
|
"compiletime", "noinit",
|
||||||
"passc", "passl", "borrow", "discardable", "fieldchecks",
|
"passc", "passl", "borrow", "discardable", "fieldchecks",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue