first steps for cleaner static/const distinction
This commit is contained in:
parent
1d8ff40f56
commit
c25ffbf262
19 changed files with 193 additions and 66 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue