{"action":"created","issue":{"url":"https://api.github.com/repos/mishoo/UglifyJS2/issues/968","repository_url":"https://api.github.com/repos/mishoo/UglifyJS2","labels_url":"https://api.github.com/repos/mishoo/UglifyJS2/issues/968/labels{/name}","comments_url":"https://api.github.com/repos/mishoo/UglifyJS2/issues/968/comments","events_url":"https://api.github.com/repos/mishoo/UglifyJS2/issues/968/events","html_url":"https://github.com/mishoo/UglifyJS2/issues/968","id":133038747,"number":968,"title":"[ES6] UglifyJS.AST_Node.from_mozilla_ast(acorn ast) compatibility issues","user":{"login":"rwaldron","id":27985,"avatar_url":"https://avatars3.githubusercontent.com/u/27985?v=4","gravatar_id":"","url":"https://api.github.com/users/rwaldron","html_url":"https://github.com/rwaldron","followers_url":"https://api.github.com/users/rwaldron/followers","following_url":"https://api.github.com/users/rwaldron/following{/other_user}","gists_url":"https://api.github.com/users/rwaldron/gists{/gist_id}","starred_url":"https://api.github.com/users/rwaldron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rwaldron/subscriptions","organizations_url":"https://api.github.com/users/rwaldron/orgs","repos_url":"https://api.github.com/users/rwaldron/repos","events_url":"https://api.github.com/users/rwaldron/events{/privacy}","received_events_url":"https://api.github.com/users/rwaldron/received_events","type":"User","site_admin":false},"labels":[{"id":12518135,"url":"https://api.github.com/repos/mishoo/UglifyJS2/labels/bug","name":"bug","color":"fc2929","default":true},{"id":314667817,"url":"https://api.github.com/repos/mishoo/UglifyJS2/labels/harmony","name":"harmony","color":"009800","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":27,"created_at":"2016-02-11T17:43:16Z","updated_at":"2018-03-19T16:21:00Z","closed_at":null,"author_association":"NONE","body":"``` js\nvar acorn = require('acorn');\nvar uglify = require('uglify-js');\nvar source = 'x => x;';\nvar ast = uglify.AST_Node.from_mozilla_ast(\n  acorn.parse(source, {\n    ecmaVersion: 6,\n  })\n);\n```\n\nThis will result in a thrown exception: \n\n```\nTypeError: MOZ_TO_ME[node.type] is not a function\n```\n\nSo I added in some logging to see which `node.type` failed: \n\n```\nNode {\n  type: 'ArrowFunctionExpression',\n  start: 0,\n  end: 6,\n  id: null,\n  generator: false,\n  expression: true,\n  params: [ Node { type: 'Identifier', start: 0, end: 1, name: 'x' } ],\n  body: Node { type: 'Identifier', start: 5, end: 6, name: 'x' } }\n```\n\nFrom there I went to see if the [Parser API](https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Parser_API) was up to date, which it is, but the naming is different: \n\n```\ninterface ArrowExpression <: Function, Expression {\n    type: \"ArrowExpression\";\n    params: [ Pattern ];\n    defaults: [ Expression ];\n    rest: Identifier | null;\n    body: BlockStatement | Expression;\n    generator: boolean;\n    expression: boolean;\n}\n```\n"},"comment":{"url":"https://api.github.com/repos/mishoo/UglifyJS2/issues/comments/374272300","html_url":"https://github.com/mishoo/UglifyJS2/issues/968#issuecomment-374272300","issue_url":"https://api.github.com/repos/mishoo/UglifyJS2/issues/968","id":374272300,"user":{"login":"fabiosantoscode","id":1611595,"avatar_url":"https://avatars2.githubusercontent.com/u/1611595?v=4","gravatar_id":"","url":"https://api.github.com/users/fabiosantoscode","html_url":"https://github.com/fabiosantoscode","followers_url":"https://api.github.com/users/fabiosantoscode/followers","following_url":"https://api.github.com/users/fabiosantoscode/following{/other_user}","gists_url":"https://api.github.com/users/fabiosantoscode/gists{/gist_id}","starred_url":"https://api.github.com/users/fabiosantoscode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fabiosantoscode/subscriptions","organizations_url":"https://api.github.com/users/fabiosantoscode/orgs","repos_url":"https://api.github.com/users/fabiosantoscode/repos","events_url":"https://api.github.com/users/fabiosantoscode/events{/privacy}","received_events_url":"https://api.github.com/users/fabiosantoscode/received_events","type":"User","site_admin":false},"created_at":"2018-03-19T16:21:00Z","updated_at":"2018-03-19T16:21:00Z","author_association":"CONTRIBUTOR","body":"I'm currently having a look at this issue. A file that I made combining the ES6 features showcased in test/compress/harmony.js is parsed, converted to mozilla AST, and back, and then compared that to the originally parsed tree in a mocha test, which is passing. I'm pretty close."}}
{"actor":{"display_login":"fabiosantoscode"}}