Skip to content

Nodes: Comments lost when they precede an Existence operation where the first element is a property of this #4756

@cueedee

Description

@cueedee

Please consider

( foo ) ->
    ### Lorem ipsum ###
    return ( @foo ? 42 )

( foo ) ->
    ### Lorem ipsum ###
    return ( @foo )

( foo ) ->
    ### Lorem ipsum ###
    return ( foo ? 42 )

Of these 3 variations, the first one fails to preserve its inline ### comment.

(function(foo) {
  var ref;
  return (ref = this.foo) != null ? ref : 42;
});

(function(foo) {
  /* Lorem ipsum */
  return this.foo;
});

(function(foo) {
  /* Lorem ipsum */
  return foo != null ? foo : 42;
});

One can see this on coffeescript.org

This phenomenon is stripping the jshint inline configuration directives placed there for use with coffee-jshint.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions