introduce temporary <//> for 'owned' to get this compile with 0.19 (#11145)
* introduce temporary <//> for 'owned' to get this compile with 0.19 * make newTable[string, owned Node]() compile (but it crashes) * make sink/owned parameters consistent * make actiontable test compile again * VM: support sytem.move; makes tests green
This commit is contained in:
parent
c94ab46923
commit
e1515b53d1
9 changed files with 69 additions and 46 deletions
|
|
@ -426,11 +426,13 @@ proc sinkParamIsLastReadCheck(c: var Con, s: PNode) =
|
||||||
proc isSinkTypeForParam(t: PType): bool =
|
proc isSinkTypeForParam(t: PType): bool =
|
||||||
# a parameter like 'seq[owned T]' must not be used only once, but its
|
# a parameter like 'seq[owned T]' must not be used only once, but its
|
||||||
# elements must, so we detect this case here:
|
# elements must, so we detect this case here:
|
||||||
if isSinkType(t):
|
result = t.skipTypes({tyGenericInst, tyAlias}).kind in {tySink, tyOwned}
|
||||||
if t.skipTypes({tyGenericInst, tyAlias}).kind in {tyArray, tyVarargs, tyOpenArray, tySequence}:
|
when false:
|
||||||
result = false
|
if isSinkType(t):
|
||||||
else:
|
if t.skipTypes({tyGenericInst, tyAlias}).kind in {tyArray, tyVarargs, tyOpenArray, tySequence}:
|
||||||
result = true
|
result = false
|
||||||
|
else:
|
||||||
|
result = true
|
||||||
|
|
||||||
proc passCopyToSink(n: PNode; c: var Con): PNode =
|
proc passCopyToSink(n: PNode; c: var Con): PNode =
|
||||||
result = newNodeIT(nkStmtListExpr, n.info, n.typ)
|
result = newNodeIT(nkStmtListExpr, n.info, n.typ)
|
||||||
|
|
@ -817,7 +819,7 @@ proc injectDestructorCalls*(g: ModuleGraph; owner: PSym; n: PNode): PNode =
|
||||||
let params = owner.typ.n
|
let params = owner.typ.n
|
||||||
for i in 1 ..< params.len:
|
for i in 1 ..< params.len:
|
||||||
let param = params[i].sym
|
let param = params[i].sym
|
||||||
if isSinkParam(param) and hasDestructor(param.typ.skipTypes({tySink})):
|
if isSinkTypeForParam(param.typ) and hasDestructor(param.typ.skipTypes({tySink})):
|
||||||
c.addDestroy genDestroy(c, param.typ.skipTypes({tyGenericInst, tyAlias, tySink}), params[i])
|
c.addDestroy genDestroy(c, param.typ.skipTypes({tyGenericInst, tyAlias, tySink}), params[i])
|
||||||
|
|
||||||
#if optNimV2 in c.graph.config.globalOptions:
|
#if optNimV2 in c.graph.config.globalOptions:
|
||||||
|
|
|
||||||
|
|
@ -527,7 +527,7 @@ proc isNoEffectList(n: PNode): bool {.inline.} =
|
||||||
n.len == 0 or (n[tagEffects] == nil and n[exceptionEffects] == nil)
|
n.len == 0 or (n[tagEffects] == nil and n[exceptionEffects] == nil)
|
||||||
|
|
||||||
proc isTrival(caller: PNode): bool {.inline.} =
|
proc isTrival(caller: PNode): bool {.inline.} =
|
||||||
result = caller.kind == nkSym and caller.sym.magic in {mEqProc, mIsNil}
|
result = caller.kind == nkSym and caller.sym.magic in {mEqProc, mIsNil, mMove, mWasMoved}
|
||||||
|
|
||||||
proc trackOperand(tracked: PEffects, n: PNode, paramType: PType; caller: PNode) =
|
proc trackOperand(tracked: PEffects, n: PNode, paramType: PType; caller: PNode) =
|
||||||
let a = skipConvAndClosure(n)
|
let a = skipConvAndClosure(n)
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ proc isDeepConstExpr*(n: PNode): bool =
|
||||||
if not isDeepConstExpr(n.sons[i]): return false
|
if not isDeepConstExpr(n.sons[i]): return false
|
||||||
if n.typ.isNil: result = true
|
if n.typ.isNil: result = true
|
||||||
else:
|
else:
|
||||||
let t = n.typ.skipTypes({tyGenericInst, tyDistinct, tyAlias, tySink})
|
let t = n.typ.skipTypes({tyGenericInst, tyDistinct, tyAlias, tySink, tyOwned})
|
||||||
if t.kind in {tyRef, tyPtr}: return false
|
if t.kind in {tyRef, tyPtr}: return false
|
||||||
if t.kind != tyObject or not isCaseObj(t.n):
|
if t.kind != tyObject or not isCaseObj(t.n):
|
||||||
result = true
|
result = true
|
||||||
|
|
|
||||||
|
|
@ -931,6 +931,21 @@ proc ldNullOpcode(t: PType): TOpcode =
|
||||||
assert t != nil
|
assert t != nil
|
||||||
if fitsRegister(t): opcLdNullReg else: opcLdNull
|
if fitsRegister(t): opcLdNullReg else: opcLdNull
|
||||||
|
|
||||||
|
proc whichAsgnOpc(n: PNode): TOpcode =
|
||||||
|
case n.typ.skipTypes(abstractRange+{tyOwned}-{tyTypeDesc}).kind
|
||||||
|
of tyBool, tyChar, tyEnum, tyOrdinal, tyInt..tyInt64, tyUInt..tyUInt64:
|
||||||
|
opcAsgnInt
|
||||||
|
of tyString, tyCString:
|
||||||
|
opcAsgnStr
|
||||||
|
of tyFloat..tyFloat128:
|
||||||
|
opcAsgnFloat
|
||||||
|
of tyRef, tyNil, tyVar, tyLent, tyPtr:
|
||||||
|
opcAsgnRef
|
||||||
|
else:
|
||||||
|
opcAsgnComplex
|
||||||
|
|
||||||
|
proc whichAsgnOpc(n: PNode; opc: TOpcode): TOpcode = opc
|
||||||
|
|
||||||
proc genMagic(c: PCtx; n: PNode; dest: var TDest; m: TMagic) =
|
proc genMagic(c: PCtx; n: PNode; dest: var TDest; m: TMagic) =
|
||||||
case m
|
case m
|
||||||
of mAnd: c.genAndOr(n, opcFJmp, dest)
|
of mAnd: c.genAndOr(n, opcFJmp, dest)
|
||||||
|
|
@ -1330,6 +1345,17 @@ proc genMagic(c: PCtx; n: PNode; dest: var TDest; m: TMagic) =
|
||||||
of mRunnableExamples:
|
of mRunnableExamples:
|
||||||
discard "just ignore any call to runnableExamples"
|
discard "just ignore any call to runnableExamples"
|
||||||
of mDestroy: discard "ignore calls to the default destructor"
|
of mDestroy: discard "ignore calls to the default destructor"
|
||||||
|
of mMove:
|
||||||
|
let arg = n[1]
|
||||||
|
let a = c.genx(arg)
|
||||||
|
assert dest >= 0
|
||||||
|
if dest < 0: dest = c.getTemp(arg.typ)
|
||||||
|
gABC(c, arg, whichAsgnOpc(arg), dest, a, 1)
|
||||||
|
# XXX use ldNullOpcode() here?
|
||||||
|
c.gABx(n, opcLdNull, a, c.genType(arg.typ))
|
||||||
|
c.gABx(n, opcNodeToReg, a, a)
|
||||||
|
c.genAsgnPatch(arg, a)
|
||||||
|
c.freeTemp(a)
|
||||||
else:
|
else:
|
||||||
# mGCref, mGCunref,
|
# mGCref, mGCunref,
|
||||||
globalError(c.config, n.info, "cannot generate code for: " & $m)
|
globalError(c.config, n.info, "cannot generate code for: " & $m)
|
||||||
|
|
@ -1423,21 +1449,6 @@ proc genDeref(c: PCtx, n: PNode, dest: var TDest, flags: TGenFlags) =
|
||||||
if {gfNodeAddr, gfNode} * flags == {} and fitsRegister(n.typ):
|
if {gfNodeAddr, gfNode} * flags == {} and fitsRegister(n.typ):
|
||||||
c.gABC(n, opcNodeToReg, dest, dest)
|
c.gABC(n, opcNodeToReg, dest, dest)
|
||||||
|
|
||||||
proc whichAsgnOpc(n: PNode): TOpcode =
|
|
||||||
case n.typ.skipTypes(abstractRange+{tyOwned}-{tyTypeDesc}).kind
|
|
||||||
of tyBool, tyChar, tyEnum, tyOrdinal, tyInt..tyInt64, tyUInt..tyUInt64:
|
|
||||||
opcAsgnInt
|
|
||||||
of tyString, tyCString:
|
|
||||||
opcAsgnStr
|
|
||||||
of tyFloat..tyFloat128:
|
|
||||||
opcAsgnFloat
|
|
||||||
of tyRef, tyNil, tyVar, tyLent, tyPtr:
|
|
||||||
opcAsgnRef
|
|
||||||
else:
|
|
||||||
opcAsgnComplex
|
|
||||||
|
|
||||||
proc whichAsgnOpc(n: PNode; opc: TOpcode): TOpcode = opc
|
|
||||||
|
|
||||||
proc genAsgn(c: PCtx; dest: TDest; ri: PNode; requiresCopy: bool) =
|
proc genAsgn(c: PCtx; dest: TDest; ri: PNode; requiresCopy: bool) =
|
||||||
let tmp = c.genx(ri)
|
let tmp = c.genx(ri)
|
||||||
assert dest >= 0
|
assert dest >= 0
|
||||||
|
|
|
||||||
|
|
@ -80,14 +80,15 @@ type
|
||||||
DoublyLinkedNodeObj*[T] = object ## A node a doubly linked list consists of.
|
DoublyLinkedNodeObj*[T] = object ## A node a doubly linked list consists of.
|
||||||
##
|
##
|
||||||
## It consists of a `value` field, and pointers to `next` and `prev`.
|
## It consists of a `value` field, and pointers to `next` and `prev`.
|
||||||
next*, prev*: ref DoublyLinkedNodeObj[T]
|
next*: <//>(ref DoublyLinkedNodeObj[T])
|
||||||
|
prev*: ref DoublyLinkedNodeObj[T]
|
||||||
value*: T
|
value*: T
|
||||||
DoublyLinkedNode*[T] = ref DoublyLinkedNodeObj[T]
|
DoublyLinkedNode*[T] = ref DoublyLinkedNodeObj[T]
|
||||||
|
|
||||||
SinglyLinkedNodeObj*[T] = object ## A node a singly linked list consists of.
|
SinglyLinkedNodeObj*[T] = object ## A node a singly linked list consists of.
|
||||||
##
|
##
|
||||||
## It consists of a `value` field, and a pointer to `next`.
|
## It consists of a `value` field, and a pointer to `next`.
|
||||||
next*: ref SinglyLinkedNodeObj[T]
|
next*: <//>(ref SinglyLinkedNodeObj[T])
|
||||||
value*: T
|
value*: T
|
||||||
SinglyLinkedNode*[T] = ref SinglyLinkedNodeObj[T]
|
SinglyLinkedNode*[T] = ref SinglyLinkedNodeObj[T]
|
||||||
|
|
||||||
|
|
@ -95,19 +96,22 @@ type
|
||||||
##
|
##
|
||||||
## Use `initSinglyLinkedList proc <#initSinglyLinkedList>`_ to create
|
## Use `initSinglyLinkedList proc <#initSinglyLinkedList>`_ to create
|
||||||
## a new empty list.
|
## a new empty list.
|
||||||
head*, tail*: SinglyLinkedNode[T]
|
head*: <//>(SinglyLinkedNode[T])
|
||||||
|
tail*: SinglyLinkedNode[T]
|
||||||
|
|
||||||
DoublyLinkedList*[T] = object ## A doubly linked list.
|
DoublyLinkedList*[T] = object ## A doubly linked list.
|
||||||
##
|
##
|
||||||
## Use `initDoublyLinkedList proc <#initDoublyLinkedList>`_ to create
|
## Use `initDoublyLinkedList proc <#initDoublyLinkedList>`_ to create
|
||||||
## a new empty list.
|
## a new empty list.
|
||||||
head*, tail*: DoublyLinkedNode[T]
|
head*: <//>(DoublyLinkedNode[T])
|
||||||
|
tail*: DoublyLinkedNode[T]
|
||||||
|
|
||||||
SinglyLinkedRing*[T] = object ## A singly linked ring.
|
SinglyLinkedRing*[T] = object ## A singly linked ring.
|
||||||
##
|
##
|
||||||
## Use `initSinglyLinkedRing proc <#initSinglyLinkedRing>`_ to create
|
## Use `initSinglyLinkedRing proc <#initSinglyLinkedRing>`_ to create
|
||||||
## a new empty ring.
|
## a new empty ring.
|
||||||
head*, tail*: SinglyLinkedNode[T]
|
head*: <//>(SinglyLinkedNode[T])
|
||||||
|
tail*: SinglyLinkedNode[T]
|
||||||
|
|
||||||
DoublyLinkedRing*[T] = object ## A doubly linked ring.
|
DoublyLinkedRing*[T] = object ## A doubly linked ring.
|
||||||
##
|
##
|
||||||
|
|
@ -147,7 +151,7 @@ proc initDoublyLinkedRing*[T](): DoublyLinkedRing[T] =
|
||||||
var a = initDoublyLinkedRing[int]()
|
var a = initDoublyLinkedRing[int]()
|
||||||
discard
|
discard
|
||||||
|
|
||||||
proc newDoublyLinkedNode*[T](value: T): DoublyLinkedNode[T] =
|
proc newDoublyLinkedNode*[T](value: T): <//>(DoublyLinkedNode[T]) =
|
||||||
## Creates a new doubly linked node with the given `value`.
|
## Creates a new doubly linked node with the given `value`.
|
||||||
runnableExamples:
|
runnableExamples:
|
||||||
var n = newDoublyLinkedNode[int](5)
|
var n = newDoublyLinkedNode[int](5)
|
||||||
|
|
@ -156,7 +160,7 @@ proc newDoublyLinkedNode*[T](value: T): DoublyLinkedNode[T] =
|
||||||
new(result)
|
new(result)
|
||||||
result.value = value
|
result.value = value
|
||||||
|
|
||||||
proc newSinglyLinkedNode*[T](value: T): SinglyLinkedNode[T] =
|
proc newSinglyLinkedNode*[T](value: T): <//>(SinglyLinkedNode[T]) =
|
||||||
## Creates a new singly linked node with the given `value`.
|
## Creates a new singly linked node with the given `value`.
|
||||||
runnableExamples:
|
runnableExamples:
|
||||||
var n = newSinglyLinkedNode[int](5)
|
var n = newSinglyLinkedNode[int](5)
|
||||||
|
|
|
||||||
|
|
@ -274,7 +274,7 @@ proc enlarge[A, B](t: var Table[A, B]) =
|
||||||
var j: Hash = eh and maxHash(t)
|
var j: Hash = eh and maxHash(t)
|
||||||
while isFilled(t.data[j].hcode):
|
while isFilled(t.data[j].hcode):
|
||||||
j = nextTry(j, maxHash(t))
|
j = nextTry(j, maxHash(t))
|
||||||
rawInsert(t, t.data, n[i].key, n[i].val, eh, j)
|
rawInsert(t, t.data, move n[i].key, move n[i].val, eh, j)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -768,7 +768,7 @@ iterator allValues*[A, B](t: Table[A, B]; key: A): B =
|
||||||
# -------------------------------------------------------------------
|
# -------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
proc newTable*[A, B](initialsize = defaultInitialSize): TableRef[A, B] =
|
proc newTable*[A, B](initialsize = defaultInitialSize): <//>TableRef[A, B] =
|
||||||
## Creates a new ref hash table that is empty.
|
## Creates a new ref hash table that is empty.
|
||||||
##
|
##
|
||||||
## ``initialSize`` must be a power of two (default: 64).
|
## ``initialSize`` must be a power of two (default: 64).
|
||||||
|
|
@ -789,7 +789,7 @@ proc newTable*[A, B](initialsize = defaultInitialSize): TableRef[A, B] =
|
||||||
new(result)
|
new(result)
|
||||||
result[] = initTable[A, B](initialSize)
|
result[] = initTable[A, B](initialSize)
|
||||||
|
|
||||||
proc newTable*[A, B](pairs: openArray[(A, B)]): TableRef[A, B] =
|
proc newTable*[A, B](pairs: openArray[(A, B)]): <//>TableRef[A, B] =
|
||||||
## Creates a new ref hash table that contains the given ``pairs``.
|
## Creates a new ref hash table that contains the given ``pairs``.
|
||||||
##
|
##
|
||||||
## ``pairs`` is a container consisting of ``(key, value)`` tuples.
|
## ``pairs`` is a container consisting of ``(key, value)`` tuples.
|
||||||
|
|
@ -805,7 +805,7 @@ proc newTable*[A, B](pairs: openArray[(A, B)]): TableRef[A, B] =
|
||||||
new(result)
|
new(result)
|
||||||
result[] = toTable[A, B](pairs)
|
result[] = toTable[A, B](pairs)
|
||||||
|
|
||||||
proc newTableFrom*[A, B, C](collection: A, index: proc(x: B): C): TableRef[C, B] =
|
proc newTableFrom*[A, B, C](collection: A, index: proc(x: B): C): <//>TableRef[C, B] =
|
||||||
## Index the collection with the proc provided.
|
## Index the collection with the proc provided.
|
||||||
# TODO: As soon as supported, change collection: A to collection: A[B]
|
# TODO: As soon as supported, change collection: A to collection: A[B]
|
||||||
result = newTable[C, B]()
|
result = newTable[C, B]()
|
||||||
|
|
@ -1690,7 +1690,7 @@ iterator mvalues*[A, B](t: var OrderedTable[A, B]): var B =
|
||||||
# --------------------------- OrderedTableRef -------------------------------
|
# --------------------------- OrderedTableRef -------------------------------
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
proc newOrderedTable*[A, B](initialsize = defaultInitialSize): OrderedTableRef[A, B] =
|
proc newOrderedTable*[A, B](initialsize = defaultInitialSize): <//>OrderedTableRef[A, B] =
|
||||||
## Creates a new ordered ref hash table that is empty.
|
## Creates a new ordered ref hash table that is empty.
|
||||||
##
|
##
|
||||||
## ``initialSize`` must be a power of two (default: 64).
|
## ``initialSize`` must be a power of two (default: 64).
|
||||||
|
|
@ -1711,7 +1711,7 @@ proc newOrderedTable*[A, B](initialsize = defaultInitialSize): OrderedTableRef[A
|
||||||
new(result)
|
new(result)
|
||||||
result[] = initOrderedTable[A, B](initialSize)
|
result[] = initOrderedTable[A, B](initialSize)
|
||||||
|
|
||||||
proc newOrderedTable*[A, B](pairs: openArray[(A, B)]): OrderedTableRef[A, B] =
|
proc newOrderedTable*[A, B](pairs: openArray[(A, B)]): <//>OrderedTableRef[A, B] =
|
||||||
## Creates a new ordered ref hash table that contains the given ``pairs``.
|
## Creates a new ordered ref hash table that contains the given ``pairs``.
|
||||||
##
|
##
|
||||||
## ``pairs`` is a container consisting of ``(key, value)`` tuples.
|
## ``pairs`` is a container consisting of ``(key, value)`` tuples.
|
||||||
|
|
@ -2412,7 +2412,7 @@ iterator mvalues*[A](t: var CountTable[A]): var int =
|
||||||
|
|
||||||
proc inc*[A](t: CountTableRef[A], key: A, val = 1)
|
proc inc*[A](t: CountTableRef[A], key: A, val = 1)
|
||||||
|
|
||||||
proc newCountTable*[A](initialsize = defaultInitialSize): CountTableRef[A] =
|
proc newCountTable*[A](initialsize = defaultInitialSize): <//>CountTableRef[A] =
|
||||||
## Creates a new ref count table that is empty.
|
## Creates a new ref count table that is empty.
|
||||||
##
|
##
|
||||||
## ``initialSize`` must be a power of two (default: 64).
|
## ``initialSize`` must be a power of two (default: 64).
|
||||||
|
|
@ -2429,7 +2429,7 @@ proc newCountTable*[A](initialsize = defaultInitialSize): CountTableRef[A] =
|
||||||
new(result)
|
new(result)
|
||||||
result[] = initCountTable[A](initialSize)
|
result[] = initCountTable[A](initialSize)
|
||||||
|
|
||||||
proc newCountTable*[A](keys: openArray[A]): CountTableRef[A] =
|
proc newCountTable*[A](keys: openArray[A]): <//>CountTableRef[A] =
|
||||||
## Creates a new ref count table with every member of a container ``keys``
|
## Creates a new ref count table with every member of a container ``keys``
|
||||||
## having a count of how many times it occurs in that container.
|
## having a count of how many times it occurs in that container.
|
||||||
result = newCountTable[A](rightSize(keys.len))
|
result = newCountTable[A](rightSize(keys.len))
|
||||||
|
|
|
||||||
|
|
@ -441,17 +441,17 @@ proc next*(c: var CfgParser): CfgEvent {.rtl, extern: "npc$1".} =
|
||||||
|
|
||||||
# ---------------- Configuration file related operations ----------------
|
# ---------------- Configuration file related operations ----------------
|
||||||
type
|
type
|
||||||
Config* = OrderedTableRef[string, OrderedTableRef[string, string]]
|
Config* = OrderedTableRef[string, <//>OrderedTableRef[string, string]]
|
||||||
|
|
||||||
proc newConfig*(): Config =
|
proc newConfig*(): Config =
|
||||||
## Create a new configuration table.
|
## Create a new configuration table.
|
||||||
## Useful when wanting to create a configuration file.
|
## Useful when wanting to create a configuration file.
|
||||||
result = newOrderedTable[string, OrderedTableRef[string, string]]()
|
result = newOrderedTable[string, <//>OrderedTableRef[string, string]]()
|
||||||
|
|
||||||
proc loadConfig*(stream: Stream, filename: string = "[stream]"): Config =
|
proc loadConfig*(stream: Stream, filename: string = "[stream]"): <//>Config =
|
||||||
## Load the specified configuration from stream into a new Config instance.
|
## Load the specified configuration from stream into a new Config instance.
|
||||||
## `filename` parameter is only used for nicer error messages.
|
## `filename` parameter is only used for nicer error messages.
|
||||||
var dict = newOrderedTable[string, OrderedTableRef[string, string]]()
|
var dict = newOrderedTable[string, <//>OrderedTableRef[string, string]]()
|
||||||
var curSection = "" ## Current section,
|
var curSection = "" ## Current section,
|
||||||
## the default value of the current section is "",
|
## the default value of the current section is "",
|
||||||
## which means that the current section is a common
|
## which means that the current section is a common
|
||||||
|
|
@ -481,7 +481,7 @@ proc loadConfig*(stream: Stream, filename: string = "[stream]"): Config =
|
||||||
close(p)
|
close(p)
|
||||||
result = dict
|
result = dict
|
||||||
|
|
||||||
proc loadConfig*(filename: string): Config =
|
proc loadConfig*(filename: string): <//>Config =
|
||||||
## Load the specified configuration file into a new Config instance.
|
## Load the specified configuration file into a new Config instance.
|
||||||
let file = open(filename, fmRead)
|
let file = open(filename, fmRead)
|
||||||
let fileStream = newFileStream(file)
|
let fileStream = newFileStream(file)
|
||||||
|
|
|
||||||
|
|
@ -177,13 +177,13 @@ proc addOutputFormatter*(formatter: OutputFormatter) =
|
||||||
formatters.add(formatter)
|
formatters.add(formatter)
|
||||||
|
|
||||||
proc newConsoleOutputFormatter*(outputLevel: OutputLevel = PRINT_ALL,
|
proc newConsoleOutputFormatter*(outputLevel: OutputLevel = PRINT_ALL,
|
||||||
colorOutput = true): ConsoleOutputFormatter =
|
colorOutput = true): <//>ConsoleOutputFormatter =
|
||||||
ConsoleOutputFormatter(
|
ConsoleOutputFormatter(
|
||||||
outputLevel: outputLevel,
|
outputLevel: outputLevel,
|
||||||
colorOutput: colorOutput
|
colorOutput: colorOutput
|
||||||
)
|
)
|
||||||
|
|
||||||
proc defaultConsoleFormatter*(): ConsoleOutputFormatter =
|
proc defaultConsoleFormatter*(): <//>ConsoleOutputFormatter =
|
||||||
when declared(stdout):
|
when declared(stdout):
|
||||||
# Reading settings
|
# Reading settings
|
||||||
# On a terminal this branch is executed
|
# On a terminal this branch is executed
|
||||||
|
|
@ -263,7 +263,7 @@ proc xmlEscape(s: string): string =
|
||||||
else:
|
else:
|
||||||
result.add(c)
|
result.add(c)
|
||||||
|
|
||||||
proc newJUnitOutputFormatter*(stream: Stream): JUnitOutputFormatter =
|
proc newJUnitOutputFormatter*(stream: Stream): <//>JUnitOutputFormatter =
|
||||||
## Creates a formatter that writes report to the specified stream in
|
## Creates a formatter that writes report to the specified stream in
|
||||||
## JUnit format.
|
## JUnit format.
|
||||||
## The ``stream`` is NOT closed automatically when the test are finished,
|
## The ``stream`` is NOT closed automatically when the test are finished,
|
||||||
|
|
|
||||||
|
|
@ -1641,6 +1641,9 @@ when defined(nimV2) and not defined(nimscript):
|
||||||
proc unown*[T](x: T): T {.magic: "Unown", noSideEffect.}
|
proc unown*[T](x: T): T {.magic: "Unown", noSideEffect.}
|
||||||
## Use the expression ``x`` ignoring its ownership attribute.
|
## Use the expression ``x`` ignoring its ownership attribute.
|
||||||
|
|
||||||
|
# This is only required to make 0.20 compile with the 0.19 line.
|
||||||
|
template `<//>`*(t: untyped): untyped = owned(t)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
template owned*(t: typeDesc): typedesc = t
|
template owned*(t: typeDesc): typedesc = t
|
||||||
template unown*(x: typed): typed = x
|
template unown*(x: typed): typed = x
|
||||||
|
|
@ -1662,6 +1665,9 @@ else:
|
||||||
new(r)
|
new(r)
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
# This is only required to make 0.20 compile with the 0.19 line.
|
||||||
|
template `<//>`*(t: untyped): untyped = t
|
||||||
|
|
||||||
template disarm*(x: typed) =
|
template disarm*(x: typed) =
|
||||||
## Useful for ``disarming`` dangling pointers explicitly for the
|
## Useful for ``disarming`` dangling pointers explicitly for the
|
||||||
## --newruntime. Regardless of whether --newruntime is used or not
|
## --newruntime. Regardless of whether --newruntime is used or not
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue