diff options
author | Zahary Karadjov <zahary@gmail.com> | 2020-03-27 15:47:49 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2020-04-01 19:38:44 +0200 |
commit | a8b6222c862d207a32c104699fc4f0f0a8bced17 (patch) | |
tree | 73c3d36d385758386d6dc8d4e0c449e3fda783ff /compiler/sempass2.nim | |
parent | 216fd59c44c7eb56431748389e3b2116692189a1 (diff) | |
download | Nim-a8b6222c862d207a32c104699fc4f0f0a8bced17.tar.gz |
First steps, the compiler can boot with enforced requiresInit
Diffstat (limited to 'compiler/sempass2.nim')
-rw-r--r-- | compiler/sempass2.nim | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/sempass2.nim b/compiler/sempass2.nim index 4658f5454..65dce3ed8 100644 --- a/compiler/sempass2.nim +++ b/compiler/sempass2.nim @@ -184,7 +184,7 @@ proc initVar(a: PEffects, n: PNode; volatileCheck: bool) = proc initVarViaNew(a: PEffects, n: PNode) = if n.kind != nkSym: return let s = n.sym - if {tfNeedsInit, tfNotNil} * s.typ.flags <= {tfNotNil}: + if {tfRequiresInit, tfNotNil} * s.typ.flags <= {tfNotNil}: # 'x' is not nil, but that doesn't mean its "not nil" children # are initialized: initVar(a, n, volatileCheck=true) @@ -253,7 +253,7 @@ proc useVar(a: PEffects, n: PNode) = # If the variable is explicitly marked as .noinit. do not emit any error a.init.add s.id elif s.id notin a.init: - if {tfNeedsInit, tfNotNil} * s.typ.flags != {}: + if {tfRequiresInit, tfNotNil} * s.typ.flags != {}: message(a.config, n.info, warnProveInit, s.name.s) else: message(a.config, n.info, warnUninit, s.name.s) @@ -838,7 +838,7 @@ proc track(tracked: PEffects, n: PNode) = # may not look like an assignment, but it is: let arg = n[1] initVarViaNew(tracked, arg) - if arg.typ.len != 0 and {tfNeedsInit} * arg.typ.lastSon.flags != {}: + if arg.typ.len != 0 and {tfRequiresInit} * arg.typ.lastSon.flags != {}: if a.sym.magic == mNewSeq and n[2].kind in {nkCharLit..nkUInt64Lit} and n[2].intVal == 0: # var s: seq[notnil]; newSeq(s, 0) is a special case! @@ -1203,7 +1203,7 @@ proc trackProc*(c: PContext; s: PSym, body: PNode) = createTypeBoundOps(t, typ, param.info) if not isEmptyType(s.typ[0]) and - ({tfNeedsInit, tfNotNil} * s.typ[0].flags != {} or + ({tfRequiresInit, tfNotNil} * s.typ[0].flags != {} or s.typ[0].skipTypes(abstractInst).kind == tyVar) and s.kind in {skProc, skFunc, skConverter, skMethod}: var res = s.ast[resultPos].sym # get result symbol |