Enabled explicitly unknown lock levels (#5409)

* enabled explicitly unknown lock levels
* allowing "unknown" as locks pragma
* added test case for locks pragma
* updated docs on locks pragma
This commit is contained in:
Fabian Keller 2017-02-20 09:31:52 +01:00 • committed by Andreas Rumpf
commit ce4587d7b7
3 changed files with 39 additions and 1 deletions

13
tests/pragmas/tlocks.nim Normal file
View file

@ -0,0 +1,13 @@
type SomeBase* = ref object of RootObj
type SomeDerived* = ref object of SomeBase
memberProc*: proc ()
method testMethod(g: SomeBase) {.base, locks: "unknown".} = discard
method testMethod(g: SomeDerived) =
if g.memberProc != nil:
g.memberProc()
# ensure int literals still work
proc plain*() {.locks: 0.} =
discard