From 34c34cb49b63b04ddb2b0b2680210da742a4545d Mon Sep 17 00:00:00 2001 From: Zahary Karadjov Date: Thu, 6 Apr 2017 00:44:46 +0300 Subject: [PATCH] move the object construction logic to a separate file --- compiler/semdata.nim | 2 +- compiler/semexprs.nim | 278 +----------------------------------- compiler/semobjconstr.nim | 292 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 294 insertions(+), 278 deletions(-) create mode 100644 compiler/semobjconstr.nim diff --git a/compiler/semdata.nim b/compiler/semdata.nim index 3abfeac218..8f2c802de7 100644 --- a/compiler/semdata.nim +++ b/compiler/semdata.nim @@ -57,7 +57,7 @@ type # but you don't want to trigger a hard error. For example, # you may be in position to supply a better error message # to the user. - efWantStmt, efAllowStmt, efDetermineType, exExplain, + efWantStmt, efAllowStmt, efDetermineType, efExplain, efAllowDestructor, efWantValue, efOperand, efNoSemCheck, efNoProcvarCheck, efNoEvaluateGeneric, efInCall, efFromHlo, diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 5a71896ef7..316cf55c8f 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -2097,283 +2097,7 @@ proc isTupleType(n: PNode): bool = return false return true -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 ..