diff options
author | Zahary Karadjov <zahary@gmail.com> | 2020-03-27 18:43:23 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2020-04-01 19:38:44 +0200 |
commit | 7652aede41d81b4e7db2c70ffe462c6fb675d078 (patch) | |
tree | d44427bafa4bbdf19adbfa629aafcd0dc932a2ba /compiler/ast.nim | |
parent | a8b6222c862d207a32c104699fc4f0f0a8bced17 (diff) | |
download | Nim-7652aede41d81b4e7db2c70ffe462c6fb675d078.tar.gz |
More sophistication; Allow requiresInit to be specified per-field
Diffstat (limited to 'compiler/ast.nim')
-rw-r--r-- | compiler/ast.nim | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/ast.nim b/compiler/ast.nim index a4630732b..a7eb2cac5 100644 --- a/compiler/ast.nim +++ b/compiler/ast.nim @@ -259,6 +259,7 @@ type # needed for the code generator sfProcvar, # proc can be passed to a proc var sfDiscriminant, # field is a discriminant in a record/object + sfRequiresInit, # field must be initialized during construction sfDeprecated, # symbol is deprecated sfExplain, # provide more diagnostics when this symbol is used sfError, # usage of symbol should trigger a compile-time error @@ -1488,7 +1489,7 @@ proc propagateToOwner*(owner, elem: PType; propagateHasAsgn = true) = elif owner.kind notin HaveTheirOwnEmpty: owner.flags.incl tfHasRequiresInit - if tfRequiresInit in elem.flags: + if {tfRequiresInit, tfHasRequiresInit} * elem.flags != {}: if owner.kind in HaveTheirOwnEmpty: discard else: owner.flags.incl tfHasRequiresInit |