Remove broken patterns example
This commit is contained in:
parent
66f435a279
commit
73d29da071
|
@ -178,17 +178,7 @@ proc match(bindings: sink openArray[(int, Pattern)]; i: int; pat: var Pattern):
|
|||
|
||||
proc grab*(typ: static typedesc; bindings: sink openArray[(int, Pattern)]): Pattern =
|
||||
## Construct a `Pattern` from type `typ` that selectively captures fields.
|
||||
runnableExamples:
|
||||
import preserves
|
||||
from std/unittest import check
|
||||
type
|
||||
Point = tuple[x: int; y: int]
|
||||
Rect {.preservesRecord: "rect".} = tuple[a: Point; B: Point]
|
||||
ColoredRect {.preservesDictionary.} = tuple[color: string; rect: Rect]
|
||||
check:
|
||||
$grab(Point, { 1: grab() }) == "<arr [<_> <bind <_>>]>"
|
||||
$grab(Rect, { 0: grab() }) == "<rec rect [<bind <_>> <arr [<_> <_>]>]>"
|
||||
when typ is ref:
|
||||
when typ is ptr | ref:
|
||||
grab(pointerBase(typ), bindings)
|
||||
elif typ.hasPreservesRecordPragma:
|
||||
var rec = DCompoundRec(label: typ.recordLabel.tosymbol(Cap))
|
||||
|
|
Loading…
Reference in New Issue