summary refs log tree commit diff stats
path: root/compiler/ast.nim
diff options
context:
space:
mode:
authorZahary Karadjov <zahary@gmail.com>2020-03-29 02:06:39 +0200
committerAndreas Rumpf <rumpf_a@web.de>2020-04-01 19:38:44 +0200
commit1b570f2b187fea9571476a1e2e768d2d4c2f7aa5 (patch)
tree3c4dcb1a6d4483dc6af28330b4ae41c49cf0387b /compiler/ast.nim
parente0bb78553ad34282ff198c4f1121b14b18030dc2 (diff)
downloadNim-1b570f2b187fea9571476a1e2e768d2d4c2f7aa5.tar.gz
Turn the warning for uninitialized (result) variables into errors
Diffstat (limited to 'compiler/ast.nim')
-rw-r--r--compiler/ast.nim3
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/ast.nim b/compiler/ast.nim
index a7eb2cac5..01f9ed29b 100644
--- a/compiler/ast.nim
+++ b/compiler/ast.nim
@@ -1396,6 +1396,9 @@ proc copyType*(t: PType, owner: PSym, keepId: bool): PType =
 
 proc exactReplica*(t: PType): PType = copyType(t, t.owner, true)
 
+template requiresInit*(t: PType): bool =
+  t.flags * {tfRequiresInit, tfHasRequiresInit, tfNotNil} != {}
+
 proc copySym*(s: PSym): PSym =
   result = newSym(s.kind, s.name, s.owner, s.info, s.options)
   #result.ast = nil            # BUGFIX; was: s.ast which made problems