{"action":"created","comment":{"url":"https://api.github.com/repos/google/traceur-compiler/pulls/comments/25569524","id":25569524,"diff_hunk":"@@ -46,6 +59,68 @@ export class ArrowFunctionTransformer extends TempVarTransformer {\n    * function body and return statement if needed.\n    */\n   transformArrowFunctionExpression(tree) {\n+    if (this.inDerivedClass_ && this.inConstructor_) {\n+      return this.transformUsingCommaExpression_(tree);\n+    }\n+    return this.transformUsingTempVar_(tree);\n+  }\n+\n+  // This transforms using a comman expression to prevent reading this\n+  // before the current location.\n+  //\n+  //   ($tmp = this, function() {})\n+  transformUsingCommaExpression_(tree) {\n+    let finder = new FindThisOrArguments();\n+    let argumentsTempName, thisTempName;\n+    finder.visitAny(tree);\n+    if (finder.foundArguments) {\n+      argumentsTempName = this.addTempVar();\n+      tree = AlphaRenamer.rename(tree, ARGUMENTS, argumentsTempName);\n+    }\n+    if (finder.foundThis) {\n+      thisTempName = this.addTempVar();\n+      tree = AlphaRenamer.rename(tree, THIS, thisTempName);\n+    }\n+\n+    let parameterList = this.transformAny(tree.parameterList);\n+\n+    let body = this.transformAny(tree.body);\n+    body = convertConciseBody(body);\n+    let functionExpression = new FunctionExpression(tree.location, null,\n+        tree.functionKind, parameterList, null, [], body);\n+\n+    var expressions = [];\n+    if (argumentsTempName) {\n+      expressions.push(createAssignmentExpression(\n+          createIdentifierExpression(argumentsTempName),\n+          createIdentifierExpression(ARGUMENTS)));\n+    }\n+    if (thisTempName) {\n+      expressions.push(createAssignmentExpression(\n+          createIdentifierExpression(thisTempName),\n+          createThisExpression()));\n+    }\n+\n+    if (expressions.length === 0) {\n+      return createParenExpression(functionExpression);\n+    }\n+\n+    expressions.push(functionExpression);\n+    return createParenExpression(createCommaExpression(expressions));\n+  }\n+\n+  // This transforms the arrow function into:\n+  //\n+  //   var $tmp = this;\n+  //   ...\n+  //   (function() {})\n+  //\n+  // with a temp variable added to the top of the current function.\n+  transformUsingTempVar_(tree) {\n+    // TODO(arv): alphaRenameThisAndArguments is used in other places. It is\n+    // possible that we run into the same issues with super() in derived\n+    // constructors in those cases. Come up with a better reusable way to do\n+    // this.\n     let alphaRenamed = alphaRenameThisAndArguments(this, tree);","path":"src/codegeneration/ArrowFunctionTransformer.js","position":103,"original_position":103,"commit_id":"98f95230a28f65ddb3ac2b3bf7ebbb6b4602727c","original_commit_id":"98f95230a28f65ddb3ac2b3bf7ebbb6b4602727c","user":{"login":"johnjbarton","id":205570,"avatar_url":"https://avatars.githubusercontent.com/u/205570?v=3","gravatar_id":"","url":"https://api.github.com/users/johnjbarton","html_url":"https://github.com/johnjbarton","followers_url":"https://api.github.com/users/johnjbarton/followers","following_url":"https://api.github.com/users/johnjbarton/following{/other_user}","gists_url":"https://api.github.com/users/johnjbarton/gists{/gist_id}","starred_url":"https://api.github.com/users/johnjbarton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnjbarton/subscriptions","organizations_url":"https://api.github.com/users/johnjbarton/orgs","repos_url":"https://api.github.com/users/johnjbarton/repos","events_url":"https://api.github.com/users/johnjbarton/events{/privacy}","received_events_url":"https://api.github.com/users/johnjbarton/received_events","type":"User","site_admin":false},"body":"Which 'same issues'; which 'this'?","created_at":"2015-03-01T18:11:25Z","updated_at":"2015-03-01T18:11:25Z","html_url":"https://github.com/google/traceur-compiler/pull/1779#discussion_r25569524","pull_request_url":"https://api.github.com/repos/google/traceur-compiler/pulls/1779","_links":{"self":{"href":"https://api.github.com/repos/google/traceur-compiler/pulls/comments/25569524"},"html":{"href":"https://github.com/google/traceur-compiler/pull/1779#discussion_r25569524"},"pull_request":{"href":"https://api.github.com/repos/google/traceur-compiler/pulls/1779"}}},"pull_request":{"url":"https://api.github.com/repos/google/traceur-compiler/pulls/1779","id":30233115,"html_url":"https://github.com/google/traceur-compiler/pull/1779","diff_url":"https://github.com/google/traceur-compiler/pull/1779.diff","patch_url":"https://github.com/google/traceur-compiler/pull/1779.patch","issue_url":"https://api.github.com/repos/google/traceur-compiler/issues/1779","number":1779,"state":"open","locked":false,"title":"Enforce strict super","user":{"login":"arv","id":45845,"avatar_url":"https://avatars.githubusercontent.com/u/45845?v=3","gravatar_id":"","url":"https://api.github.com/users/arv","html_url":"https://github.com/arv","followers_url":"https://api.github.com/users/arv/followers","following_url":"https://api.github.com/users/arv/following{/other_user}","gists_url":"https://api.github.com/users/arv/gists{/gist_id}","starred_url":"https://api.github.com/users/arv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arv/subscriptions","organizations_url":"https://api.github.com/users/arv/orgs","repos_url":"https://api.github.com/users/arv/repos","events_url":"https://api.github.com/users/arv/events{/privacy}","received_events_url":"https://api.github.com/users/arv/received_events","type":"User","site_admin":false},"body":"This enforces super and return in the parser. This is done by keeping\r\ntrack of what kind of function we are currently in in the parser.\r\n\r\nThen there is also a visitor that ensures that we are calling super\r\nbefore accessing this in a derived constructor.","created_at":"2015-02-28T23:24:34Z","updated_at":"2015-03-01T18:11:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"819c30bbfddc00eecff06d65198cb53e62b33383","assignee":{"login":"johnjbarton","id":205570,"avatar_url":"https://avatars.githubusercontent.com/u/205570?v=3","gravatar_id":"","url":"https://api.github.com/users/johnjbarton","html_url":"https://github.com/johnjbarton","followers_url":"https://api.github.com/users/johnjbarton/followers","following_url":"https://api.github.com/users/johnjbarton/following{/other_user}","gists_url":"https://api.github.com/users/johnjbarton/gists{/gist_id}","starred_url":"https://api.github.com/users/johnjbarton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnjbarton/subscriptions","organizations_url":"https://api.github.com/users/johnjbarton/orgs","repos_url":"https://api.github.com/users/johnjbarton/repos","events_url":"https://api.github.com/users/johnjbarton/events{/privacy}","received_events_url":"https://api.github.com/users/johnjbarton/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/google/traceur-compiler/pulls/1779/commits","review_comments_url":"https://api.github.com/repos/google/traceur-compiler/pulls/1779/comments","review_comment_url":"https://api.github.com/repos/google/traceur-compiler/pulls/comments{/number}","comments_url":"https://api.github.com/repos/google/traceur-compiler/issues/1779/comments","statuses_url":"https://api.github.com/repos/google/traceur-compiler/statuses/98f95230a28f65ddb3ac2b3bf7ebbb6b4602727c","head":{"label":"arv:super-restrictions","ref":"super-restrictions","sha":"98f95230a28f65ddb3ac2b3bf7ebbb6b4602727c","user":{"login":"arv","id":45845,"avatar_url":"https://avatars.githubusercontent.com/u/45845?v=3","gravatar_id":"","url":"https://api.github.com/users/arv","html_url":"https://github.com/arv","followers_url":"https://api.github.com/users/arv/followers","following_url":"https://api.github.com/users/arv/following{/other_user}","gists_url":"https://api.github.com/users/arv/gists{/gist_id}","starred_url":"https://api.github.com/users/arv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arv/subscriptions","organizations_url":"https://api.github.com/users/arv/orgs","repos_url":"https://api.github.com/users/arv/repos","events_url":"https://api.github.com/users/arv/events{/privacy}","received_events_url":"https://api.github.com/users/arv/received_events","type":"User","site_admin":false},"repo":{"id":9069860,"name":"traceur-compiler","full_name":"arv/traceur-compiler","owner":{"login":"arv","id":45845,"avatar_url":"https://avatars.githubusercontent.com/u/45845?v=3","gravatar_id":"","url":"https://api.github.com/users/arv","html_url":"https://github.com/arv","followers_url":"https://api.github.com/users/arv/followers","following_url":"https://api.github.com/users/arv/following{/other_user}","gists_url":"https://api.github.com/users/arv/gists{/gist_id}","starred_url":"https://api.github.com/users/arv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arv/subscriptions","organizations_url":"https://api.github.com/users/arv/orgs","repos_url":"https://api.github.com/users/arv/repos","events_url":"https://api.github.com/users/arv/events{/privacy}","received_events_url":"https://api.github.com/users/arv/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/arv/traceur-compiler","description":"Traceur is a JavaScript.next-to-JavaScript-of-today compiler","fork":true,"url":"https://api.github.com/repos/arv/traceur-compiler","forks_url":"https://api.github.com/repos/arv/traceur-compiler/forks","keys_url":"https://api.github.com/repos/arv/traceur-compiler/keys{/key_id}","collaborators_url":"https://api.github.com/repos/arv/traceur-compiler/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/arv/traceur-compiler/teams","hooks_url":"https://api.github.com/repos/arv/traceur-compiler/hooks","issue_events_url":"https://api.github.com/repos/arv/traceur-compiler/issues/events{/number}","events_url":"https://api.github.com/repos/arv/traceur-compiler/events","assignees_url":"https://api.github.com/repos/arv/traceur-compiler/assignees{/user}","branches_url":"https://api.github.com/repos/arv/traceur-compiler/branches{/branch}","tags_url":"https://api.github.com/repos/arv/traceur-compiler/tags","blobs_url":"https://api.github.com/repos/arv/traceur-compiler/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/arv/traceur-compiler/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/arv/traceur-compiler/git/refs{/sha}","trees_url":"https://api.github.com/repos/arv/traceur-compiler/git/trees{/sha}","statuses_url":"https://api.github.com/repos/arv/traceur-compiler/statuses/{sha}","languages_url":"https://api.github.com/repos/arv/traceur-compiler/languages","stargazers_url":"https://api.github.com/repos/arv/traceur-compiler/stargazers","contributors_url":"https://api.github.com/repos/arv/traceur-compiler/contributors","subscribers_url":"https://api.github.com/repos/arv/traceur-compiler/subscribers","subscription_url":"https://api.github.com/repos/arv/traceur-compiler/subscription","commits_url":"https://api.github.com/repos/arv/traceur-compiler/commits{/sha}","git_commits_url":"https://api.github.com/repos/arv/traceur-compiler/git/commits{/sha}","comments_url":"https://api.github.com/repos/arv/traceur-compiler/comments{/number}","issue_comment_url":"https://api.github.com/repos/arv/traceur-compiler/issues/comments{/number}","contents_url":"https://api.github.com/repos/arv/traceur-compiler/contents/{+path}","compare_url":"https://api.github.com/repos/arv/traceur-compiler/compare/{base}...{head}","merges_url":"https://api.github.com/repos/arv/traceur-compiler/merges","archive_url":"https://api.github.com/repos/arv/traceur-compiler/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/arv/traceur-compiler/downloads","issues_url":"https://api.github.com/repos/arv/traceur-compiler/issues{/number}","pulls_url":"https://api.github.com/repos/arv/traceur-compiler/pulls{/number}","milestones_url":"https://api.github.com/repos/arv/traceur-compiler/milestones{/number}","notifications_url":"https://api.github.com/repos/arv/traceur-compiler/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/arv/traceur-compiler/labels{/name}","releases_url":"https://api.github.com/repos/arv/traceur-compiler/releases{/id}","created_at":"2013-03-28T04:13:00Z","updated_at":"2015-02-27T20:16:47Z","pushed_at":"2015-03-01T16:43:24Z","git_url":"git://github.com/arv/traceur-compiler.git","ssh_url":"git@github.com:arv/traceur-compiler.git","clone_url":"https://github.com/arv/traceur-compiler.git","svn_url":"https://github.com/arv/traceur-compiler","homepage":"","size":25526,"stargazers_count":3,"watchers_count":3,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":3,"default_branch":"master"}},"base":{"label":"google:master","ref":"master","sha":"fd5f3c5bcde318941e76482db07629f9fbdafc44","user":{"login":"google","id":1342004,"avatar_url":"https://avatars.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"repo":{"id":9060347,"name":"traceur-compiler","full_name":"google/traceur-compiler","owner":{"login":"google","id":1342004,"avatar_url":"https://avatars.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/google/traceur-compiler","description":"Traceur is a JavaScript.next-to-JavaScript-of-today compiler","fork":false,"url":"https://api.github.com/repos/google/traceur-compiler","forks_url":"https://api.github.com/repos/google/traceur-compiler/forks","keys_url":"https://api.github.com/repos/google/traceur-compiler/keys{/key_id}","collaborators_url":"https://api.github.com/repos/google/traceur-compiler/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/google/traceur-compiler/teams","hooks_url":"https://api.github.com/repos/google/traceur-compiler/hooks","issue_events_url":"https://api.github.com/repos/google/traceur-compiler/issues/events{/number}","events_url":"https://api.github.com/repos/google/traceur-compiler/events","assignees_url":"https://api.github.com/repos/google/traceur-compiler/assignees{/user}","branches_url":"https://api.github.com/repos/google/traceur-compiler/branches{/branch}","tags_url":"https://api.github.com/repos/google/traceur-compiler/tags","blobs_url":"https://api.github.com/repos/google/traceur-compiler/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/google/traceur-compiler/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/google/traceur-compiler/git/refs{/sha}","trees_url":"https://api.github.com/repos/google/traceur-compiler/git/trees{/sha}","statuses_url":"https://api.github.com/repos/google/traceur-compiler/statuses/{sha}","languages_url":"https://api.github.com/repos/google/traceur-compiler/languages","stargazers_url":"https://api.github.com/repos/google/traceur-compiler/stargazers","contributors_url":"https://api.github.com/repos/google/traceur-compiler/contributors","subscribers_url":"https://api.github.com/repos/google/traceur-compiler/subscribers","subscription_url":"https://api.github.com/repos/google/traceur-compiler/subscription","commits_url":"https://api.github.com/repos/google/traceur-compiler/commits{/sha}","git_commits_url":"https://api.github.com/repos/google/traceur-compiler/git/commits{/sha}","comments_url":"https://api.github.com/repos/google/traceur-compiler/comments{/number}","issue_comment_url":"https://api.github.com/repos/google/traceur-compiler/issues/comments{/number}","contents_url":"https://api.github.com/repos/google/traceur-compiler/contents/{+path}","compare_url":"https://api.github.com/repos/google/traceur-compiler/compare/{base}...{head}","merges_url":"https://api.github.com/repos/google/traceur-compiler/merges","archive_url":"https://api.github.com/repos/google/traceur-compiler/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/google/traceur-compiler/downloads","issues_url":"https://api.github.com/repos/google/traceur-compiler/issues{/number}","pulls_url":"https://api.github.com/repos/google/traceur-compiler/pulls{/number}","milestones_url":"https://api.github.com/repos/google/traceur-compiler/milestones{/number}","notifications_url":"https://api.github.com/repos/google/traceur-compiler/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/google/traceur-compiler/labels{/name}","releases_url":"https://api.github.com/repos/google/traceur-compiler/releases{/id}","created_at":"2013-03-27T18:05:40Z","updated_at":"2015-03-01T16:38:18Z","pushed_at":"2015-02-27T22:05:04Z","git_url":"git://github.com/google/traceur-compiler.git","ssh_url":"git@github.com:google/traceur-compiler.git","clone_url":"https://github.com/google/traceur-compiler.git","svn_url":"https://github.com/google/traceur-compiler","homepage":"","size":36111,"stargazers_count":4657,"watchers_count":4657,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":276,"mirror_url":null,"open_issues_count":254,"forks":276,"open_issues":254,"watchers":4657,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/google/traceur-compiler/pulls/1779"},"html":{"href":"https://github.com/google/traceur-compiler/pull/1779"},"issue":{"href":"https://api.github.com/repos/google/traceur-compiler/issues/1779"},"comments":{"href":"https://api.github.com/repos/google/traceur-compiler/issues/1779/comments"},"review_comments":{"href":"https://api.github.com/repos/google/traceur-compiler/pulls/1779/comments"},"review_comment":{"href":"https://api.github.com/repos/google/traceur-compiler/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/google/traceur-compiler/pulls/1779/commits"},"statuses":{"href":"https://api.github.com/repos/google/traceur-compiler/statuses/98f95230a28f65ddb3ac2b3bf7ebbb6b4602727c"}}}}