Created
November 11, 2015 01:59
-
-
Save goatslacker/a19461bc98263859d9b3 to your computer and use it in GitHub Desktop.
Babel 6 bug with default arguments in classes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Z { | |
x(y = 2) { | |
return y | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"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