Skip to content

Conversation

@connec
Copy link
Collaborator

@connec connec commented Dec 15, 2017

Fixes #4827.

I did first try to use an arrow function by setting bound = true on the wrapper, but this messed with the handling of @ within the class body, where it should refer to the class being defined.

We could opt to perform the binding only if the class extends an @-value but that would add a bit of extra complexity in the compiler for equivalent and, imo, no less readable output.

@GeoffreyBooth
Copy link
Collaborator

LGTM.

@connec
Copy link
Collaborator Author

connec commented Dec 18, 2017

Any other notes? I would quite like to get this and #4826 into a (patch) release.

connec added a commit to connec/yaml-js that referenced this pull request Dec 18, 2017
There were 4 sources of breakages:

- `super` must be called in extended classes with constructors.
- Class prototype methods are non-enumerable, so `util.extend` had to be
  updated to use `Object.getOwnPropertyNames` and
  `Object.getPrototypeOf`.
- Default arguments will only be used for `undefined` values, which
  broke a test setup in `test/test.coffee`.
- Due to `super` needing to be called before `@` parameters are
  availble, the stack set by `YAMLError#constructor` was calling
  `#toString` of subclasses whose `@` parameters were not yet available.
  The chosen fix was to make `#stack` a getter.

This revealed a bug in CS which has been reported as
jashkenas/coffeescript#4827. For now the CS dependency has been pinned
to a proposed fix for that issue (jashkenas/coffeescript#4828).
@GeoffreyBooth GeoffreyBooth merged commit ffbe51e into jashkenas:master Dec 18, 2017
@GeoffreyBooth GeoffreyBooth mentioned this pull request Dec 29, 2017
@connec connec deleted the #4827 branch April 21, 2020 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants