Skip to content

Indentation affects class generation #1512

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
autotelicum opened this issue Jul 14, 2011 · 1 comment
Closed

Indentation affects class generation #1512

autotelicum opened this issue Jul 14, 2011 · 1 comment

Comments

@autotelicum
Copy link

The cases below with 3 and 5 spaces before the end bracket splits of the f method. I would have expected all indentations to give the same javascript (shown from Try CoffeeScript). This issue is based on an issue from a user on twitter, see: http://t.co/QnNqaC3.

### One class ###
class A
  g: ->
    @x = [
      1
  ] # 2 spaces
  f: ->

### Split class ###
class B
  g: ->
    @x = [
      1
   ] # 3 spaces
  f: ->

### One class ###
class C
  g: ->
    @x = [
      1
    ] # 4 spaces
  f: ->

### Split class ###
class D
  g: ->
    @x = [
      1
     ] # 5 spaces
  f: ->

### One class ###
class E
  g: ->
    @x = [
      1
      ] # 6 spaces
  f: ->
/* One class */var A, B, C, D, E;
A = (function() {
  function A() {}
  A.prototype.g = function() {
    return this.x = [1];
  };
  A.prototype.f = function() {};
  return A;
})();
/* Split class */
B = (function() {
  function B() {}
  B.prototype.g = function() {
    return this.x = [1];
  };
  return B;
})();
({
  f: function() {}
  /* One class */
});
C = (function() {
  function C() {}
  C.prototype.g = function() {
    return this.x = [1];
  };
  C.prototype.f = function() {};
  return C;
})();
/* Split class */
D = (function() {
  function D() {}
  D.prototype.g = function() {
    return this.x = [1];
  };
  return D;
})();
({
  f: function() {}
  /* One class */
});
E = (function() {
  function E() {}
  E.prototype.g = function() {
    return this.x = [1];
  };
  E.prototype.f = function() {};
  return E;
})();
@satyr
Copy link
Collaborator

satyr commented Jul 14, 2011

#1275

@satyr satyr closed this as completed Jul 14, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants