From 7e747d11c66405f08cc7c69e5afc18348663275e Mon Sep 17 00:00:00 2001 From: Clyybber Date: Thu, 28 Nov 2019 17:13:04 +0100 Subject: Cosmetic compiler cleanup (#12718) * Cleanup compiler code base * Unify add calls * Unify len invocations * Unify range operators * Fix oversight * Remove {.procvar.} pragma * initCandidate -> newCandidate where reasonable * Unify safeLen calls --- compiler/evalffi.nim | 112 +++++++++++++++++++++++++-------------------------- 1 file changed, 56 insertions(+), 56 deletions(-) (limited to 'compiler/evalffi.nim') diff --git a/compiler/evalffi.nim b/compiler/evalffi.nim index 6b9346c64..543810886 100644 --- a/compiler/evalffi.nim +++ b/compiler/evalffi.nim @@ -94,7 +94,7 @@ proc mapType(conf: ConfigRef, t: ast.PType): ptr libffi.TType = tyTyped, tyTypeDesc, tyProc, tyArray, tyStatic, tyNil: result = addr libffi.type_pointer of tyDistinct, tyAlias, tySink: - result = mapType(conf, t.sons[0]) + result = mapType(conf, t[0]) else: result = nil # too risky: @@ -120,16 +120,16 @@ proc packSize(conf: ConfigRef, v: PNode, typ: PType): int = if v.kind in {nkNilLit, nkPtrLit}: result = sizeof(pointer) else: - result = sizeof(pointer) + packSize(conf, v.sons[0], typ.lastSon) + result = sizeof(pointer) + packSize(conf, v[0], typ.lastSon) of tyDistinct, tyGenericInst, tyAlias, tySink: - result = packSize(conf, v, typ.sons[0]) + result = packSize(conf, v, typ[0]) of tyArray: # consider: ptr array[0..1000_000, int] which is common for interfacing; # we use the real length here instead if v.kind in {nkNilLit, nkPtrLit}: result = sizeof(pointer) elif v.len != 0: - result = v.len * packSize(conf, v.sons[0], typ.sons[1]) + result = v.len * packSize(conf, v[0], typ[1]) else: result = getSize(conf, typ).int @@ -138,16 +138,16 @@ 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 0 ..< len(n): - result = getField(conf, n.sons[i], position) + for i in 0..