{"action":"created","issue":{"url":"https://api.github.com/repos/power-assert-js/power-assert-formatter/issues/20","labels_url":"https://api.github.com/repos/power-assert-js/power-assert-formatter/issues/20/labels{/name}","comments_url":"https://api.github.com/repos/power-assert-js/power-assert-formatter/issues/20/comments","events_url":"https://api.github.com/repos/power-assert-js/power-assert-formatter/issues/20/events","html_url":"https://github.com/power-assert-js/power-assert-formatter/pull/20","id":115224194,"number":20,"title":"feat(power-assert-formatter): support async/await","user":{"login":"jamestalmage","id":4082216,"avatar_url":"https://avatars.githubusercontent.com/u/4082216?v=3","gravatar_id":"","url":"https://api.github.com/users/jamestalmage","html_url":"https://github.com/jamestalmage","followers_url":"https://api.github.com/users/jamestalmage/followers","following_url":"https://api.github.com/users/jamestalmage/following{/other_user}","gists_url":"https://api.github.com/users/jamestalmage/gists{/gist_id}","starred_url":"https://api.github.com/users/jamestalmage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamestalmage/subscriptions","organizations_url":"https://api.github.com/users/jamestalmage/orgs","repos_url":"https://api.github.com/users/jamestalmage/repos","events_url":"https://api.github.com/users/jamestalmage/events{/privacy}","received_events_url":"https://api.github.com/users/jamestalmage/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-11-05T07:28:56Z","updated_at":"2015-11-05T19:40:27Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/power-assert-js/power-assert-formatter/pulls/20","html_url":"https://github.com/power-assert-js/power-assert-formatter/pull/20","diff_url":"https://github.com/power-assert-js/power-assert-formatter/pull/20.diff","patch_url":"https://github.com/power-assert-js/power-assert-formatter/pull/20.patch"},"body":"switches parser back to acorn.\n\ncurrently depends on patched versions of espower and acorn-es7-plugin.\n\nI will update and squash commit as those PR's are accepted.\n\nRef: https://github.com/MatAtBread/acorn-es7-plugin/issues/2\nRef: https://github.com/power-assert-js/espower/pull/21"},"comment":{"url":"https://api.github.com/repos/power-assert-js/power-assert-formatter/issues/comments/154168620","html_url":"https://github.com/power-assert-js/power-assert-formatter/pull/20#issuecomment-154168620","issue_url":"https://api.github.com/repos/power-assert-js/power-assert-formatter/issues/20","id":154168620,"user":{"login":"MatAtBread","id":2789075,"avatar_url":"https://avatars.githubusercontent.com/u/2789075?v=3","gravatar_id":"","url":"https://api.github.com/users/MatAtBread","html_url":"https://github.com/MatAtBread","followers_url":"https://api.github.com/users/MatAtBread/followers","following_url":"https://api.github.com/users/MatAtBread/following{/other_user}","gists_url":"https://api.github.com/users/MatAtBread/gists{/gist_id}","starred_url":"https://api.github.com/users/MatAtBread/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MatAtBread/subscriptions","organizations_url":"https://api.github.com/users/MatAtBread/orgs","repos_url":"https://api.github.com/users/MatAtBread/repos","events_url":"https://api.github.com/users/MatAtBread/events{/privacy}","received_events_url":"https://api.github.com/users/MatAtBread/received_events","type":"User","site_admin":false},"created_at":"2015-11-05T19:40:27Z","updated_at":"2015-11-05T19:40:27Z","body":"The 'fudge' way of doing is to take your code, and jsut before parsing it, wrap it in the source text `async function fudge(){` ...`}`, parse it take your tree as `ast.body.body[0]`, where `ast` is the tree returned by acorn. It's similar to the way Node wraps your module in an IIFE - you don't see it, but it's there.\r\n\r\nI don't mind adding the flag, however it means you won't be able to move parsers easily, and the contextual bit is important - there's a very popular module called 'async' and it turns up as an identifier in many, many source files, as does `await`, so assuming you're always in an async (or even a generator) is a good way to break a lot of source. I know this because nodent did the same thing for a long time!\r\n\r\nNote that you can 'flip out' of it (I think) with code like\r\n````\r\nvar async = 123 ; // Just a var identifier\r\nasync function xxx() {\r\n    var await = 456 ; // Illegal - await is a keyword here\r\n    function abc() {\r\n        return async+789 ; // Legal - I think - as you're not in an async function anymore\r\n    }\r\n}\r\n\r\n````\r\n"}}