proc bodies can be expressions with a type

This commit is contained in:
Araq 2012-09-22 22:43:36 +02:00
commit 759b3201ad
12 changed files with 75 additions and 13 deletions

View file

@ -13,8 +13,11 @@ type
valueC,
valueD = (4, "abc")
# test the new "proc body can be an expr" feature:
proc getValue: TMyEnum = valueD
# trick the optimizer with a variable:
var x = valueD
var x = getValue()
echo valueA, ord(valueA), valueB, ord(valueB), valueC, valueD, ord(valueD), x