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/ast.nim | |
parent | 216fd59c44c7eb56431748389e3b2116692189a1 (diff) | |
download | Nim-a8b6222c862d207a32c104699fc4f0f0a8bced17.tar.gz |
First steps, the compiler can boot with enforced requiresInit
Diffstat (limited to 'compiler/ast.nim')
-rw-r--r-- | compiler/ast.nim | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/compiler/ast.nim b/compiler/ast.nim index 4d45f0e55..a4630732b 100644 --- a/compiler/ast.nim +++ b/compiler/ast.nim @@ -517,8 +517,10 @@ type tfPartial, # type is declared as 'partial' tfNotNil, # type cannot be 'nil' - tfNeedsInit, # type constains a "not nil" constraint somewhere or some - # other type so that it requires initialization + tfHasRequiresInit,# type constains a "not nil" constraint somewhere or + # a `requiresInit` field, so the default zero init + # is not appropriate + tfRequiresInit, # all fields of the type must be initialized tfVarIsPtr, # 'var' type is translated like 'ptr' even in C++ mode tfHasMeta, # type contains "wildcard" sub-types such as generic params # or other type classes @@ -1484,11 +1486,11 @@ proc propagateToOwner*(owner, elem: PType; propagateHasAsgn = true) = if owner.kind in {tyGenericInst, tyGenericBody, tyGenericInvocation}: owner.flags.incl tfNotNil elif owner.kind notin HaveTheirOwnEmpty: - owner.flags.incl tfNeedsInit + owner.flags.incl tfHasRequiresInit - if tfNeedsInit in elem.flags: + if tfRequiresInit in elem.flags: if owner.kind in HaveTheirOwnEmpty: discard - else: owner.flags.incl tfNeedsInit + else: owner.flags.incl tfHasRequiresInit if elem.isMetaType: owner.flags.incl tfHasMeta |