# # # The Nim Compiler # (c) Copyright 2015 Nim Contributors # # See the file "copying.txt", included in this # distribution, for details about the copyright. # ## This module implements Nim's object construction rules. # included from sem.nim type InitStatus = enum initUnknown initFull # All of the fields have been initialized initPartial # Some of the fields have been initialized initNone # None of the fields have been initialized initConflict # Fields from different branches have been initialized proc mergeInitStatus(existing: var InitStatus, newStatus: InitStatus) = case newStatus of initConflict: existing = newStatus of initPartial: if existing in {initUnknown, initFull, initNone}: existing = initPartial of initNone: if existing == initUnknown: existing = initNone elif existing == initFull: existing = initPartial of initFull: if existing == initUnknown: existing = initFull elif existing == initNone: existing = initPartial of initUnknown: discard proc locateFieldInInitExpr(field: PSym, initExpr: PNode): PNode = # Returns the assignment nkExprColonExpr node or nil let fieldId = field.name.id for i in 1 ..