first steps of making 'opt' a first class type for Nim

This commit is contained in:
Andreas Rumpf 2017-09-25 13:19:36 +02:00
commit f7f3a25be8
20 changed files with 198 additions and 35 deletions

View file

@ -1537,6 +1537,8 @@ proc getNullValue(typ: PType, info: TLineInfo): PNode =
addSon(result, getNullValue(t.sons[i], info))
of tySet:
result = newNodeIT(nkCurly, info, t)
of tyOpt:
result = newNodeIT(nkNilLit, info, t)
else:
globalError(info, "cannot create null element for: " & $t.kind)