Skip to content

class @A extends A #1876

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
satyr opened this issue Nov 18, 2011 · 4 comments
Closed

class @A extends A #1876

satyr opened this issue Nov 18, 2011 · 4 comments

Comments

@satyr
Copy link
Collaborator

satyr commented Nov 18, 2011

http://twitter.com/nc_yamamoto/statuses/137505038917566464

$ coffee -s
  class A
  class @A extends A
  new @A

ERROR: RangeError: Maximum call stack size exceeded
@erisdev
Copy link

erisdev commented Nov 18, 2011

I suspect compiling to something like this would solve the problem? Notice that here I'm passing A to the anonymous function as the __super__ parameter instead of directly referencing it from the outer scope.

this.A = (function(__super__) {
  __extends(A, __super__);

  function A() {
    A.__super__.constructor.apply(this, arguments);
  }

  return A;

})(A);

@michaelficarra
Copy link
Collaborator

@erisdiscord: exactly what I was thinking.

@satyr
Copy link
Collaborator Author

satyr commented Nov 18, 2011

Ditto.

$ coco -bpe '@A = class extends A then'
this.A = (function(superclass){
  A.displayName = 'A';
  var prototype = __extends(A, superclass).prototype, constructor = A;
  function A(){}
  return A;
}(A));
...

@jashkenas
Copy link
Owner

Thanks -- fixed using coco's trick in the patch above.

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

4 participants