renamed optional to discardable
This commit is contained in:
parent
72ceda98cb
commit
485c371942
15 changed files with 72 additions and 63 deletions
|
|
@ -227,7 +227,7 @@ type
|
|||
# for interfacing with C++, JS
|
||||
sfNamedParamCall, # symbol needs named parameter call syntax in target
|
||||
# language; for interfacing with Objective C
|
||||
sfOptional # returned value may be discarded implicitely
|
||||
sfDiscardable # returned value may be discarded implicitely
|
||||
|
||||
TSymFlags* = set[TSymFlag]
|
||||
|
||||
|
|
|
|||
|
|
@ -23,15 +23,15 @@ const
|
|||
wMagic, wNosideEffect, wSideEffect, wNoreturn, wDynLib, wHeader,
|
||||
wCompilerProc, wProcVar, wDeprecated, wVarargs, wCompileTime, wMerge,
|
||||
wBorrow, wExtern, wImportCompilerProc, wThread, wImportCpp, wImportObjC,
|
||||
wNoStackFrame, wError, wOptional}
|
||||
wNoStackFrame, wError, wDiscardable}
|
||||
converterPragmas* = procPragmas
|
||||
methodPragmas* = procPragmas
|
||||
macroPragmas* = {FirstCallConv..LastCallConv, wImportc, wExportc, wNodecl,
|
||||
wMagic, wNosideEffect, wCompilerProc, wDeprecated, wExtern,
|
||||
wImportcpp, wImportobjc, wError, wOptional}
|
||||
wImportcpp, wImportobjc, wError, wDiscardable}
|
||||
iteratorPragmas* = {FirstCallConv..LastCallConv, wNosideEffect, wSideEffect,
|
||||
wImportc, wExportc, wNodecl, wMagic, wDeprecated, wBorrow, wExtern,
|
||||
wImportcpp, wImportobjc, wError, wOptional}
|
||||
wImportcpp, wImportobjc, wError, wDiscardable}
|
||||
stmtPragmas* = {wChecks, wObjChecks, wFieldChecks, wRangechecks, wBoundchecks,
|
||||
wOverflowchecks, wNilchecks, wAssertions, wWarnings, wHints, wLinedir,
|
||||
wStacktrace, wLinetrace, wOptimization, wHint, wWarning, wError, wFatal,
|
||||
|
|
@ -553,9 +553,9 @@ proc pragma(c: PContext, sym: PSym, n: PNode, validPragmas: TSpecialWords) =
|
|||
of wPragma:
|
||||
processPragma(c, n, i)
|
||||
break
|
||||
of wOptional:
|
||||
of wDiscardable:
|
||||
noVal(it)
|
||||
if sym != nil: incl(sym.flags, sfOptional)
|
||||
if sym != nil: incl(sym.flags, sfDiscardable)
|
||||
of wChecks, wObjChecks, wFieldChecks, wRangechecks, wBoundchecks,
|
||||
wOverflowchecks, wNilchecks, wAssertions, wWarnings, wHints,
|
||||
wLinedir, wStacktrace, wLinetrace, wOptimization, wByRef,
|
||||
|
|
|
|||
|
|
@ -550,7 +550,7 @@ proc buildEchoStmt(c: PContext, n: PNode): PNode =
|
|||
proc semExprNoType(c: PContext, n: PNode): PNode =
|
||||
proc ImplicitelyDiscardable(n: PNode): bool {.inline.} =
|
||||
result = isCallExpr(n) and n.sons[0].kind == nkSym and
|
||||
sfOptional in n.sons[0].sym.flags
|
||||
sfDiscardable in n.sons[0].sym.flags
|
||||
result = semExpr(c, n)
|
||||
if result.typ != nil and result.typ.kind != tyStmt:
|
||||
if gCmd == cmdInteractive:
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ type
|
|||
wDeadCodeElim, wSafecode,
|
||||
wPragma,
|
||||
wCompileTime,
|
||||
wPassc, wPassl, wBorrow, wOptional,
|
||||
wPassc, wPassl, wBorrow, wDiscardable,
|
||||
wFieldChecks,
|
||||
wCheckPoint, wSubsChar,
|
||||
wAcyclic, wShallow, wUnroll, wLinearScanEnd,
|
||||
|
|
@ -96,7 +96,7 @@ const
|
|||
"deadcodeelim", "safecode",
|
||||
"pragma",
|
||||
"compiletime",
|
||||
"passc", "passl", "borrow", "optional", "fieldchecks",
|
||||
"passc", "passl", "borrow", "discardable", "fieldchecks",
|
||||
"checkpoint",
|
||||
"subschar", "acyclic", "shallow", "unroll", "linearscanend",
|
||||
"write", "putenv", "prependenv", "appendenv", "threadvar", "emit",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue