{"action":"created","comment":{"url":"https://api.github.com/repos/Microsoft/ChakraCore/pulls/comments/55289195","id":55289195,"diff_hunk":"@@ -2447,6 +2523,146 @@ IdentPtr Parser::ParseImportOrExportFromClause(bool throwIfNotFound)\n     return moduleSpecifier;\n }\n \n+template<bool buildAST> \n+ParseNodePtr Parser::ParseDefaultExportClause()\n+{\n+    Assert(m_token.tk == tkDEFAULT);\n+\n+    m_pscan->Scan();\n+    ParseNodePtr pnode = nullptr;\n+    ushort flags = fFncNoFlgs;\n+    \n+    switch (m_token.tk)\n+    {\n+    case tkCLASS:\n+        {\n+            if (!m_scriptContext->GetConfig()->IsES6ClassAndExtendsEnabled())\n+            {\n+                goto LDefault;\n+            }\n+\n+            // Before we parse the class itself we need to know if the class has an identifier name.\n+            // If it does, we'll treat this class as an ordinary class declaration which will bind \n+            // it to that name. Otherwise the class should parse as a nameless class expression and \n+            // bind only to the export binding.\n+            BOOL classHasName = false;\n+            RestorePoint parsedClass;\n+            m_pscan->Capture(&parsedClass);\n+            m_pscan->Scan();\n+\n+            if (m_token.tk == tkID)\n+            {\n+                classHasName = true;\n+            }\n+\n+            m_pscan->SeekTo(parsedClass);\n+            pnode = ParseClassDecl<buildAST>(classHasName, nullptr, nullptr, nullptr);\n+\n+            if (buildAST)\n+            {\n+                AnalysisAssert(pnode != nullptr);\n+                Assert(pnode->nop == knopClassDecl);\n+\n+                pnode->sxClass.SetIsDefaultModuleExport(true);\n+            }\n+\n+            break;\n+        }\n+    case tkID:\n+        // If we parsed an async token, it could either modify the next token (if it is a \n+        // function token) or it could be an identifier (let async = 0; export default async;).\n+        // To handle both cases, when we parse an async token we need to keep the parser state\n+        // and rewind if the next token is not function.\n+        if (wellKnownPropertyPids.async == m_token.GetIdentifier(m_phtbl))\n+        {\n+            RestorePoint parsedAsync;\n+            m_pscan->Capture(&parsedAsync);\n+            m_pscan->Scan();\n+            if (m_token.tk == tkFUNCTION)\n+            {\n+                // Token after async is function, consume the async token and continue to parse the \n+                // function as an async function.\n+                flags |= fFncAsync;\n+                goto LFunction;\n+            }\n+            // Token after async is not function, no idea what the async token is supposed to mean \n+            // so rewind and let the default case handle it.\n+            m_pscan->SeekTo(parsedAsync);\n+        }\n+        goto LDefault;\n+        break;\n+    case tkFUNCTION:\n+        {\n+LFunction:\n+            // We just parsed a function token but we need to figure out if the function \n+            // has an identifier name or not before we call the helper. \n+            RestorePoint parsedFunction;\n+            m_pscan->Capture(&parsedFunction);","path":"lib/Parser/Parse.cpp","position":214,"original_position":223,"commit_id":"b6043d1efab764c83aefdb347346995b1343825d","original_commit_id":"38ceb3abc23438017ba19fbfdd3791de7b7efbb5","user":{"login":"boingoing","id":1569843,"avatar_url":"https://avatars.githubusercontent.com/u/1569843?v=3","gravatar_id":"","url":"https://api.github.com/users/boingoing","html_url":"https://github.com/boingoing","followers_url":"https://api.github.com/users/boingoing/followers","following_url":"https://api.github.com/users/boingoing/following{/other_user}","gists_url":"https://api.github.com/users/boingoing/gists{/gist_id}","starred_url":"https://api.github.com/users/boingoing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boingoing/subscriptions","organizations_url":"https://api.github.com/users/boingoing/orgs","repos_url":"https://api.github.com/users/boingoing/repos","events_url":"https://api.github.com/users/boingoing/events{/privacy}","received_events_url":"https://api.github.com/users/boingoing/received_events","type":"User","site_admin":false},"body":"With the declaration flag, it throws if the function doesn't have a name. With the no name flag, it throws if the function does have a name. I don't remember where it throws if you pass no flag at all, I think it throws if the function has no name (same as declaration flag).","created_at":"2016-03-07T23:03:24Z","updated_at":"2016-03-07T23:03:24Z","html_url":"https://github.com/Microsoft/ChakraCore/pull/457#discussion_r55289195","pull_request_url":"https://api.github.com/repos/Microsoft/ChakraCore/pulls/457","_links":{"self":{"href":"https://api.github.com/repos/Microsoft/ChakraCore/pulls/comments/55289195"},"html":{"href":"https://github.com/Microsoft/ChakraCore/pull/457#discussion_r55289195"},"pull_request":{"href":"https://api.github.com/repos/Microsoft/ChakraCore/pulls/457"}}},"pull_request":{"url":"https://api.github.com/repos/Microsoft/ChakraCore/pulls/457","id":61763438,"html_url":"https://github.com/Microsoft/ChakraCore/pull/457","diff_url":"https://github.com/Microsoft/ChakraCore/pull/457.diff","patch_url":"https://github.com/Microsoft/ChakraCore/pull/457.patch","issue_url":"https://api.github.com/repos/Microsoft/ChakraCore/issues/457","number":457,"state":"open","locked":false,"title":"Implement interpreter support for module import/exports","user":{"login":"boingoing","id":1569843,"avatar_url":"https://avatars.githubusercontent.com/u/1569843?v=3","gravatar_id":"","url":"https://api.github.com/users/boingoing","html_url":"https://github.com/boingoing","followers_url":"https://api.github.com/users/boingoing/followers","following_url":"https://api.github.com/users/boingoing/following{/other_user}","gists_url":"https://api.github.com/users/boingoing/gists{/gist_id}","starred_url":"https://api.github.com/users/boingoing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boingoing/subscriptions","organizations_url":"https://api.github.com/users/boingoing/orgs","repos_url":"https://api.github.com/users/boingoing/repos","events_url":"https://api.github.com/users/boingoing/events{/privacy}","received_events_url":"https://api.github.com/users/boingoing/received_events","type":"User","site_admin":false},"body":"Add bytecodes and interpreter handlers for StModuleSlot and LdModuleSlot.\n\nAdd parser support for exporting async functions.\n\nBetter parsing support for export default statements.\n","created_at":"2016-03-04T20:02:36Z","updated_at":"2016-03-07T23:03:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d9c588bcec5826677715338a9e74b66af502b6a4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Microsoft/ChakraCore/pulls/457/commits","review_comments_url":"https://api.github.com/repos/Microsoft/ChakraCore/pulls/457/comments","review_comment_url":"https://api.github.com/repos/Microsoft/ChakraCore/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Microsoft/ChakraCore/issues/457/comments","statuses_url":"https://api.github.com/repos/Microsoft/ChakraCore/statuses/b6043d1efab764c83aefdb347346995b1343825d","head":{"label":"boingoing:modulebytecode","ref":"modulebytecode","sha":"b6043d1efab764c83aefdb347346995b1343825d","user":{"login":"boingoing","id":1569843,"avatar_url":"https://avatars.githubusercontent.com/u/1569843?v=3","gravatar_id":"","url":"https://api.github.com/users/boingoing","html_url":"https://github.com/boingoing","followers_url":"https://api.github.com/users/boingoing/followers","following_url":"https://api.github.com/users/boingoing/following{/other_user}","gists_url":"https://api.github.com/users/boingoing/gists{/gist_id}","starred_url":"https://api.github.com/users/boingoing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boingoing/subscriptions","organizations_url":"https://api.github.com/users/boingoing/orgs","repos_url":"https://api.github.com/users/boingoing/repos","events_url":"https://api.github.com/users/boingoing/events{/privacy}","received_events_url":"https://api.github.com/users/boingoing/received_events","type":"User","site_admin":false},"repo":{"id":51481366,"name":"ChakraCore","full_name":"boingoing/ChakraCore","owner":{"login":"boingoing","id":1569843,"avatar_url":"https://avatars.githubusercontent.com/u/1569843?v=3","gravatar_id":"","url":"https://api.github.com/users/boingoing","html_url":"https://github.com/boingoing","followers_url":"https://api.github.com/users/boingoing/followers","following_url":"https://api.github.com/users/boingoing/following{/other_user}","gists_url":"https://api.github.com/users/boingoing/gists{/gist_id}","starred_url":"https://api.github.com/users/boingoing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boingoing/subscriptions","organizations_url":"https://api.github.com/users/boingoing/orgs","repos_url":"https://api.github.com/users/boingoing/repos","events_url":"https://api.github.com/users/boingoing/events{/privacy}","received_events_url":"https://api.github.com/users/boingoing/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/boingoing/ChakraCore","description":"ChakraCore is the core part of the Chakra Javascript engine that powers Microsoft Edge","fork":true,"url":"https://api.github.com/repos/boingoing/ChakraCore","forks_url":"https://api.github.com/repos/boingoing/ChakraCore/forks","keys_url":"https://api.github.com/repos/boingoing/ChakraCore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/boingoing/ChakraCore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/boingoing/ChakraCore/teams","hooks_url":"https://api.github.com/repos/boingoing/ChakraCore/hooks","issue_events_url":"https://api.github.com/repos/boingoing/ChakraCore/issues/events{/number}","events_url":"https://api.github.com/repos/boingoing/ChakraCore/events","assignees_url":"https://api.github.com/repos/boingoing/ChakraCore/assignees{/user}","branches_url":"https://api.github.com/repos/boingoing/ChakraCore/branches{/branch}","tags_url":"https://api.github.com/repos/boingoing/ChakraCore/tags","blobs_url":"https://api.github.com/repos/boingoing/ChakraCore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/boingoing/ChakraCore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/boingoing/ChakraCore/git/refs{/sha}","trees_url":"https://api.github.com/repos/boingoing/ChakraCore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/boingoing/ChakraCore/statuses/{sha}","languages_url":"https://api.github.com/repos/boingoing/ChakraCore/languages","stargazers_url":"https://api.github.com/repos/boingoing/ChakraCore/stargazers","contributors_url":"https://api.github.com/repos/boingoing/ChakraCore/contributors","subscribers_url":"https://api.github.com/repos/boingoing/ChakraCore/subscribers","subscription_url":"https://api.github.com/repos/boingoing/ChakraCore/subscription","commits_url":"https://api.github.com/repos/boingoing/ChakraCore/commits{/sha}","git_commits_url":"https://api.github.com/repos/boingoing/ChakraCore/git/commits{/sha}","comments_url":"https://api.github.com/repos/boingoing/ChakraCore/comments{/number}","issue_comment_url":"https://api.github.com/repos/boingoing/ChakraCore/issues/comments{/number}","contents_url":"https://api.github.com/repos/boingoing/ChakraCore/contents/{+path}","compare_url":"https://api.github.com/repos/boingoing/ChakraCore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/boingoing/ChakraCore/merges","archive_url":"https://api.github.com/repos/boingoing/ChakraCore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/boingoing/ChakraCore/downloads","issues_url":"https://api.github.com/repos/boingoing/ChakraCore/issues{/number}","pulls_url":"https://api.github.com/repos/boingoing/ChakraCore/pulls{/number}","milestones_url":"https://api.github.com/repos/boingoing/ChakraCore/milestones{/number}","notifications_url":"https://api.github.com/repos/boingoing/ChakraCore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/boingoing/ChakraCore/labels{/name}","releases_url":"https://api.github.com/repos/boingoing/ChakraCore/releases{/id}","deployments_url":"https://api.github.com/repos/boingoing/ChakraCore/deployments","created_at":"2016-02-10T23:38:11Z","updated_at":"2016-02-10T23:38:27Z","pushed_at":"2016-03-07T22:58:57Z","git_url":"git://github.com/boingoing/ChakraCore.git","ssh_url":"git@github.com:boingoing/ChakraCore.git","clone_url":"https://github.com/boingoing/ChakraCore.git","svn_url":"https://github.com/boingoing/ChakraCore","homepage":null,"size":20454,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Microsoft:master","ref":"master","sha":"edc5d3c010186ca264eda973c771d4e598d1be25","user":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"repo":{"id":49086513,"name":"ChakraCore","full_name":"Microsoft/ChakraCore","owner":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Microsoft/ChakraCore","description":"ChakraCore is the core part of the Chakra Javascript engine that powers Microsoft Edge","fork":false,"url":"https://api.github.com/repos/Microsoft/ChakraCore","forks_url":"https://api.github.com/repos/Microsoft/ChakraCore/forks","keys_url":"https://api.github.com/repos/Microsoft/ChakraCore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Microsoft/ChakraCore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Microsoft/ChakraCore/teams","hooks_url":"https://api.github.com/repos/Microsoft/ChakraCore/hooks","issue_events_url":"https://api.github.com/repos/Microsoft/ChakraCore/issues/events{/number}","events_url":"https://api.github.com/repos/Microsoft/ChakraCore/events","assignees_url":"https://api.github.com/repos/Microsoft/ChakraCore/assignees{/user}","branches_url":"https://api.github.com/repos/Microsoft/ChakraCore/branches{/branch}","tags_url":"https://api.github.com/repos/Microsoft/ChakraCore/tags","blobs_url":"https://api.github.com/repos/Microsoft/ChakraCore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Microsoft/ChakraCore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Microsoft/ChakraCore/git/refs{/sha}","trees_url":"https://api.github.com/repos/Microsoft/ChakraCore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Microsoft/ChakraCore/statuses/{sha}","languages_url":"https://api.github.com/repos/Microsoft/ChakraCore/languages","stargazers_url":"https://api.github.com/repos/Microsoft/ChakraCore/stargazers","contributors_url":"https://api.github.com/repos/Microsoft/ChakraCore/contributors","subscribers_url":"https://api.github.com/repos/Microsoft/ChakraCore/subscribers","subscription_url":"https://api.github.com/repos/Microsoft/ChakraCore/subscription","commits_url":"https://api.github.com/repos/Microsoft/ChakraCore/commits{/sha}","git_commits_url":"https://api.github.com/repos/Microsoft/ChakraCore/git/commits{/sha}","comments_url":"https://api.github.com/repos/Microsoft/ChakraCore/comments{/number}","issue_comment_url":"https://api.github.com/repos/Microsoft/ChakraCore/issues/comments{/number}","contents_url":"https://api.github.com/repos/Microsoft/ChakraCore/contents/{+path}","compare_url":"https://api.github.com/repos/Microsoft/ChakraCore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Microsoft/ChakraCore/merges","archive_url":"https://api.github.com/repos/Microsoft/ChakraCore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Microsoft/ChakraCore/downloads","issues_url":"https://api.github.com/repos/Microsoft/ChakraCore/issues{/number}","pulls_url":"https://api.github.com/repos/Microsoft/ChakraCore/pulls{/number}","milestones_url":"https://api.github.com/repos/Microsoft/ChakraCore/milestones{/number}","notifications_url":"https://api.github.com/repos/Microsoft/ChakraCore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Microsoft/ChakraCore/labels{/name}","releases_url":"https://api.github.com/repos/Microsoft/ChakraCore/releases{/id}","deployments_url":"https://api.github.com/repos/Microsoft/ChakraCore/deployments","created_at":"2016-01-05T19:05:31Z","updated_at":"2016-03-07T16:39:12Z","pushed_at":"2016-03-07T22:58:58Z","git_url":"git://github.com/Microsoft/ChakraCore.git","ssh_url":"git@github.com:Microsoft/ChakraCore.git","clone_url":"https://github.com/Microsoft/ChakraCore.git","svn_url":"https://github.com/Microsoft/ChakraCore","homepage":null,"size":24869,"stargazers_count":4962,"watchers_count":4962,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":514,"mirror_url":null,"open_issues_count":120,"forks":514,"open_issues":120,"watchers":4962,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Microsoft/ChakraCore/pulls/457"},"html":{"href":"https://github.com/Microsoft/ChakraCore/pull/457"},"issue":{"href":"https://api.github.com/repos/Microsoft/ChakraCore/issues/457"},"comments":{"href":"https://api.github.com/repos/Microsoft/ChakraCore/issues/457/comments"},"review_comments":{"href":"https://api.github.com/repos/Microsoft/ChakraCore/pulls/457/comments"},"review_comment":{"href":"https://api.github.com/repos/Microsoft/ChakraCore/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Microsoft/ChakraCore/pulls/457/commits"},"statuses":{"href":"https://api.github.com/repos/Microsoft/ChakraCore/statuses/b6043d1efab764c83aefdb347346995b1343825d"}}}}