first steps for cleaner static/const distinction

This commit is contained in:
Araq 2012-03-13 02:01:56 +01:00
commit c25ffbf262
19 changed files with 193 additions and 66 deletions

View file

@ -87,7 +87,8 @@ type
## represents a Nimrod *symbol* in the compiler; a *symbol* is a looked-up
## *ident*.
PNimrodNode* = expr
TNimrodNode {.final.} = object
PNimrodNode* = ref TNimrodNode
## represents a Nimrod AST node. Macros operate on this type.
const

View file

@ -2213,12 +2213,12 @@ proc shallow*(s: var string) {.noSideEffect, inline.} =
var s = cast[PGenericSeq](s)
s.reserved = s.reserved or seqShallowFlag
template static*(e: expr): expr =
## evaluates a given expression `e` at compile-time
## even if it has side effects
block:
const res = e
res
#template static*(e: expr): expr =
# ## evaluates a given expression `e` at compile-time
# ## even if it has side effects
# block:
# const res = e
# res
template eval*(blk: stmt): stmt =
## executes a block of code at compile time just as if it was a macro