Use a comment block for function comments in generated JS, Python and Dart.

This commit is contained in:
Neil Fraser
2016-06-06 00:19:36 -07:00
parent 87e4e6224a
commit 4ba2b1bea3
3 changed files with 20 additions and 3 deletions

View File

@@ -193,7 +193,14 @@ Blockly.JavaScript.scrub_ = function(block, code) {
// Collect comment for this block.
var comment = block.getCommentText();
if (comment) {
commentCode += Blockly.JavaScript.prefixLines(comment, '// ') + '\n';
if (block.getProcedureDef) {
// Use a comment block for function comments.
commentCode += '/**\n' +
Blockly.JavaScript.prefixLines(comment + '\n', ' * ') +
' */\n';
} else {
commentCode += Blockly.JavaScript.prefixLines(comment + '\n', '// ');
}
}
// Collect comments for all value arguments.
// Don't collect comments for nested statements.