summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2017-05-31 14:35:53 +0200
committerAraq <rumpf_a@web.de>2017-05-31 14:35:53 +0200
commit7b3785554fc60b974836062e6dea570999eaef77 (patch)
tree01de5fbcfa609527935c7fdb08b6b546c189c14a
parent3c129b7fe5599faabcd6bd784037a0b55406f63c (diff)
parent6652ae97414f6806fde57ef252e548795f469262 (diff)
downloadNim-7b3785554fc60b974836062e6dea570999eaef77.tar.gz
Merge branch 'devel' of github.com:nim-lang/Nim into devel
-rw-r--r--compiler/vm.nim2
-rw-r--r--doc/astspec.txt4
-rw-r--r--tests/vm/tnimnode.nim8
3 files changed, 12 insertions, 2 deletions
diff --git a/compiler/vm.nim b/compiler/vm.nim
index e201e98dc..bc5873ff5 100644
--- a/compiler/vm.nim
+++ b/compiler/vm.nim
@@ -1406,6 +1406,8 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
       if dest.kind in {nkStrLit..nkTripleStrLit} and
          regs[rb].kind in {rkNode}:
         dest.strVal = regs[rb].node.strVal
+      elif dest.kind == nkCommentStmt:
+        dest.comment = regs[rb].node.strVal
       else:
         stackTrace(c, tos, pc, errFieldXNotFound, "strVal")
     of opcNNewNimNode:
diff --git a/doc/astspec.txt b/doc/astspec.txt
index f430677af..57f6b9d8c 100644
--- a/doc/astspec.txt
+++ b/doc/astspec.txt
@@ -461,8 +461,8 @@ Documentation Comments
 ----------------------
 
 Double-hash (``##``) comments in the code actually have their own format,
-but the comments do not yet show up in the AST, which will only show that
-a comment exists, not what it contains. Single-hash (``#``) comments are ignored.
+using ``strVal`` to get and set the comment text. Single-hash (``#``) 
+comments are ignored.
 
 Concrete syntax:
 
diff --git a/tests/vm/tnimnode.nim b/tests/vm/tnimnode.nim
index cca03cd62..e5a41e3c2 100644
--- a/tests/vm/tnimnode.nim
+++ b/tests/vm/tnimnode.nim
@@ -72,3 +72,11 @@ static:
   echo "OK"
   
 
+static:
+  echo "testing creation of comment node"
+  var docComment: NimNode = newNimNode(nnkCommentStmt)
+  docComment.strVal = "This is a doc comment"
+
+  assertEq repr(docComment), "## This is a doc comment"
+
+  echo "OK"