Skip to content

A comment in return statement leads to incorrect javascript #115

@paulsmirnov

Description

@paulsmirnov

If you add a comment just after return keyword (e.g. JSDoc3 module comment)

define('fail', [], function() {
  var x = 1;
  return /* fail here */ {
    a: x
  };
});

then an erroneous line break appears in processed code:

;(function() {
var fail;
fail = function () {
  var x = 1;
  return /* fail here */
  { a: x };
}();
}());

It is no longer functions as intended because return statement implicitly returns undefined. Object {a: x} becomes orphaned.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions