diff options
author | LemonBoy <thatlemon@gmail.com> | 2018-06-25 15:56:13 +0200 |
---|---|---|
committer | LemonBoy <thatlemon@gmail.com> | 2018-06-25 15:56:13 +0200 |
commit | f559e62e45b4be227d494e75fe82f571ee410840 (patch) | |
tree | 82a0acd835fa368046d0601f876c23345822cb4f /tests/vm/tnimnode.nim | |
parent | 95436893061176d51b1c11fdf5418b3ed17a8455 (diff) | |
download | Nim-f559e62e45b4be227d494e75fe82f571ee410840.tar.gz |
Adjust some tests to make them pass
The non-scoped behaviour of static blocks was exploited by those tests, replace all the variables declared whithin one with compileTime marked ones.
Diffstat (limited to 'tests/vm/tnimnode.nim')
-rw-r--r-- | tests/vm/tnimnode.nim | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/tests/vm/tnimnode.nim b/tests/vm/tnimnode.nim index 188bac9bf..4210ab41d 100644 --- a/tests/vm/tnimnode.nim +++ b/tests/vm/tnimnode.nim @@ -4,14 +4,12 @@ proc assertEq(arg0,arg1: string): void = if arg0 != arg1: raiseAssert("strings not equal:\n" & arg0 & "\n" & arg1) -static: - # a simple assignment of stmtList to another variable - var node: NimNode - # an assignment of stmtList into an array - var nodeArray: array[1, NimNode] - # an assignment of stmtList into a seq - var nodeSeq = newSeq[NimNode](2) - +# a simple assignment of stmtList to another variable +var node {.compileTime.}: NimNode +# an assignment of stmtList into an array +var nodeArray {.compileTime.}: array[1, NimNode] +# an assignment of stmtList into a seq +var nodeSeq {.compileTime.} = newSeq[NimNode](2) proc checkNode(arg: NimNode; name: string): void {. compileTime .} = echo "checking ", name @@ -35,10 +33,10 @@ proc checkNode(arg: NimNode; name: string): void {. compileTime .} = echo "OK" -static: - # the root node that is used to generate the Ast - var stmtList: NimNode +# the root node that is used to generate the Ast +var stmtList {.compileTime.}: NimNode +static: stmtList = newStmtList(nnkDiscardStmt.newTree(newEmptyNode())) checkNode(stmtList, "direct construction") |