Markdown code blocks part 6 (#20292)
This commit is contained in:
parent
fb2773411e
commit
0f555110e6
6 changed files with 365 additions and 357 deletions
|
|
@ -227,11 +227,10 @@ proc getNamedParamFromList*(list: PNode, ident: PIdent): PSym =
|
|||
## Named parameters are special because a named parameter can be
|
||||
## gensym'ed and then they have '\`<number>' suffix that we need to
|
||||
## ignore, see compiler / evaltempl.nim, snippet:
|
||||
##
|
||||
## .. code-block:: nim
|
||||
##
|
||||
## ```
|
||||
## result.add newIdentNode(getIdent(c.ic, x.name.s & "\`gensym" & $x.id),
|
||||
## if c.instLines: actual.info else: templ.info)
|
||||
## ```
|
||||
for i in 1..<list.len:
|
||||
let it = list[i].sym
|
||||
if it.name.id == ident.id or
|
||||
|
|
|
|||
|
|
@ -550,11 +550,10 @@ proc inconsistentVarTypes(f, a: PType): bool {.inline.} =
|
|||
|
||||
proc procParamTypeRel(c: var TCandidate, f, a: PType): TTypeRelation =
|
||||
## For example we have:
|
||||
##
|
||||
## .. code-block:: nim
|
||||
## ```
|
||||
## proc myMap[T,S](sIn: seq[T], f: proc(x: T): S): seq[S] = ...
|
||||
## proc innerProc[Q,W](q: Q): W = ...
|
||||
##
|
||||
## ```
|
||||
## And we want to match: myMap(@[1,2,3], innerProc)
|
||||
## This proc (procParamTypeRel) will do the following steps in
|
||||
## three different calls:
|
||||
|
|
|
|||
|
|
@ -15,11 +15,10 @@
|
|||
# this doesn't matter. However it matters for strings and other complex
|
||||
# types that use the 'node' field; the reason is that slots are
|
||||
# re-used in a register based VM. Example:
|
||||
#
|
||||
#.. code-block:: nim
|
||||
# let s = a & b # no matter what, create fresh node
|
||||
# s = a & b # no matter what, keep the node
|
||||
#
|
||||
# ```nim
|
||||
# let s = a & b # no matter what, create fresh node
|
||||
# s = a & b # no matter what, keep the node
|
||||
# ```
|
||||
# Also *stores* into non-temporary memory need to perform deep copies:
|
||||
# a.b = x.y
|
||||
# We used to generate opcAsgn for the *load* of 'x.y' but this is clearly
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue