fix deprecated example (#18721)

This commit is contained in:
flywind
2021-08-21 14:22:00 +08:00
committed by GitHub
parent f0c6593412
commit 5b26f2bd81
2 changed files with 27 additions and 11 deletions

View File

@@ -1082,7 +1082,7 @@ its entirety to see some of the complexities.
Concrete syntax:
.. code-block:: nim
type Obj[T] = object {.inheritable.}
type Obj[T] {.inheritable.} = object
name: string
case isFat: bool
of true:
@@ -1094,10 +1094,18 @@ AST:
.. code-block:: nim
# ...
nnkPragmaExpr(
nnkIdent("Obj"),
nnkPragma(nnkIdent("inheritable"))
),
nnkGenericParams(
nnkIdentDefs(
nnkIdent("T"),
nnkEmpty(),
nnkEmpty())
),
nnkObjectTy(
nnkPragma(
nnkIdent("inheritable")
),
nnkEmpty(),
nnkEmpty(),
nnkRecList( # list of object parameters
nnkIdentDefs(