mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-04 12:07:51 +00:00
Merge branch 'devel' of github.com:nim-lang/Nim into devel
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user