mirror of
https://github.com/nim-lang/Nim.git
synced 2026-08-30 02:21:43 +00:00
implemented a[^1] notation
This commit is contained in:
@@ -222,8 +222,8 @@ type
|
||||
set*{.magic: "Set".}[T] ## Generic type to construct bit sets.
|
||||
|
||||
type
|
||||
Slice* {.final, pure.}[T] = object ## builtin slice type
|
||||
a*, b*: T ## the bounds
|
||||
Slice*[T] = object ## builtin slice type
|
||||
a*, b*: T ## the bounds
|
||||
|
||||
when defined(nimalias):
|
||||
{.deprecated: [TSlice: Slice].}
|
||||
@@ -3247,4 +3247,12 @@ proc procCall*(x: expr) {.magic: "ProcCall".} =
|
||||
## procCall someMethod(a, b)
|
||||
discard
|
||||
|
||||
proc `^`*(x: int): int {.noSideEffect, magic: "Roof".} =
|
||||
## builtin `roof`:idx: operator that can be used for convenient array access.
|
||||
## ``a[^x]`` is rewritten to ``a[a.len-x]``. However currently the ``a``
|
||||
## expression must not have side effects for this to compile. Note that since
|
||||
## this is a builtin, it automatically works for all kinds of
|
||||
## overloaded ``[]`` or ``[]=`` accessors.
|
||||
discard
|
||||
|
||||
{.pop.} #{.push warning[GcMem]: off.}
|
||||
|
||||
Reference in New Issue
Block a user