Skip to content

Instantly share code, notes, and snippets.

@goatslacker
Created November 11, 2015 01:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goatslacker/a19461bc98263859d9b3 to your computer and use it in GitHub Desktop.
Save goatslacker/a19461bc98263859d9b3 to your computer and use it in GitHub Desktop.
Babel 6 bug with default arguments in classes
class Z {
x(y = 2) {
return y
}
}
"use strict";
var _arguments = arguments;
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var Z = (function () {
function Z() {
_classCallCheck(this, Z);
}
_createClass(Z, [{
key: "x",
value: (function () {
function x() {
// This should be using arguments!
var y = _arguments.length <= 0 || _arguments[0] === undefined ? 2 : _arguments[0];
return y;
}
return x;
})()
}]);
return Z;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment