diff options
author | patrick dw <algorithicimperative@gmail.com> | 2015-06-19 01:34:34 -0500 |
---|---|---|
committer | patrick dw <algorithicimperative@gmail.com> | 2015-06-19 01:34:34 -0500 |
commit | 69e15ac32fd92abe1d950275ab4b0d830d8b13e1 (patch) | |
tree | 5075b3b8a5ab2458a3bd23a652c31419c41bba32 /tests/objects | |
parent | b6252af5c6ce99c6eaec91fb5570143151660b74 (diff) | |
download | Nim-69e15ac32fd92abe1d950275ab4b0d830d8b13e1.tar.gz |
renamed writeln to writeLine in tests
Diffstat (limited to 'tests/objects')
-rw-r--r-- | tests/objects/tobject2.nim | 2 | ||||
-rw-r--r-- | tests/objects/toop1.nim | 24 |
2 files changed, 13 insertions, 13 deletions
diff --git a/tests/objects/tobject2.nim b/tests/objects/tobject2.nim index 0f1869695..a49296843 100644 --- a/tests/objects/tobject2.nim +++ b/tests/objects/tobject2.nim @@ -9,7 +9,7 @@ type proc getPoint( p: var TPoint2d) = {.breakpoint.} - writeln(stdout, p.x) + writeLine(stdout, p.x) var p: TPoint3d diff --git a/tests/objects/toop1.nim b/tests/objects/toop1.nim index 0d8ba124b..4727d146d 100644 --- a/tests/objects/toop1.nim +++ b/tests/objects/toop1.nim @@ -8,17 +8,17 @@ import macros type TFigure = object of RootObj # abstract base class: draw: proc (my: var TFigure) {.nimcall.} # concrete classes implement this - -proc init(f: var TFigure) = + +proc init(f: var TFigure) = f.draw = nil type TCircle = object of TFigure radius: int - -proc drawCircle(my: var TCircle) = stdout.writeln("o " & $my.radius) -proc init(my: var TCircle) = +proc drawCircle(my: var TCircle) = stdout.writeLine("o " & $my.radius) + +proc init(my: var TCircle) = init(TFigure(my)) # call base constructor my.radius = 5 my.draw = cast[proc (my: var TFigure) {.nimcall.}](drawCircle) @@ -29,13 +29,13 @@ type proc drawRectangle(my: var TRectangle) = stdout.write("[]") -proc init(my: var TRectangle) = +proc init(my: var TRectangle) = init(TFigure(my)) # call base constructor my.width = 5 my.height = 10 my.draw = cast[proc (my: var TFigure) {.nimcall.}](drawRectangle) -macro `!` (n: expr): stmt {.immediate.} = +macro `!` (n: expr): stmt {.immediate.} = let n = callsite() result = newNimNode(nnkCall, n) var dot = newNimNode(nnkDotExpr, n) @@ -60,16 +60,16 @@ type FHost: int # cannot be accessed from the outside of the module # the `F` prefix is a convention to avoid clashes since # the accessors are named `host` - -proc `host=`*(s: var TSocket, value: int) {.inline.} = + +proc `host=`*(s: var TSocket, value: int) {.inline.} = ## setter of hostAddr s.FHost = value proc host*(s: TSocket): int {.inline.} = ## getter of hostAddr return s.FHost - -var + +var s: TSocket s.host = 34 # same as `host=`(s, 34) stdout.write(s.host) @@ -81,6 +81,6 @@ var init(r) init(c) r!draw -c!draw() +c!draw() #OUT 34[]o 5 |