{"action":"created","issue":{"url":"https://api.github.com/repos/rollup/rollup/issues/2539","repository_url":"https://api.github.com/repos/rollup/rollup","labels_url":"https://api.github.com/repos/rollup/rollup/issues/2539/labels{/name}","comments_url":"https://api.github.com/repos/rollup/rollup/issues/2539/comments","events_url":"https://api.github.com/repos/rollup/rollup/issues/2539/events","html_url":"https://github.com/rollup/rollup/issues/2539","id":376140087,"node_id":"MDU6SXNzdWUzNzYxNDAwODc=","number":2539,"title":"[tree-shaking] function with no side-effects & args included in output","user":{"login":"leeoniya","id":43234,"node_id":"MDQ6VXNlcjQzMjM0","avatar_url":"https://avatars2.githubusercontent.com/u/43234?v=4","gravatar_id":"","url":"https://api.github.com/users/leeoniya","html_url":"https://github.com/leeoniya","followers_url":"https://api.github.com/users/leeoniya/followers","following_url":"https://api.github.com/users/leeoniya/following{/other_user}","gists_url":"https://api.github.com/users/leeoniya/gists{/gist_id}","starred_url":"https://api.github.com/users/leeoniya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leeoniya/subscriptions","organizations_url":"https://api.github.com/users/leeoniya/orgs","repos_url":"https://api.github.com/users/leeoniya/repos","events_url":"https://api.github.com/users/leeoniya/events{/privacy}","received_events_url":"https://api.github.com/users/leeoniya/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-10-31T20:08:43Z","updated_at":"2018-10-31T21:02:59Z","closed_at":null,"author_association":"NONE","body":"```js\r\n// main.js\r\n\r\nimport { extend } from './extend.js';\r\n\r\nfunction Foo() {}\r\nfunction Bar() {}\r\nextend(Foo, Bar, {});\r\nconst baz = 5;\r\nexport default baz;\r\n```\r\n\r\n```js\r\n// extend.js\r\n\r\nexport function extend(parent, child, props) {\r\n  child.__proto__ = parent;\r\n  var proto = child.prototype = Object.create(parent.prototype);\r\n  proto.constructor = child;\r\n  for (var p in props)\r\n    proto[p] = props[p];\r\n}\r\n```\r\n\r\n```js\r\n// output\r\n\r\nvar baz = (function () {\r\n  'use strict';\r\n\r\n  function extend(parent, child, props) {\r\n    child.__proto__ = parent;\r\n    var proto = child.prototype = Object.create(parent.prototype);\r\n    proto.constructor = child;\r\n    for (var p in props)\r\n      proto[p] = props[p];\r\n  }\r\n\r\n  function Foo() {}\r\n\r\n  function Bar() {}\r\n\r\n  extend(Foo, Bar, {});\r\n\r\n  const baz = 5;\r\n\r\n  return baz;\r\n\r\n}());\r\n```\r\n\r\n```js\r\n// expected\r\n\r\nvar baz = (function () {\r\n  'use strict';\r\n\r\n  const baz = 5;\r\n\r\n  return baz;\r\n}());\r\n```\r\n\r\nRepro:\r\n\r\nhttps://rollupjs.org/repl?version=0.66.6&shareable=JTdCJTIybW9kdWxlcyUyMiUzQSU1QiU3QiUyMm5hbWUlMjIlM0ElMjJtYWluLmpzJTIyJTJDJTIyY29kZSUyMiUzQSUyMmltcG9ydCUyMCU3QiUyMGV4dGVuZCUyMCU3RCUyMGZyb20lMjAnLiUyRmV4dGVuZC5qcyclM0IlNUNuJTVDbmZ1bmN0aW9uJTIwRm9vKCklMjAlN0IlN0QlNUNuJTVDbmZ1bmN0aW9uJTIwQmFyKCklMjAlN0IlN0QlNUNuJTVDbmV4dGVuZChGb28lMkMlMjBCYXIlMkMlMjAlN0IlN0QpJTNCJTVDbiU1Q25jb25zdCUyMGJheiUyMCUzRCUyMDUlM0IlNUNuJTVDbmV4cG9ydCUyMGRlZmF1bHQlMjBiYXolM0IlMjIlN0QlMkMlN0IlMjJuYW1lJTIyJTNBJTIyZXh0ZW5kLmpzJTIyJTJDJTIyY29kZSUyMiUzQSUyMmV4cG9ydCUyMGZ1bmN0aW9uJTIwZXh0ZW5kKHBhcmVudCUyQyUyMGNoaWxkJTJDJTIwcHJvcHMpJTIwJTdCJTVDbiU1Q3RjaGlsZC5fX3Byb3RvX18lMjAlM0QlMjBwYXJlbnQlM0IlNUNuJTVDdHZhciUyMHByb3RvJTIwJTNEJTIwY2hpbGQucHJvdG90eXBlJTIwJTNEJTIwT2JqZWN0LmNyZWF0ZShwYXJlbnQucHJvdG90eXBlKSUzQiU1Q24lNUN0cHJvdG8uY29uc3RydWN0b3IlMjAlM0QlMjBjaGlsZCUzQiU1Q24lNUN0Zm9yJTIwKHZhciUyMHAlMjBpbiUyMHByb3BzKSU1Q24lNUN0JTVDdHByb3RvJTVCcCU1RCUyMCUzRCUyMHByb3BzJTVCcCU1RCUzQiU1Q24lN0QlMjIlN0QlNUQlMkMlMjJvcHRpb25zJTIyJTNBJTdCJTIyZm9ybWF0JTIyJTNBJTIyaWlmZSUyMiUyQyUyMm5hbWUlMjIlM0ElMjJiYXolMjIlMkMlMjJhbWQlMjIlM0ElN0IlMjJpZCUyMiUzQSUyMiUyMiU3RCU3RCUyQyUyMmV4YW1wbGUlMjIlM0FudWxsJTdE"},"comment":{"url":"https://api.github.com/repos/rollup/rollup/issues/comments/434846646","html_url":"https://github.com/rollup/rollup/issues/2539#issuecomment-434846646","issue_url":"https://api.github.com/repos/rollup/rollup/issues/2539","id":434846646,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNDg0NjY0Ng==","user":{"login":"leeoniya","id":43234,"node_id":"MDQ6VXNlcjQzMjM0","avatar_url":"https://avatars2.githubusercontent.com/u/43234?v=4","gravatar_id":"","url":"https://api.github.com/users/leeoniya","html_url":"https://github.com/leeoniya","followers_url":"https://api.github.com/users/leeoniya/followers","following_url":"https://api.github.com/users/leeoniya/following{/other_user}","gists_url":"https://api.github.com/users/leeoniya/gists{/gist_id}","starred_url":"https://api.github.com/users/leeoniya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leeoniya/subscriptions","organizations_url":"https://api.github.com/users/leeoniya/orgs","repos_url":"https://api.github.com/users/leeoniya/repos","events_url":"https://api.github.com/users/leeoniya/events{/privacy}","received_events_url":"https://api.github.com/users/leeoniya/received_events","type":"User","site_admin":false},"created_at":"2018-10-31T21:02:59Z","updated_at":"2018-10-31T21:02:59Z","author_association":"NONE","body":"hmm, i guess the title is not quite correct. the function does mutate the arguments, but those args are never used or exported afterwards.\r\n\r\nthis might be a tricky case, not even Closure Compiler is able to strip this out in ADVANCED mode :("}}
{"actor":{"display_login":"leeoniya"}}