diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2019-05-08 17:18:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-08 17:18:46 +0200 |
commit | 61380d0a070a4a691e820e18b25e9dd8fb420306 (patch) | |
tree | a786b6ba0f9e831fecfb75de2a5c3d097a24a962 /compiler/evalffi.nim | |
parent | 8180d443b9938f135dd280bcd5e1727766cd7468 (diff) | |
parent | cc28eef38e601171644ffe1a2775744eaaca8123 (diff) | |
download | Nim-61380d0a070a4a691e820e18b25e9dd8fb420306.tar.gz |
Small cleanup (#11185)
* Remove mStaticTy and mTypeTy * Replace countup(x, y-1) with x ..< y * Replace countup(x, y) with x .. y
Diffstat (limited to 'compiler/evalffi.nim')
-rw-r--r-- | compiler/evalffi.nim | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/evalffi.nim b/compiler/evalffi.nim index ab5745787..9b2a4f93c 100644 --- a/compiler/evalffi.nim +++ b/compiler/evalffi.nim @@ -138,13 +138,13 @@ proc pack(conf: ConfigRef, v: PNode, typ: PType, res: pointer) proc getField(conf: ConfigRef, n: PNode; position: int): PSym = case n.kind of nkRecList: - for i in countup(0, sonsLen(n) - 1): + for i in 0 ..< sonsLen(n): result = getField(conf, n.sons[i], position) if result != nil: return of nkRecCase: result = getField(conf, n.sons[0], position) if result != nil: return - for i in countup(1, sonsLen(n) - 1): + for i in 1 ..< sonsLen(n): case n.sons[i].kind of nkOfBranch, nkElse: result = getField(conf, lastSon(n.sons[i]), position) @@ -158,7 +158,7 @@ proc packObject(conf: ConfigRef, x: PNode, typ: PType, res: pointer) = internalAssert conf, x.kind in {nkObjConstr, nkPar, nkTupleConstr} # compute the field's offsets: discard getSize(conf, typ) - for i in countup(ord(x.kind == nkObjConstr), sonsLen(x) - 1): + for i in ord(x.kind == nkObjConstr) ..< sonsLen(x): var it = x.sons[i] if it.kind == nkExprColonExpr: internalAssert conf, it.sons[0].kind == nkSym @@ -245,7 +245,7 @@ proc unpack(conf: ConfigRef, x: pointer, typ: PType, n: PNode): PNode proc unpackObjectAdd(conf: ConfigRef, x: pointer, n, result: PNode) = case n.kind of nkRecList: - for i in countup(0, sonsLen(n) - 1): + for i in 0 ..< sonsLen(n): unpackObjectAdd(conf, x, n.sons[i], result) of nkRecCase: globalError(conf, result.info, "case objects cannot be unpacked") @@ -275,7 +275,7 @@ proc unpackObject(conf: ConfigRef, x: pointer, typ: PType, n: PNode): PNode = globalError(conf, n.info, "cannot map value from FFI") if typ.n.isNil: globalError(conf, n.info, "cannot unpack unnamed tuple") - for i in countup(ord(n.kind == nkObjConstr), sonsLen(n) - 1): + for i in ord(n.kind == nkObjConstr) ..< sonsLen(n): var it = n.sons[i] if it.kind == nkExprColonExpr: internalAssert conf, it.sons[0].kind == nkSym |