summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2013-02-18 17:23:26 +0100
committerAraq <rumpf_a@web.de>2013-02-18 17:23:26 +0100
commitd15981adbcfe507f58f3cc6167272d8af363bbf4 (patch)
treebac2792cc435641353050635bc6d9a8a84733732 /lib
parent8e9b39084c4ed378ef98d3e2d6cc958f976862b4 (diff)
downloadNim-d15981adbcfe507f58f3cc6167272d8af363bbf4.tar.gz
system.fields|fieldPairs for objects
Diffstat (limited to 'lib')
-rwxr-xr-xlib/system.nim9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/system.nim b/lib/system.nim
index ea765644c..a17b2c97d 100755
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -1508,23 +1508,24 @@ proc map*[T](data: var openArray[T], op: proc (x: var T) {.closure.}) =
   ##   # --> ["142", "242", "342", "442"]
   for i in 0..data.len-1: op(data[i])
 
-iterator fields*[T: tuple](x: T): TObject {.
+iterator fields*[T: tuple|object](x: T): TObject {.
   magic: "Fields", noSideEffect.}
   ## iterates over every field of `x`. Warning: This really transforms
   ## the 'for' and unrolls the loop. The current implementation also has a bug
   ## that affects symbol binding in the loop body.
-iterator fields*[S: tuple, T: tuple](x: S, y: T): tuple[a, b: expr] {.
+iterator fields*[S:tuple|object, T:tuple|object](x: S, y: T): tuple[a,b: expr] {.
   magic: "Fields", noSideEffect.}
   ## iterates over every field of `x` and `y`.
   ## Warning: This is really transforms the 'for' and unrolls the loop. 
   ## The current implementation also has a bug that affects symbol binding
   ## in the loop body.
-iterator fieldPairs*[T: tuple](x: T): TObject {.
+iterator fieldPairs*[T: tuple|object](x: T): TObject {.
   magic: "FieldPairs", noSideEffect.}
   ## iterates over every field of `x`. Warning: This really transforms
   ## the 'for' and unrolls the loop. The current implementation also has a bug
   ## that affects symbol binding in the loop body.
-iterator fieldPairs*[S: tuple, T: tuple](x: S, y: T): tuple[a, b: expr] {.
+iterator fieldPairs*[S: tuple|object, T: tuple|object](x: S, y: T): tuple[
+  a, b: expr] {.
   magic: "FieldPairs", noSideEffect.}
   ## iterates over every field of `x` and `y`.
   ## Warning: This really transforms the 'for' and unrolls the loop.