use two spaces indentation (#19696)

This commit is contained in:
flywind 2022-04-07 13:07:39 +08:00 • committed by GitHub
commit 0978276ed9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1505,20 +1505,20 @@ macro expandMacros*(body: typed): untyped =
result = body result = body
proc extractTypeImpl(n: NimNode): NimNode = proc extractTypeImpl(n: NimNode): NimNode =
## attempts to extract the type definition of the given symbol ## attempts to extract the type definition of the given symbol
case n.kind case n.kind
of nnkSym: # can extract an impl of nnkSym: # can extract an impl
result = n.getImpl.extractTypeImpl() result = n.getImpl.extractTypeImpl()
of nnkObjectTy, nnkRefTy, nnkPtrTy: result = n of nnkObjectTy, nnkRefTy, nnkPtrTy: result = n
of nnkBracketExpr: of nnkBracketExpr:
if n.typeKind == ntyTypeDesc: if n.typeKind == ntyTypeDesc:
result = n[1].extractTypeImpl() result = n[1].extractTypeImpl()
else: else:
doAssert n.typeKind == ntyGenericInst doAssert n.typeKind == ntyGenericInst
result = n[0].getImpl() result = n[0].getImpl()
of nnkTypeDef: of nnkTypeDef:
result = n[2] result = n[2]
else: error("Invalid node to retrieve type implementation of: " & $n.kind) else: error("Invalid node to retrieve type implementation of: " & $n.kind)
proc customPragmaNode(n: NimNode): NimNode = proc customPragmaNode(n: NimNode): NimNode =
expectKind(n, {nnkSym, nnkDotExpr, nnkBracketExpr, nnkTypeOfExpr, nnkCheckedFieldExpr}) expectKind(n, {nnkSym, nnkDotExpr, nnkBracketExpr, nnkTypeOfExpr, nnkCheckedFieldExpr})