diff --git a/generators/dart.js b/generators/dart.js index 81b011406..f0d7715ea 100644 --- a/generators/dart.js +++ b/generators/dart.js @@ -173,7 +173,12 @@ Blockly.Dart.scrub_ = function(block, code) { // Collect comment for this block. var comment = block.getCommentText(); if (comment) { - commentCode += Blockly.Dart.prefixLines(comment, '// ') + '\n'; + if (block.getProcedureDef) { + // Use documentation comment for function comments. + commentCode += Blockly.Dart.prefixLines(comment + '\n', '/// '); + } else { + commentCode += Blockly.Dart.prefixLines(comment + '\n', '// '); + } } // Collect comments for all value arguments. // Don't collect comments for nested statements. diff --git a/generators/javascript.js b/generators/javascript.js index 5bd49f9d2..2a90b57ef 100644 --- a/generators/javascript.js +++ b/generators/javascript.js @@ -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. diff --git a/generators/python.js b/generators/python.js index ddfe2f008..106812498 100644 --- a/generators/python.js +++ b/generators/python.js @@ -176,7 +176,12 @@ Blockly.Python.scrub_ = function(block, code) { // Collect comment for this block. var comment = block.getCommentText(); if (comment) { - commentCode += Blockly.Python.prefixLines(comment, '# ') + '\n'; + if (block.getProcedureDef) { + // Use a comment block for function comments. + commentCode += '"""' + comment + '\n"""\n'; + } else { + commentCode += Blockly.Python.prefixLines(comment + '\n', '# '); + } } // Collect comments for all value arguments. // Don't collect comments for nested statements.