{"action":"created","issue":{"url":"https://api.github.com/repos/babel/babili/issues/322","repository_url":"https://api.github.com/repos/babel/babili","labels_url":"https://api.github.com/repos/babel/babili/issues/322/labels{/name}","comments_url":"https://api.github.com/repos/babel/babili/issues/322/comments","events_url":"https://api.github.com/repos/babel/babili/issues/322/events","html_url":"https://github.com/babel/babili/issues/322","id":193433900,"number":322,"title":"Instruction order is changed after minification","user":{"login":"Maximkaaa","id":6412426,"avatar_url":"https://avatars.githubusercontent.com/u/6412426?v=3","gravatar_id":"","url":"https://api.github.com/users/Maximkaaa","html_url":"https://github.com/Maximkaaa","followers_url":"https://api.github.com/users/Maximkaaa/followers","following_url":"https://api.github.com/users/Maximkaaa/following{/other_user}","gists_url":"https://api.github.com/users/Maximkaaa/gists{/gist_id}","starred_url":"https://api.github.com/users/Maximkaaa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Maximkaaa/subscriptions","organizations_url":"https://api.github.com/users/Maximkaaa/orgs","repos_url":"https://api.github.com/users/Maximkaaa/repos","events_url":"https://api.github.com/users/Maximkaaa/events{/privacy}","received_events_url":"https://api.github.com/users/Maximkaaa/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-12-05T08:05:44Z","updated_at":"2016-12-05T11:02:27Z","closed_at":null,"body":"I have code:\r\n\r\n```\r\nclass C {\r\n    constructor() {\r\n        this._a = 1;\r\n        this.a = 2;\r\n    }\r\n}\r\n\r\nclass C1 extends C {\r\n    constructor() {\r\n        super();\r\n        this._a = 1;\r\n        this.a = 2;\r\n    }\r\n}\r\n\r\nwindow.c = new C1();\r\n```\r\n\r\nAfter running es2015 preset on this file, it becomes:\r\n\r\n```\r\n\"use strict\";\r\n\r\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\r\n\r\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\r\n\r\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\r\n\r\nvar C = function C() {\r\n    _classCallCheck(this, C);\r\n\r\n    this._a = 1;\r\n    this.a = 2;\r\n};\r\n\r\nvar C1 = function (_C) {\r\n    _inherits(C1, _C);\r\n\r\n    function C1() {\r\n        _classCallCheck(this, C1);\r\n\r\n        var _this = _possibleConstructorReturn(this, (C1.__proto__ || Object.getPrototypeOf(C1)).call(this));\r\n\r\n        _this._a = 1;\r\n        _this.a = 2;\r\n        return _this;\r\n    }\r\n\r\n    return C1;\r\n}(C);\r\n\r\nwindow.c = new C1();\r\n```\r\n\r\nThis code is 100% correct. But after running babili preset on the later (running es2015 and babili together), it gets broken. The reason is the constructor of C1 class. After minification it looks like this:\r\n\r\n```\r\n    function C1(){\r\n        _classCallCheck(this,C1);\r\n        var _this=_possibleConstructorReturn(this,(C1.__proto__||Object.getPrototypeOf(C1)).call(this));\r\n        return _this.a=2,_this._a=1,_this.a=2,_this\r\n    }\r\n```\r\n\r\nAs you can see, _this.a=2 and _this._a=1 instructions order is changed. If property \".a\" is a setter that affects ._a property, the code execution result will be completely different."},"comment":{"url":"https://api.github.com/repos/babel/babili/issues/comments/264825711","html_url":"https://github.com/babel/babili/issues/322#issuecomment-264825711","issue_url":"https://api.github.com/repos/babel/babili/issues/322","id":264825711,"user":{"login":"boopathi","id":294474,"avatar_url":"https://avatars.githubusercontent.com/u/294474?v=3","gravatar_id":"","url":"https://api.github.com/users/boopathi","html_url":"https://github.com/boopathi","followers_url":"https://api.github.com/users/boopathi/followers","following_url":"https://api.github.com/users/boopathi/following{/other_user}","gists_url":"https://api.github.com/users/boopathi/gists{/gist_id}","starred_url":"https://api.github.com/users/boopathi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boopathi/subscriptions","organizations_url":"https://api.github.com/users/boopathi/orgs","repos_url":"https://api.github.com/users/boopathi/repos","events_url":"https://api.github.com/users/boopathi/events{/privacy}","received_events_url":"https://api.github.com/users/boopathi/received_events","type":"User","site_admin":false},"created_at":"2016-12-05T11:02:27Z","updated_at":"2016-12-05T11:02:27Z","body":"Related #305 and #312 ... Can you try with `passPerPreset: true`. This options is enabled by default in master and should be available from next release."}}
{"actor":{"display_login":"boopathi"}}