Turn the warning for uninitialized (result) variables into errors
This commit is contained in:
parent
e0bb78553a
commit
1b570f2b18
7 changed files with 103 additions and 17 deletions
|
|
@ -146,8 +146,9 @@ proc fieldsPresentInInitExpr(c: PContext, fieldsRecList, initExpr: PNode): strin
|
|||
proc missingMandatoryFields(c: PContext, fieldsRecList: PNode,
|
||||
constrCtx: ObjConstrContext): string =
|
||||
for r in directFieldsInRecList(fieldsRecList):
|
||||
if constrCtx.requiresFullInit or sfRequiresInit in r.sym.flags or
|
||||
{tfNotNil, tfRequiresInit, tfHasRequiresInit} * r.sym.typ.flags != {}:
|
||||
if constrCtx.requiresFullInit or
|
||||
sfRequiresInit in r.sym.flags or
|
||||
r.sym.typ.requiresInit:
|
||||
let assignment = locateFieldInInitExpr(c, r.sym, constrCtx.initExpr)
|
||||
if assignment == nil:
|
||||
if result.len == 0:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue