the stdlib supports &= in more contexts; refs #3524

This commit is contained in:
Andreas Rumpf 2016-03-05 16:13:23 +01:00
commit cc925d97f4
3 changed files with 10 additions and 0 deletions

View file

@ -3286,6 +3286,10 @@ proc `/=`*[T: float|float32](x: var T, y: T) {.inline, noSideEffect.} =
x = x / y
proc `&=`* (x: var string, y: string) {.magic: "AppendStrStr", noSideEffect.}
template `&=`*(x, y: typed) = add(x, y)
template `&=`*(f: File, x: typed) = write(f, x)
## generic 'sink' operator for Nim. For files an alias for ``write``.
## If not specialized further an alias for ``add``.
proc astToStr*[T](x: T): string {.magic: "AstToStr", noSideEffect.}
## converts the AST of `x` into a string representation. This is very useful