diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2020-04-02 11:52:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-02 11:52:31 +0200 |
commit | d01245e501c3d90449383d055da9cb1fe5a24a7f (patch) | |
tree | e4f71328ecddd9f96452787db73a0db0e0354a7d /lib | |
parent | 68539a2926dd5937e6af640ead200726b46b80b6 (diff) | |
download | Nim-d01245e501c3d90449383d055da9cb1fe5a24a7f.tar.gz |
renamed new std/pragmas.nim to std/byaddr.nim (#13844)
* renamed new std/pragmas.nim to std/byaddr.nim * minor code cleanup
Diffstat (limited to 'lib')
-rw-r--r-- | lib/std/byaddr.nim (renamed from lib/std/pragmas.nim) | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/std/pragmas.nim b/lib/std/byaddr.nim index 5dce04c11..dd7d19da7 100644 --- a/lib/std/pragmas.nim +++ b/lib/std/byaddr.nim @@ -1,9 +1,9 @@ # see `semLowerLetVarCustomPragma` for compiler support that enables these # lowerings -template byaddr*(lhs, typ, expr) = +template byaddr*(lhs, typ, ex) = ## Allows a syntax for lvalue reference, exact analog to - ## `auto& a = expr;` in C++ + ## `auto& a = ex;` in C++ runnableExamples: var s = @[10,11,12] var a {.byaddr.} = s[0] @@ -12,8 +12,8 @@ template byaddr*(lhs, typ, expr) = doAssert a is int var b {.byaddr.}: int = s[0] doAssert a.addr == b.addr - when typ is type(nil): - let tmp = addr(expr) + when typ is typeof(nil): + let tmp = addr(ex) else: - let tmp: ptr typ = addr(expr) + let tmp: ptr typ = addr(ex) template lhs: untyped = tmp[] |