Skip to content

Commit

Permalink
Remove multi-line comments to avoid escaping (google#3231) (google#3232)
Browse files Browse the repository at this point in the history
Fixes google#3230 by removing multi-line comments for procedures.
  • Loading branch information
RoboErikG authored Oct 14, 2019
1 parent 31db570 commit 52a6992
Show file tree
Hide file tree
Showing 4 changed files with 176 additions and 437 deletions.
11 changes: 2 additions & 9 deletions generators/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,15 +253,8 @@ Blockly.JavaScript.scrub_ = function(block, code, opt_thisOnly) {
var comment = block.getCommentText();
if (comment) {
comment = Blockly.utils.string.wrap(comment,
Blockly.JavaScript.COMMENT_WRAP - 3);
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', '// ');
}
Blockly.JavaScript.COMMENT_WRAP - 3);
commentCode += Blockly.JavaScript.prefixLines(comment + '\n', '// ');
}
// Collect comments for all value arguments.
// Don't collect comments for nested statements.
Expand Down
9 changes: 2 additions & 7 deletions generators/python.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,13 +267,8 @@ Blockly.Python.scrub_ = function(block, code, opt_thisOnly) {
var comment = block.getCommentText();
if (comment) {
comment = Blockly.utils.string.wrap(comment,
Blockly.Python.COMMENT_WRAP - 3);
if (block.getProcedureDef) {
// Use a comment block for function comments.
commentCode += '"""' + comment + '\n"""\n';
} else {
commentCode += Blockly.Python.prefixLines(comment + '\n', '# ');
}
Blockly.Python.COMMENT_WRAP - 3);
commentCode += Blockly.Python.prefixLines(comment + '\n', '# ');
}
// Collect comments for all value arguments.
// Don't collect comments for nested statements.
Expand Down
Loading

0 comments on commit 52a6992

Please sign in to comment.