parent
a9a9860b0b
commit
ccccd30cf6
2 changed files with 45 additions and 47 deletions
|
|
@ -367,7 +367,7 @@ func contains*(pattern: CaptureBounds, name: string): bool =
|
||||||
func contains*(pattern: Captures, name: string): bool =
|
func contains*(pattern: Captures, name: string): bool =
|
||||||
name in CaptureBounds(pattern)
|
name in CaptureBounds(pattern)
|
||||||
|
|
||||||
func checkNamedCaptured(pattern: RegexMatch, name: string): void =
|
func checkNamedCaptured(pattern: RegexMatch, name: string) =
|
||||||
if not (name in pattern.captureBounds):
|
if not (name in pattern.captureBounds):
|
||||||
raise newException(KeyError, "Group '" & name & "' was not captured")
|
raise newException(KeyError, "Group '" & name & "' was not captured")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -117,13 +117,10 @@ macro genericParamsImpl(T: typedesc): untyped =
|
||||||
case impl.kind
|
case impl.kind
|
||||||
of nnkSym:
|
of nnkSym:
|
||||||
impl = impl.getImpl
|
impl = impl.getImpl
|
||||||
continue
|
|
||||||
of nnkTypeDef:
|
of nnkTypeDef:
|
||||||
impl = impl[2]
|
impl = impl[2]
|
||||||
continue
|
|
||||||
of nnkTypeOfExpr:
|
of nnkTypeOfExpr:
|
||||||
impl = getTypeInst(impl[0])
|
impl = getTypeInst(impl[0])
|
||||||
continue
|
|
||||||
of nnkBracketExpr:
|
of nnkBracketExpr:
|
||||||
for i in 1..<impl.len:
|
for i in 1..<impl.len:
|
||||||
let ai = impl[i]
|
let ai = impl[i]
|
||||||
|
|
@ -137,7 +134,7 @@ macro genericParamsImpl(T: typedesc): untyped =
|
||||||
# If so, use it directly instead of wrapping it in StaticParam.
|
# If so, use it directly instead of wrapping it in StaticParam.
|
||||||
if (ai.kind == nnkSym and ai.symKind == nskType) or
|
if (ai.kind == nnkSym and ai.symKind == nskType) or
|
||||||
(ai.kind == nnkBracketExpr and ai[0].kind == nnkSym and
|
(ai.kind == nnkBracketExpr and ai[0].kind == nnkSym and
|
||||||
ai[0].symKind == nskType):
|
ai[0].symKind == nskType) or ai.kind in {nnkRefTy, nnkVarTy, nnkPtrTy, nnkProcTy}:
|
||||||
ret = ai
|
ret = ai
|
||||||
elif ai.kind == nnkInfix and ai[0].kind == nnkIdent and
|
elif ai.kind == nnkInfix and ai[0].kind == nnkIdent and
|
||||||
ai[0].strVal == "..":
|
ai[0].strVal == "..":
|
||||||
|
|
@ -158,6 +155,7 @@ macro genericParamsImpl(T: typedesc): untyped =
|
||||||
ret = newTree(nnkBracketExpr, @[bindSym"range", ai])
|
ret = newTree(nnkBracketExpr, @[bindSym"range", ai])
|
||||||
else:
|
else:
|
||||||
since (1, 1):
|
since (1, 1):
|
||||||
|
echo ai.typeKind
|
||||||
ret = newTree(nnkBracketExpr, @[bindSym"StaticParam", ai])
|
ret = newTree(nnkBracketExpr, @[bindSym"StaticParam", ai])
|
||||||
result.add ret
|
result.add ret
|
||||||
break
|
break
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue