{"action":"created","comment":{"url":"https://api.github.com/repos/Shopify/decaf/pulls/comments/58701214","id":58701214,"diff_hunk":"@@ -1001,6 +1001,40 @@ function insertSuperCalls(ast) {\n   return ast;\n }\n \n+function isArrayAssignmentWithThisReference(path) {\n+  const assignedPath = path.value && path.value.left;\n+  const isArrayAssignment = assignedPath && assignedPath.type === 'ArrayExpression';\n+  const hasMemberExpressions = isArrayAssignment && jsc(assignedPath).find('MemberExpression').size() > 0;\n+\n+  return isArrayAssignment && hasMemberExpressions;\n+}\n+\n+function insertArrayAssignmentVarDeclarations(assignmentPath) {\n+  const identifiers = jsc(assignmentPath.value.left)\n+    .find(jsc.Identifier)\n+    .filter(path => path.parentPath.name === 'elements')\n+    .paths()\n+    .map(path => path.value.name)\n+    .map(identifierName => jsc.variableDeclarator(jsc.identifier(identifierName), null));\n+\n+  if (identifiers.length > 0) {\n+    jsc(assignmentPath)\n+      .closest(jsc.Statement)\n+      .insertBefore([\n+        jsc.variableDeclaration(\n+          'let', identifiers","path":"src/parser.js","position":25,"original_position":25,"commit_id":"2dfb2a3da9fe937ecb53e27a871dba686eb819a0","original_commit_id":"2dfb2a3da9fe937ecb53e27a871dba686eb819a0","user":{"login":"lemonmade","id":3012583,"avatar_url":"https://avatars.githubusercontent.com/u/3012583?v=3","gravatar_id":"","url":"https://api.github.com/users/lemonmade","html_url":"https://github.com/lemonmade","followers_url":"https://api.github.com/users/lemonmade/followers","following_url":"https://api.github.com/users/lemonmade/following{/other_user}","gists_url":"https://api.github.com/users/lemonmade/gists{/gist_id}","starred_url":"https://api.github.com/users/lemonmade/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lemonmade/subscriptions","organizations_url":"https://api.github.com/users/lemonmade/orgs","repos_url":"https://api.github.com/users/lemonmade/repos","events_url":"https://api.github.com/users/lemonmade/events{/privacy}","received_events_url":"https://api.github.com/users/lemonmade/received_events","type":"User","site_admin":false},"body":"Feels like using `var` here is more in line with what role decaf is supposed to play (we can covert these to `let` separately if we need to).","created_at":"2016-04-06T13:11:17Z","updated_at":"2016-04-06T13:11:17Z","html_url":"https://github.com/Shopify/decaf/pull/3#discussion_r58701214","pull_request_url":"https://api.github.com/repos/Shopify/decaf/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/Shopify/decaf/pulls/comments/58701214"},"html":{"href":"https://github.com/Shopify/decaf/pull/3#discussion_r58701214"},"pull_request":{"href":"https://api.github.com/repos/Shopify/decaf/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/Shopify/decaf/pulls/3","id":65368299,"html_url":"https://github.com/Shopify/decaf/pull/3","diff_url":"https://github.com/Shopify/decaf/pull/3.diff","patch_url":"https://github.com/Shopify/decaf/pull/3.patch","issue_url":"https://api.github.com/repos/Shopify/decaf/issues/3","number":3,"state":"open","locked":false,"title":"`[this.foo] = ['bar']` should not not generate a var declaration","user":{"login":"GoodForOneFare","id":673655,"avatar_url":"https://avatars.githubusercontent.com/u/673655?v=3","gravatar_id":"","url":"https://api.github.com/users/GoodForOneFare","html_url":"https://github.com/GoodForOneFare","followers_url":"https://api.github.com/users/GoodForOneFare/followers","following_url":"https://api.github.com/users/GoodForOneFare/following{/other_user}","gists_url":"https://api.github.com/users/GoodForOneFare/gists{/gist_id}","starred_url":"https://api.github.com/users/GoodForOneFare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoodForOneFare/subscriptions","organizations_url":"https://api.github.com/users/GoodForOneFare/orgs","repos_url":"https://api.github.com/users/GoodForOneFare/repos","events_url":"https://api.github.com/users/GoodForOneFare/events{/privacy}","received_events_url":"https://api.github.com/users/GoodForOneFare/received_events","type":"User","site_admin":false},"body":"decaf generates a `var` declaration for anything in a `[foo] = ['bar']` assignment.  Unfortunately, this turns:\r\n\r\n`var [@bar] = ['foo']` \r\n\r\ninto this (invalid) JavaScript \r\n\r\n`var [this.foo] = ['foo']`.\r\n\r\nTo work around this, I've added a check for any `this` references in an array assignment.  If `this` is found, any non-member references are declared separately.\r\n\r\nI've run through through our codebase and it fixes everything listed in Shopify/esify#7.\r\n\r\n@lemonmade, please take a look","created_at":"2016-04-05T20:23:06Z","updated_at":"2016-04-06T13:11:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5d99a2e6149c5d2845a96e86367fbd8b30fe7ccc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Shopify/decaf/pulls/3/commits","review_comments_url":"https://api.github.com/repos/Shopify/decaf/pulls/3/comments","review_comment_url":"https://api.github.com/repos/Shopify/decaf/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Shopify/decaf/issues/3/comments","statuses_url":"https://api.github.com/repos/Shopify/decaf/statuses/2dfb2a3da9fe937ecb53e27a871dba686eb819a0","head":{"label":"Shopify:destructuring_should_not_declare_this","ref":"destructuring_should_not_declare_this","sha":"2dfb2a3da9fe937ecb53e27a871dba686eb819a0","user":{"login":"Shopify","id":8085,"avatar_url":"https://avatars.githubusercontent.com/u/8085?v=3","gravatar_id":"","url":"https://api.github.com/users/Shopify","html_url":"https://github.com/Shopify","followers_url":"https://api.github.com/users/Shopify/followers","following_url":"https://api.github.com/users/Shopify/following{/other_user}","gists_url":"https://api.github.com/users/Shopify/gists{/gist_id}","starred_url":"https://api.github.com/users/Shopify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shopify/subscriptions","organizations_url":"https://api.github.com/users/Shopify/orgs","repos_url":"https://api.github.com/users/Shopify/repos","events_url":"https://api.github.com/users/Shopify/events{/privacy}","received_events_url":"https://api.github.com/users/Shopify/received_events","type":"Organization","site_admin":false},"repo":{"id":54986707,"name":"decaf","full_name":"Shopify/decaf","owner":{"login":"Shopify","id":8085,"avatar_url":"https://avatars.githubusercontent.com/u/8085?v=3","gravatar_id":"","url":"https://api.github.com/users/Shopify","html_url":"https://github.com/Shopify","followers_url":"https://api.github.com/users/Shopify/followers","following_url":"https://api.github.com/users/Shopify/following{/other_user}","gists_url":"https://api.github.com/users/Shopify/gists{/gist_id}","starred_url":"https://api.github.com/users/Shopify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shopify/subscriptions","organizations_url":"https://api.github.com/users/Shopify/orgs","repos_url":"https://api.github.com/users/Shopify/repos","events_url":"https://api.github.com/users/Shopify/events{/privacy}","received_events_url":"https://api.github.com/users/Shopify/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Shopify/decaf","description":"Coffeescript to ES.next transpiler","fork":true,"url":"https://api.github.com/repos/Shopify/decaf","forks_url":"https://api.github.com/repos/Shopify/decaf/forks","keys_url":"https://api.github.com/repos/Shopify/decaf/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Shopify/decaf/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Shopify/decaf/teams","hooks_url":"https://api.github.com/repos/Shopify/decaf/hooks","issue_events_url":"https://api.github.com/repos/Shopify/decaf/issues/events{/number}","events_url":"https://api.github.com/repos/Shopify/decaf/events","assignees_url":"https://api.github.com/repos/Shopify/decaf/assignees{/user}","branches_url":"https://api.github.com/repos/Shopify/decaf/branches{/branch}","tags_url":"https://api.github.com/repos/Shopify/decaf/tags","blobs_url":"https://api.github.com/repos/Shopify/decaf/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Shopify/decaf/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Shopify/decaf/git/refs{/sha}","trees_url":"https://api.github.com/repos/Shopify/decaf/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Shopify/decaf/statuses/{sha}","languages_url":"https://api.github.com/repos/Shopify/decaf/languages","stargazers_url":"https://api.github.com/repos/Shopify/decaf/stargazers","contributors_url":"https://api.github.com/repos/Shopify/decaf/contributors","subscribers_url":"https://api.github.com/repos/Shopify/decaf/subscribers","subscription_url":"https://api.github.com/repos/Shopify/decaf/subscription","commits_url":"https://api.github.com/repos/Shopify/decaf/commits{/sha}","git_commits_url":"https://api.github.com/repos/Shopify/decaf/git/commits{/sha}","comments_url":"https://api.github.com/repos/Shopify/decaf/comments{/number}","issue_comment_url":"https://api.github.com/repos/Shopify/decaf/issues/comments{/number}","contents_url":"https://api.github.com/repos/Shopify/decaf/contents/{+path}","compare_url":"https://api.github.com/repos/Shopify/decaf/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Shopify/decaf/merges","archive_url":"https://api.github.com/repos/Shopify/decaf/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Shopify/decaf/downloads","issues_url":"https://api.github.com/repos/Shopify/decaf/issues{/number}","pulls_url":"https://api.github.com/repos/Shopify/decaf/pulls{/number}","milestones_url":"https://api.github.com/repos/Shopify/decaf/milestones{/number}","notifications_url":"https://api.github.com/repos/Shopify/decaf/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Shopify/decaf/labels{/name}","releases_url":"https://api.github.com/repos/Shopify/decaf/releases{/id}","deployments_url":"https://api.github.com/repos/Shopify/decaf/deployments","created_at":"2016-03-29T15:19:20Z","updated_at":"2016-03-29T15:19:21Z","pushed_at":"2016-04-06T12:02:36Z","git_url":"git://github.com/Shopify/decaf.git","ssh_url":"git@github.com:Shopify/decaf.git","clone_url":"https://github.com/Shopify/decaf.git","svn_url":"https://github.com/Shopify/decaf","homepage":"http://www.goodafternoon.co/decaf/","size":1323,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"Shopify:master","ref":"master","sha":"56f8a046009ef0e16497a75341217305214dc166","user":{"login":"Shopify","id":8085,"avatar_url":"https://avatars.githubusercontent.com/u/8085?v=3","gravatar_id":"","url":"https://api.github.com/users/Shopify","html_url":"https://github.com/Shopify","followers_url":"https://api.github.com/users/Shopify/followers","following_url":"https://api.github.com/users/Shopify/following{/other_user}","gists_url":"https://api.github.com/users/Shopify/gists{/gist_id}","starred_url":"https://api.github.com/users/Shopify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shopify/subscriptions","organizations_url":"https://api.github.com/users/Shopify/orgs","repos_url":"https://api.github.com/users/Shopify/repos","events_url":"https://api.github.com/users/Shopify/events{/privacy}","received_events_url":"https://api.github.com/users/Shopify/received_events","type":"Organization","site_admin":false},"repo":{"id":54986707,"name":"decaf","full_name":"Shopify/decaf","owner":{"login":"Shopify","id":8085,"avatar_url":"https://avatars.githubusercontent.com/u/8085?v=3","gravatar_id":"","url":"https://api.github.com/users/Shopify","html_url":"https://github.com/Shopify","followers_url":"https://api.github.com/users/Shopify/followers","following_url":"https://api.github.com/users/Shopify/following{/other_user}","gists_url":"https://api.github.com/users/Shopify/gists{/gist_id}","starred_url":"https://api.github.com/users/Shopify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shopify/subscriptions","organizations_url":"https://api.github.com/users/Shopify/orgs","repos_url":"https://api.github.com/users/Shopify/repos","events_url":"https://api.github.com/users/Shopify/events{/privacy}","received_events_url":"https://api.github.com/users/Shopify/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Shopify/decaf","description":"Coffeescript to ES.next transpiler","fork":true,"url":"https://api.github.com/repos/Shopify/decaf","forks_url":"https://api.github.com/repos/Shopify/decaf/forks","keys_url":"https://api.github.com/repos/Shopify/decaf/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Shopify/decaf/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Shopify/decaf/teams","hooks_url":"https://api.github.com/repos/Shopify/decaf/hooks","issue_events_url":"https://api.github.com/repos/Shopify/decaf/issues/events{/number}","events_url":"https://api.github.com/repos/Shopify/decaf/events","assignees_url":"https://api.github.com/repos/Shopify/decaf/assignees{/user}","branches_url":"https://api.github.com/repos/Shopify/decaf/branches{/branch}","tags_url":"https://api.github.com/repos/Shopify/decaf/tags","blobs_url":"https://api.github.com/repos/Shopify/decaf/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Shopify/decaf/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Shopify/decaf/git/refs{/sha}","trees_url":"https://api.github.com/repos/Shopify/decaf/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Shopify/decaf/statuses/{sha}","languages_url":"https://api.github.com/repos/Shopify/decaf/languages","stargazers_url":"https://api.github.com/repos/Shopify/decaf/stargazers","contributors_url":"https://api.github.com/repos/Shopify/decaf/contributors","subscribers_url":"https://api.github.com/repos/Shopify/decaf/subscribers","subscription_url":"https://api.github.com/repos/Shopify/decaf/subscription","commits_url":"https://api.github.com/repos/Shopify/decaf/commits{/sha}","git_commits_url":"https://api.github.com/repos/Shopify/decaf/git/commits{/sha}","comments_url":"https://api.github.com/repos/Shopify/decaf/comments{/number}","issue_comment_url":"https://api.github.com/repos/Shopify/decaf/issues/comments{/number}","contents_url":"https://api.github.com/repos/Shopify/decaf/contents/{+path}","compare_url":"https://api.github.com/repos/Shopify/decaf/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Shopify/decaf/merges","archive_url":"https://api.github.com/repos/Shopify/decaf/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Shopify/decaf/downloads","issues_url":"https://api.github.com/repos/Shopify/decaf/issues{/number}","pulls_url":"https://api.github.com/repos/Shopify/decaf/pulls{/number}","milestones_url":"https://api.github.com/repos/Shopify/decaf/milestones{/number}","notifications_url":"https://api.github.com/repos/Shopify/decaf/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Shopify/decaf/labels{/name}","releases_url":"https://api.github.com/repos/Shopify/decaf/releases{/id}","deployments_url":"https://api.github.com/repos/Shopify/decaf/deployments","created_at":"2016-03-29T15:19:20Z","updated_at":"2016-03-29T15:19:21Z","pushed_at":"2016-04-06T12:02:36Z","git_url":"git://github.com/Shopify/decaf.git","ssh_url":"git@github.com:Shopify/decaf.git","clone_url":"https://github.com/Shopify/decaf.git","svn_url":"https://github.com/Shopify/decaf","homepage":"http://www.goodafternoon.co/decaf/","size":1323,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Shopify/decaf/pulls/3"},"html":{"href":"https://github.com/Shopify/decaf/pull/3"},"issue":{"href":"https://api.github.com/repos/Shopify/decaf/issues/3"},"comments":{"href":"https://api.github.com/repos/Shopify/decaf/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/Shopify/decaf/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/Shopify/decaf/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Shopify/decaf/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/Shopify/decaf/statuses/2dfb2a3da9fe937ecb53e27a871dba686eb819a0"}}}}