From 7652aede41d81b4e7db2c70ffe462c6fb675d078 Mon Sep 17 00:00:00 2001 From: Zahary Karadjov Date: Fri, 27 Mar 2020 18:43:23 +0200 Subject: More sophistication; Allow requiresInit to be specified per-field --- compiler/ast.nim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'compiler/ast.nim') 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 -- cgit 1.4.1-2-gfad0